AuthPage
Complete authentication page with cached logins, provider buttons, and credential forms.
Basic Usage
<script>
import { AuthPage } from '@kavach/ui'
</script>
<AuthPage />With Providers
<script>
import { AuthPage } from '@kavach/ui'
</script>
<AuthPage
providers={[
{ name: 'google', label: 'Google' },
{ name: 'github', label: 'GitHub' },
{ name: 'magic', mode: 'otp', label: 'Magic Link' },
{ name: 'password', mode: 'password', label: 'Email' }
]}
/>With Callbacks
<AuthPage
providers={[...]}
onSuccess={() => {
goto('/dashboard')
}}
onError={(error) => {
console.error(error)
}}
/>Features
- Cached Logins — Shows recent logins at top for quick access
- Collapsible Forms — Provider groups can collapse
- Passkey Support — Shows passkey option if adapter supports it
- Loading States — Built-in loading indicators
- Error Display — Shows auth errors inline
Props
| Prop | Type | Description |
|---|---|---|
| providers | Provider[] | Auth providers to display |
| onSuccess | function | Called on successful auth |
| onError | function | Called on auth error |
| cachedLogins | boolean | Enable cached login cards |