Recovery Codes

Save your recovery codes

Keep these codes somewhere safe. Each one can be used once to sign in if you lose access to your authenticator.

  • 4f9k-2x7p
  • 8m3q-1v6z
  • 7c2w-9b4n
  • 5h8d-3t1r
  • 6j4l-7y2k
  • 9p1s-4f8m
  • 2w6x-5q3v
  • 3n7b-8c2h

You won't be able to view these codes again.

About this block

Recovery CodesPRO

Full-height two-factor backup screen that displays single-use recovery codes in a grid with copy and download actions, a warning callout, and a confirmation checkbox that gates the continue button. Perfect for 2FA setup and account recovery.

Auth22: Recovery Codes

Full-height two-factor backup screen: a centered key icon and heading over a bordered card that lists single-use recovery codes in a two-column monospace grid, copy and download actions, a destructive warning callout, and a confirmation checkbox that gates the continue button. Built for 2FA setup and account recovery flows.

Upgrade to Pro

Pro blocks install through the shadcn CLI with your license key and ship their full source. Docs and live previews stay open to everyone, so you can read every block's details first.

Upgrade Now

Installation

Swap YOUR_EMAIL and YOUR_KEY for the email and license key on your account. Find your license key on your account page.

Radix flavor

bash
npx shadcn add "https://ui.beste.co/r/auth22?email=YOUR_EMAIL&license_key=YOUR_KEY"

Base UI flavor

bash
npx shadcn add "https://ui.beste.co/r-base/auth22?email=YOUR_EMAIL&license_key=YOUR_KEY"

This installs the block to components/beste/block/auth22.tsx and the button, checkbox, and field shadcn/ui primitives it's built on.

Quick start

The installed file exports auth22Demo alongside the block: the exact props behind the preview above. Spread it to get a working recovery-codes screen in one line.

tsx
import { Auth22, auth22Demo } from "@/components/beste/block/auth22";

export default function RecoveryCodesPage() {
  return <Auth22 {...auth22Demo} />;
}

Then replace the demo with your own props. Written out, a trimmed setup looks like this:

tsx
import { KeyRound } from "lucide-react";
import { Auth22 } from "@/components/beste/block/auth22";

export default function RecoveryCodesPage() {
  return (
    <Auth22
      icon={<KeyRound className="size-7" />}
      heading="Save your recovery codes"
      description="Keep these codes somewhere safe."
      codes={["4f9k-2x7p", "8m3q-1v6z", "7c2w-9b4n", "5h8d-3t1r"]}
      downloadFileName="recovery-codes.txt"
      continueButton={{ label: "Continue", href: "/dashboard" }}
      labels={{
        copy: "Copy codes",
        download: "Download",
        warning: "You won't be able to view these codes again.",
        confirm: "I have saved my recovery codes",
      }}
    />
  );
}

Props

PropTypeDefaultDescription
iconReact.ReactNodeIcon rendered in a muted circle above the heading
headingstringScreen title
descriptionstringSubtext below the heading
codesstring[][]Recovery codes shown in a two-column monospace grid
downloadFileNamestring"recovery-codes.txt"File name used for the client-side .txt download
continueButton{ label: string; href: string }Bottom action; hidden entirely when not set
labelsobject{}Button and callout copy, see below
classNamestringExtra classes for the outer <section>
ts
type Auth22Labels = {
  copy?: string;
  copied?: string;
  download?: string;
  warning?: string;
  confirm?: string;
};

Behavior notes

  • The copy button performs a real navigator.clipboard.writeText(codes.join("\n")) call; on success it swaps its icon and label to labels.copied (default "Copied") for 2 seconds via setTimeout, then reverts.
  • The download button performs a real client-side download: it builds a Blob from codes.join("\n"), creates an object URL, and clicks a temporary <a download> anchor, all without any server request; the file name comes from downloadFileName.
  • The continue button is disabled (and rendered as a plain, non-link <Button>) whenever labels.confirm is set and the checkbox is unchecked; once checked, or whenever labels.confirm is omitted entirely, it becomes a real asChild link to continueButton.href.
  • The confirmation checkbox and its label only render when labels.confirm is set; the warning callout (destructive-tinted, with a TriangleAlert icon) only renders when labels.warning is set.
  • Both the copy and download buttons are individually optional via labels.copy / labels.download, so either action can be dropped without affecting the other.

Wiring the form up

This block ships the form markup only; state, validation, and submit are yours to add. Our guide wires the shadcn Field primitives to React Hook Form, TanStack Form, and Formisch on one field system.

More Auth blocks

View all Auth
PRO

auth47

Recovery Phrase Entry

Full-height account recovery screen with a numbered grid of word inputs and paste-to-fill support, plus a restore button that unlocks once every word is entered. Perfect for seed phrase and recovery-phrase restore flows.

FREE

auth4

Forgot Password Request

Full-height password recovery screen with a centered icon, single email field built on the shadcn Field primitives, a send-reset-link button, and a back-to-sign-in link. Perfect for the first step of any password reset flow.

PRO

auth12

Email Confirmed Success

Full-height success screen with a large confirmation check, a heading and message, a primary continue button, and a support link. Perfect for the final step after email verification or account activation.

PRO

auth39

Enable Two-Factor

Full-height security setup step where the user picks a two-factor method from selectable cards (authenticator app, SMS, or security key), with a skip option. Perfect for guiding users through enabling 2FA.

FREE

auth3

Email Verification Code

Full-height OTP verification screen with a centered icon, segmented six-digit code input, a verify button that unlocks once the code is complete, and a live resend countdown timer. Perfect for two-factor auth, magic links, and email confirmation flows.

PRO

auth8

Welcome Back Unlock

Full-height re-authentication screen showing the signed-in user's avatar, name, and email with a single password field, a forgot-password link, and a use-a-different-account option. Perfect for session unlock and returning-user prompts.