Two-Factor Verify
Dialog component for 2FA verification
SaaSAuth
Overview
TwoFactorVerify presents a 2FA verification form during login. Users enter a 6-digit TOTP code from their authenticator app, or switch to recovery code input. It supports a "trust this device" checkbox, attempt count warnings, loading states, and custom labels for i18n.
Usage
import { TwoFactorVerify } from "@leanicon/web-builder-library/saas";
<TwoFactorVerify
onVerify={async ({ code, isRecoveryCode, trustDevice }) => {
await verifyCode(code, isRecoveryCode, trustDevice);
}}
showTrustDevice={true}
showRecoveryCodeOption={true}
/>;Variants
Default
With Trust Device
Without Trust Device
Without Recovery Option
Loading State
With Error
Low Attempts Remaining
Last Attempt
All Features Enabled
Minimal UI
With Custom Labels
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
onVerify | (data: { code: string; useRecoveryCode: boolean; trustDevice: boolean; }) => void | — | Yes | |
attemptsRemaining | number | — | No | |
showTrustDevice | boolean | true | No | |
showRecoveryCodeOption | boolean | true | No | |
challengeId | string | — | No | |
labels | TwoFactorVerifyLabels | — | No | |
className | string | — | No | |
isLoading | boolean | false | No | |
error | string | — | No |