SignInFormComplete sign-in form with email/password and OAuth options
SignUpFormUser registration with email verification support
UserProfileUser profile management with avatar and details
SecuritySettingsPassword change and two-factor authentication
AccountSectionAccount management with danger zone actions
OAuthButtonsSocial login buttons for OAuth providers
Quick Start
SylphxProvider for automatic auth context.import {
SignInForm,
SignUpForm,
UserProfile,
SecuritySettings,
AccountSection,
OAuthButtons,
} from '@sylphx/platform-sdk/react'SignInForm
A complete sign-in form with email/password authentication, OAuth provider buttons, and forgot password link. Handles validation, loading states, and error messages automatically.
import { SignInForm } from '@sylphx/platform-sdk/react'
export default function LoginPage() {
return (
<div className="flex min-h-screen items-center justify-center">
<SignInForm
onSuccess={(user) => {
console.log('Signed in:', user.email)
// Redirect handled automatically, or customize:
// router.push('/dashboard')
}}
onError={(error) => {
console.error('Sign in failed:', error.message)
}}
/>
</div>
)
}Props
| Property | Type | Description |
|---|---|---|
onSuccess | (user: User) => void | Callback fired after successful sign-in |
onError | (error: AuthError) => void | Callback fired on authentication error |
redirectUrl | string= /dashboard | URL to redirect after sign-in |
providers | OAuthProvider[]= ["google", "github"] | OAuth providers to display |
showForgotPassword | boolean= true | Show forgot password link |
showSignUpLink | boolean= true | Show sign-up link |
signUpUrl | string= /signup | URL for sign-up link |
forgotPasswordUrl | string= /forgot-password | URL for forgot password |
title | string= "Welcome back" | Form title |
description | string | Form description text |
theme | ThemeVariables | Custom theme overrides |
className | string | Additional CSS classes |
Advanced Examples
<SignInForm
providers={['google', 'github', 'apple', 'discord']}
title="Sign in to your account"
description="Choose your preferred method"
/>SignUpForm
User registration form with email verification, password strength indicator, and terms acceptance. Supports OAuth signup and custom fields.
import { SignUpForm } from '@sylphx/platform-sdk/react'
export default function RegisterPage() {
return (
<div className="flex min-h-screen items-center justify-center">
<SignUpForm
onSuccess={(user) => {
// User created, email verification sent
router.push('/verify-email')
}}
requireEmailVerification={true}
/>
</div>
)
}Props
| Property | Type | Description |
|---|---|---|
onSuccess | (user: User) => void | Callback fired after successful registration |
onError | (error: AuthError) => void | Callback fired on registration error |
redirectUrl | string= /verify-email | URL to redirect after sign-up |
providers | OAuthProvider[]= ["google", "github"] | OAuth providers for social signup |
requireEmailVerification | boolean= true | Require email verification |
showTermsCheckbox | boolean= true | Show terms acceptance checkbox |
termsUrl | string= /terms | URL to terms of service |
privacyUrl | string= /privacy | URL to privacy policy |
showPasswordStrength | boolean= true | Show password strength indicator |
minPasswordLength | number= 8 | Minimum password length |
showSignInLink | boolean= true | Show sign-in link |
signInUrl | string= /login | URL for sign-in link |
title | string= "Create an account" | Form title |
theme | ThemeVariables | Custom theme overrides |
className | string | Additional CSS classes |
Advanced Examples
<SignUpForm
additionalFields={[
{
name: 'fullName',
label: 'Full Name',
type: 'text',
required: true,
placeholder: 'John Doe',
},
{
name: 'company',
label: 'Company',
type: 'text',
required: false,
placeholder: 'Acme Inc.',
},
]}
onSuccess={(user, formData) => {
console.log('Custom fields:', formData.fullName, formData.company)
}}
/>Email Verification
requireEmailVerification is enabled, users will receive a verification email and must confirm before accessing protected routes.UserProfile
A complete user profile management component with avatar upload, name editing, and email management. Handles all profile update operations automatically.
import { UserProfile } from '@sylphx/platform-sdk/react'
export default function SettingsPage() {
return (
<div className="max-w-2xl mx-auto py-8">
<h1 className="text-2xl font-bold mb-6">Profile Settings</h1>
<UserProfile
onUpdate={(user) => {
toast.success('Profile updated!')
}}
/>
</div>
)
}Props
| Property | Type | Description |
|---|---|---|
onUpdate | (user: User) => void | Callback fired after profile update |
onError | (error: Error) => void | Callback fired on update error |
showAvatar | boolean= true | Show avatar upload section |
showEmail | boolean= true | Show email field |
showName | boolean= true | Show name fields |
allowEmailChange | boolean= true | Allow users to change email |
avatarUploadUrl | string | Custom avatar upload endpoint |
maxAvatarSize | number= 5242880 | Max avatar file size in bytes |
acceptedImageTypes | string[]= ["image/jpeg", "image/png", "image/webp"] | Accepted image MIME types |
customFields | CustomField[] | Additional profile fields to display |
layout | "card" | "flat"= "card" | Visual layout style |
theme | ThemeVariables | Custom theme overrides |
className | string | Additional CSS classes |
Advanced Examples
<UserProfile
customFields={[
{
name: 'bio',
label: 'Bio',
type: 'textarea',
placeholder: 'Tell us about yourself...',
maxLength: 500,
},
{
name: 'website',
label: 'Website',
type: 'url',
placeholder: 'https://yoursite.com',
},
{
name: 'timezone',
label: 'Timezone',
type: 'select',
options: [
{ value: 'UTC', label: 'UTC' },
{ value: 'America/New_York', label: 'Eastern Time' },
{ value: 'America/Los_Angeles', label: 'Pacific Time' },
{ value: 'Europe/London', label: 'London' },
],
},
]}
/>SecuritySettings
Security management component with password change, two-factor authentication setup, and session management. Handles all security operations securely.
import { SecuritySettings } from '@sylphx/platform-sdk/react'
export default function SecurityPage() {
return (
<div className="max-w-2xl mx-auto py-8">
<h1 className="text-2xl font-bold mb-6">Security</h1>
<SecuritySettings
onPasswordChange={() => {
toast.success('Password updated successfully!')
}}
on2FAEnabled={() => {
toast.success('Two-factor authentication enabled!')
}}
/>
</div>
)
}Props
| Property | Type | Description |
|---|---|---|
onPasswordChange | () => void | Callback fired after password change |
on2FAEnabled | () => void | Callback fired when 2FA is enabled |
on2FADisabled | () => void | Callback fired when 2FA is disabled |
onSessionRevoked | (sessionId: string) => void | Callback fired when a session is revoked |
onError | (error: Error) => void | Callback fired on any error |
showPasswordSection | boolean= true | Show password change section |
show2FASection | boolean= true | Show 2FA setup section |
showSessionsSection | boolean= true | Show active sessions section |
showLoginHistory | boolean= false | Show recent login history |
require2FA | boolean= false | Require 2FA (hide disable option) |
minPasswordLength | number= 8 | Minimum password length |
requireCurrentPassword | boolean= true | Require current password for changes |
theme | ThemeVariables | Custom theme overrides |
className | string | Additional CSS classes |
Advanced Examples
<SecuritySettings
showPasswordSection={true}
show2FASection={true}
showSessionsSection={true}
showLoginHistory={true}
onPasswordChange={() => {
// Log security event
analytics.track('password_changed')
toast.success('Password changed!')
}}
on2FAEnabled={() => {
analytics.track('2fa_enabled')
}}
onSessionRevoked={(sessionId) => {
analytics.track('session_revoked', { sessionId })
toast.success('Session revoked')
}}
/>Security Best Practice
requireCurrentPassword=true) when allowing users to change their password or security settings.AccountSection
Account management component with connected accounts, data export, and account deletion. Includes a danger zone for destructive actions with confirmation dialogs.
import { AccountSection } from '@sylphx/platform-sdk/react'
export default function AccountPage() {
return (
<div className="max-w-2xl mx-auto py-8">
<h1 className="text-2xl font-bold mb-6">Account</h1>
<AccountSection
onAccountDeleted={() => {
// Redirect to goodbye page
router.push('/goodbye')
}}
onDataExportRequested={() => {
toast.success('Data export started. You\'ll receive an email when ready.')
}}
/>
</div>
)
}Props
| Property | Type | Description |
|---|---|---|
onAccountDeleted | () => void | Callback fired after account deletion |
onDataExportRequested | () => void | Callback fired when data export is requested |
onAccountConnected | (provider: string) => void | Callback when OAuth account is connected |
onAccountDisconnected | (provider: string) => void | Callback when OAuth account is disconnected |
onError | (error: Error) => void | Callback fired on any error |
showConnectedAccounts | boolean= true | Show connected OAuth accounts |
showDataExport | boolean= true | Show data export option |
showDangerZone | boolean= true | Show danger zone with delete account |
allowAccountDeletion | boolean= true | Allow users to delete their account |
deletionCooldown | number= 30 | Days before account is permanently deleted |
requirePasswordForDeletion | boolean= true | Require password to delete account |
availableProviders | OAuthProvider[]= ["google", "github", "apple"] | OAuth providers available for connection |
theme | ThemeVariables | Custom theme overrides |
className | string | Additional CSS classes |
Advanced Examples
<AccountSection
showConnectedAccounts={true}
showDataExport={false}
showDangerZone={false}
availableProviders={['google', 'github', 'apple', 'discord']}
onAccountConnected={(provider) => {
toast.success(`Connected ${provider} account`)
}}
onAccountDisconnected={(provider) => {
toast.success(`Disconnected ${provider} account`)
}}
/>Account Deletion
deletionCooldown prop allows a grace period where users can cancel the deletion.Theming
All auth components support theming via the theme prop. Customize colors, fonts, and border radius to match your brand.
import { SignInForm, defaultTheme, type ThemeVariables } from '@sylphx/platform-sdk/react'
const customTheme: ThemeVariables = {
...defaultTheme,
colorPrimary: '#6366f1',
colorPrimaryHover: '#4f46e5',
colorBackground: '#ffffff',
colorForeground: '#1f2937',
colorMuted: '#f3f4f6',
colorMutedForeground: '#6b7280',
colorBorder: '#e5e7eb',
colorInput: '#ffffff',
colorDestructive: '#ef4444',
colorSuccess: '#22c55e',
fontFamily: 'Inter, sans-serif',
fontSize: '14px',
borderRadius: '0.75rem',
shadowSm: '0 1px 2px 0 rgb(0 0 0 / 0.05)',
shadowMd: '0 4px 6px -1px rgb(0 0 0 / 0.1)',
}
<SignInForm theme={customTheme} />
<SignUpForm theme={customTheme} />
<UserProfile theme={customTheme} />| Property | Type | Description |
|---|---|---|
colorPrimary | string= #000000 | Primary brand color |
colorPrimaryHover | string= #1f2937 | Primary color on hover |
colorBackground | string= #ffffff | Component background |
colorForeground | string= #1f2937 | Primary text color |
colorMuted | string= #f3f4f6 | Muted background |
colorMutedForeground | string= #6b7280 | Secondary text color |
colorBorder | string= #e5e7eb | Border color |
colorDestructive | string= #ef4444 | Error/destructive color |
colorSuccess | string= #22c55e | Success color |
fontFamily | string= system-ui | Font family |
borderRadius | string= 0.5rem | Border radius |
Best Practices
Use SylphxProvider
Wrap your app with SylphxProvider for automatic auth context and session management.
Handle Errors Gracefully
Always provide onError callbacks to show user-friendly error messages.
Customize Carefully
When theming, ensure sufficient color contrast for accessibility.
Secure by Default
Enable requireEmailVerification and requireCurrentPassword for sensitive operations.
Need more customization?
Use the auth hooks for fully custom UI while keeping all the security benefits.