@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
SignIn
Renders an email/password form. PassshowMagicLink to add a passwordless tab. Pass providers to show OAuth buttons above the form.
OAuthProviderMeta[]
default:"[]"
OAuth providers to show above the form.
boolean
default:"false"
Add a magic-link tab alongside password sign-in.
string
URL for the “Sign up” link in the footer.
string
URL for the “Forgot password?” link.
() => void
Called on successful sign-in.
string
default:"\"Sign in\""
Heading text.
string
default:"\"/api/kavach\""
Must match your KavachOS API route.
SignUp
boolean
default:"false"
Include a name field.
boolean
default:"false"
Add a confirm-password field.
string
URL for the “Sign in” link.
() => void
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.