Buttons
Three buttons with no style of their own. Each starts one action, and takes your class name or wraps your own element.
The SDK adds no style. The first two buttons here use the button classes of this site, and the third wraps a link.
Installation
- npm
- pnpm
- Yarn
- Bun
npm install @lumoauth/react
pnpm add @lumoauth/react
yarn add @lumoauth/react
bun add @lumoauth/react
Usage
There are two ways to use each button.
With a class name. The component renders a <button> with a default label ("Sign in", "Sign up", "Sign out") and your class.
import { SignInButton } from '@lumoauth/react';
import { buttonVariants } from '@/components/ui/button';
<SignInButton className={buttonVariants({ variant: 'outline' })} />
With children. The component wraps your element and adds the action to it. Use this for your own label or icon. className is not applied in this form: style the child.
import { SignOutButton } from '@lumoauth/react';
<SignOutButton afterSignOutUrl="/goodbye">
<span className="menu-item">Sign out</span>
</SignOutButton>
What each button does
| Button | Action |
|---|---|
SignInButton | Goes to the hosted sign-in page of your organization. (In password mode, which LumoAuth does not support, it goes to signInUrl.) |
SignUpButton | Goes to signUpUrl, your own sign-up page. Without it, to the afterSignUpUrl of the provider, or /sign-up. |
SignOutButton | Revokes the access token, clears the stored tokens, ends the session at LumoAuth, and goes to afterSignOutUrl. |
Props
SignInButton
| Prop | Type | Description |
|---|---|---|
children | ReactNode | Your own element. The component wraps it and adds the action. |
signInUrl | string | Used only in password mode, which LumoAuth does not support. In the default mode the button goes to the hosted sign-in page. |
className | string | Class name for the default button. Not applied when you pass children. |
SignUpButton
| Prop | Type | Description |
|---|---|---|
children | ReactNode | Your own element. The component wraps it and adds the action. |
signUpUrl | string | Your sign-up page. Defaults to the afterSignUpUrl of the provider, then to /sign-up. |
className | string | Class name for the default button. Not applied when you pass children. |
SignOutButton
| Prop | Type | Description |
|---|---|---|
children | ReactNode | Your own element. The component wraps it and adds the action. |
afterSignOutUrl | string | Where to go after sign-out. Defaults to the afterSignOutUrl of the provider, then to /. |
className | string | Class name for the default button. Not applied when you pass children. |