MFA challenge
The second step of sign in: authenticator, text, passkey or recovery code, with a lockout that counts down after too many tries.
Caliper UI
Code 135790, recovery code K7Q2-M9XD. Three wrong codes lock it for 20 seconds.
When to use
- The account has two-step sign-in turned on.
- People need a way in when their phone is not to hand.
When not to use
- Setting two-step sign-in up; use security settings.
Installation
terminal
pnpm dlx shadcn@latest add @caliper/mfa-challenge
Adds its 12 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
API reference
MfaChallenge
11 props
PropTypeDefaultDescription
methods *readonly MfaMethod[]—
defaultMethodstring—The id of the method to start with. Defaults to the first.
accountstring—Who is signing in, e.g. their email.
lengthnumber6
trustDaysnumber | null30Offer "Trust this device" for this many days. `null` hides it.
resendAfternumber30Seconds before a text or email code can be sent again.
onVerify *(values: { method: MfaMethod; code: string; trustDevice: boolean; }) => MfaResult | Promise<MfaResult>—
onSend((method: MfaMethod) => MfaResult | Promise<MfaResult>)—Sends a code for text or email methods. Called when one is chosen and on resend.
onPasskey((values: { method: MfaMethod; trustDevice: boolean; }) => MfaResult | Promise<MfaResult>)—Runs the platform passkey prompt.
onCancel(() => void)—"Sign in as someone else".
classNamestring—
Keyboard
- No custom key handling; Tab and the native activation keys do the work.
Accessibility
It exposes list semantics, with aria-current, aria-hidden, aria-label, aria-busy and aria-invalid kept in step with state.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/mfa-challenge.mdThe index of every part is at /llms.txt.
More in Settings & security
Settings screenSettings that show what changed before you save: an ember mark and the previous value on each field, one bar that names the changes.Password resetForgot password and choose a new one: a cooldown on resend, wording that never reveals who has an account, and clear expired and saved states.Email verificationConfirm an address with a six-digit code that checks itself when complete, with resend and a way to fix a typo.