Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Two-Factor Required Error Block for React

A full-screen gate for a workspace that now requires two-factor authentication: a grace period drawn as fourteen day segments, three method cells, a Set up now button and a list of steps that follows the chosen method.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Give people a deadline and a choice, with this two-factor required page for React with Base UI. It's the screen Keyhollow, a password manager, shows a member whose workspace has switched on two-factor authentication: the page's two side rails run its full height and one band crosses the screen between two rules with a plus mark where each meets a rail. Under the heading, the grace period is drawn as fourteen day segments (eight used, six left) with the deadline beside it. Three methods sit on shared hairlines in a frame, made with Guides: an authenticator app (recommended), a security key and a text message (the fallback), each a native radio cell. The Shine Button Set up now is the only coloured control, with a ghost Button to ask the admin for more time, and below them a read-only Steps list shows the three steps of the chosen method. Nothing is set up: each press says what a real page would do. For any product that enforces a second factor on a deadline.

FAQ

What does Set up now do, and what stays in the page?

Nothing leaves the page and nothing is set up. Pressing it shows a spinner on the button for under a second, then a polite status line says what a real page would open (step 1 of the chosen method) and that this demo set up nothing; focus moves to that line because the busy button drops it. Ask the admin for more time is the same: a note that a request would go to the workspace admin. To wire it for real, start your enrolment flow from setUp and send the request from askMore.

Where do the days come from?

From two typed dates (the day the grace period began and its last day) and one AS_OF day standing in for today. The segments, "6 of 14 days left" and the deadline are worked out from them with UTC day numbers, so they read the same on the server and in every time zone, and nothing reads the clock. In your app, take the dates from your workspace's policy and the date from the server.

Is the method picker accessible?

Yes. The cells are native radio buttons inside a labelled radio group: Tab reaches the group, the arrow keys move between the three methods and choosing one is the same as clicking it. The chosen cell is a solid tint with a heavy edge and a filled dot, never colour alone, and a polite line says which method was chosen.

Why a read-only list of steps?

Because people decide faster when they can see what the work is. The Steps list previews the three steps of the chosen method and changes with it; it isn't a wizard and takes no clicks. Its three rows have the same height for every method, so choosing one never moves the page.

How is this different from a sign-in challenge?

A sign-in challenge asks for a code you already have; this page tells someone their account is about to be locked unless they enrol a factor, and gives them a deadline and a way to ask for more time. It has no password field and no code field.

Should this page return an error status?

Your server decides what to send. A page that blocks access until a policy is met is usually a 403 with this screen as the body; a page that still works during the grace period would be a normal 200 with a banner. Send the real status where you render this page.

  • Pro

    Phone Not Verified Error

    Sign-in and identity

    A full-screen page for an unconfirmed phone number: a Send the code button that waits 30 seconds, a six-slot code field with the demo code printed once, and a list of what is locked that flips to unlocked when the number is verified.

  • Pro

    Captcha Failed Error

    Sign-in and identity

    A full-screen page for a human check that timed out: a box to tick that escalates to a typed question, with no picture to read, over four accordion rows that show what the check looked at and what to do.

  • Pro

    Session Expired Error

    Sign-in and identity

    A full-screen session-ended page for a billing back office: a session ruler from 09:00 to 10:30 UTC with the active time solid and the idle gap hatched, a legend of when you signed in, were last active and were signed out, and a demo control that swaps the cause.

  • Pro

    An account's two-factor methods as rows with their role, history and a Test that opens a code field in place, Make primary, a guarded Remove, and a Set up that opens a QR code, a key name or a number.

  • Pro

    A split sign-in step for an investing app: a six-digit code field beside a demo authenticator whose code and draining ring change every 30 seconds, where the current code and the one before it both sign in.

  • Pro

    Security Review Account

    Sessions and devices

    A security review in three sections, devices, recent sign-ins and sign-in methods, where each item is answered with Yes, this is mine or Remove, with a progress bar and a Finish button that waits for every answer.