Componentpickers1.49 KB gzipZero dependencies

Two Factor

2FA setup panel with animated QR scan line, recovery codes and copy action.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add two-factor

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { TwoFactor } from "@/components/ui/two-factor"; <TwoFactor />

Source code

two-factor.tsx + 2 helpers

Zero 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 />
PropTypeDescription
recoveryCodesstring[]Backup recovery codes; displays generated sample if omitted
qrValuestringTOTP otpauth URI or token encoded into the setup QR code
onConfirm() => voidCallback invoked on confirm.