SigninModal Component
The SigninModal component provides a complete authentication UI for your application. It supports multiple login methods and handles the entire authentication flow.
Basic Usage
import { SigninModal } from '@volr/react-ui';
import { useState } from 'react';
function App() {
const [showSignin, setShowSignin] = useState(false);
return (
<>
<button onClick={() => setShowSignin(true)}>Sign In</button>
<SigninModal
isOpen={showSignin}
onClose={() => setShowSignin(false)}
onError={(error) => console.error('Auth error:', error)}
/>
</>
);
}
Props
| Prop | Type | Required | Description |
|---|---|---|---|
isOpen | boolean | Yes | Controls modal visibility |
onClose | () => void | Yes | Called when modal should close |
onError | (error: Error) => void | No | Called when authentication errors occur |
Supported Login Methods
The SigninModal supports the following login methods, which can be enabled/disabled via VolrUIProvider configuration:
Email OTP
Users enter their email address and receive a one-time password (OTP) code via email.
// Email OTP is enabled by default
// Configure SMTP in Dashboard > Settings > Authentication
Social Login
Users can sign in with their social accounts:
- Google: OAuth 2.0 authentication
- Twitter: OAuth 1.0a authentication
// Enable social providers in VolrUIProvider
<VolrUIProvider
config={{
// ... other config
}}
socialProviders={['google', 'twitter']}
/>
SIWE (Sign-In with Ethereum)
Users connect their Web3 wallet (MetaMask, WalletConnect, etc.) and sign a message to authenticate.
// Enable SIWE in VolrUIProvider
<VolrUIProvider
config={{
// ... other config
}}
enabledLoginMethods={{
siwe: true,
}}
/>
Authentication Flow
The SigninModal handles the following flow automatically:
- Method Selection: User chooses login method
- Authentication: User completes authentication (OTP, social, or SIWE)
- Passkey Enrollment: If user doesn't have a passkey, they're prompted to create one
- Completion: User is authenticated and ready to use Volr SDK