@kavachos/ui provides drop-in React components for auth flows. Each component renders inside KavachProvider from @kavachos/react and wires up to your KavachOS API route automatically, no manual fetch calls required.
Components require
@kavachos/react to be installed and a KavachProvider wrapping your app. See the React hooks page for provider setup.Installation
@kavachos/ui to your tailwind.config.ts content paths:
Available components
| Component | Description |
|---|---|
SignIn | Email/password and magic-link sign-in form |
SignUp | New account registration form |
UserButton | Avatar dropdown with sign-out and custom menu items |
ForgotPassword | Password reset request form |
TwoFactorVerify | TOTP/backup-code entry for 2FA flows |
OAuthButtons | Social login buttons (Google, GitHub, Discord, and more) |
AuthCard | Generic card shell for building custom auth pages |
SignIn
Renders an email/password form. PassshowMagicLink to add a passwordless tab. Pass providers to show OAuth buttons above the form.
OAuth providers to show above the form.
Add a magic-link tab alongside password sign-in.
URL for the “Sign up” link in the footer.
URL for the “Forgot password?” link.
Called on successful sign-in.
Heading text.
Must match your KavachOS API route.
SignUp
Include a name field.
Add a confirm-password field.
URL for the “Sign in” link.
Called on successful registration.
UserButton
Renders an avatar that opens a dropdown menu. Includes sign-out by default. PassmenuItems to add custom actions.
OAuthButtons
Use standalone when you want social login without the full sign-in card.OAUTH_PROVIDERS ships with metadata and icons for Google, GitHub, GitLab, Discord, Twitter, Facebook, Microsoft, Apple, LinkedIn, Slack, Notion, Reddit, Spotify, and Twitch. You can also pass a custom provider object matching OAuthProviderMeta.
Customization
Class name overrides
Every component accepts aclassNames prop with keys for each sub-element. Pass a string to append classes, or a function that receives the default class string.
Slot replacement
Pass acomponents prop to replace any primitive (input, button, link, divider, error). Useful when you need to use your own design system components.
cx utility is exported from @kavachos/ui for merging class names in your own slot components.
Framework examples
Next.js App Router
Vite + React Router
Next steps
React hooks
useSession, useUser, useSignIn, and more.
Adapters
Mount the KavachOS handler in Next.js, Express, Hono, and others.
Auth
Configure email/password, magic links, OAuth, and 2FA.