Componentpickers1.49 KB gzipZero dependencies
Two Factor
2FA setup panel with animated QR scan line, recovery codes and copy action.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add two-factorOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { TwoFactor } from "@/components/ui/two-factor"; <TwoFactor />Source code
two-factor.tsx + 2 helpersZero third-party dependencies (3 local files shown in tabs below).
tsxtwo-factor.tsx109 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils";import { encodeQrMatrix } from "./qr-code"; export interface TwoFactorProps extends React.HTMLAttributes<HTMLDivElement> { /** Backup recovery codes; displays generated sample if omitted */ recoveryCodes?: string[]; /** TOTP otpauth URI or token encoded into the setup QR code */ qrValue?: string; onConfirm?: () => void;} /** Two-factor authentication setup: QR code + recovery backup codes. */export function TwoFactor({ recoveryCodes, qrValue = "otpauth://totp/BigBullUI:guest@example.com?secret=JBSWY3DPEHPK3PXP&issuer=BigBullUI",Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { TwoFactor } from "@/components/ui/two-factor"; <TwoFactor />| Prop | Type | Description |
|---|---|---|
| recoveryCodes | string[] | Backup recovery codes; displays generated sample if omitted |
| qrValue | string | TOTP otpauth URI or token encoded into the setup QR code |
| onConfirm | () => void | Callback invoked on confirm. |