shadcn.io is not affiliated with official shadcn/ui
Recovery Options Account Block for React
An account's recovery options: four numbered ways back in, each with its state in words, a masked value, a quiet test and a one-field form to set it up, and a line that counts how many are ready.
Installation
Overview
Let people set up a way back in before they need one, with this recovery options panel for React with Base UI. A compact header holds the title and one sentence. Inside a hairline frame with a plus mark on each corner, a heading counts how many of the four ways back are set up and a line says what a lost phone would cost until three are. An ordered list numbers the ways in the order they are tried: a recovery email, a recovery phone, a security key and a trusted person. Each row has an outline Badge with its state in words (Not set up, Set up, or Verified on a day), the value masked, a ghost button that sends a test and a button that opens a field to set it up or change it, with Field, Input, a Shine Button to save and a Cancel. One field is open at a time. The last band is the status line, which says each result. It's built from Badge, Field, Input, Button, Shine Button and Guides, with a CSS entrance only. For the security page of any app, an account recovery step or a journal or vault that has no support desk to call.
FAQ
How do I fill it with my own recovery options?
Edit OPTIONS at the top: each has an id, a name, a state (none, set or verified), the day it was verified as since, its masked value, and what its field is called, hints and takes (field, hint, input, placeholder). The count in the heading, the line over the list and each badge are worked out from the states. GOAL is how many ways back make a person safe (three here): reach it and the line says so. The order of the array is the order the ways are tried, and the numbers follow it.
What does Save do, and what stays local?
Save checks the field (an address needs its at sign and a domain, a number needs its country code and seven digits), masks what you typed (the first two letters of an address, the last four digits of a number) and marks the row Set up. Nothing is sent, nothing is stored and no link or code goes out, so it never becomes Verified here; the status line says it was saved in this demo. In your app, post the value to your server, which sends the link or code, and turn the row to Verified when the person confirms it.
What does Send a test do?
It says in the status line that a test was sent in this demo and that nothing was sent. A real test sends a harmless message to that address or number so a person finds out now, not during a lockout, that the way back works; it would then show the day it last succeeded.
Why are they numbered, and can I reorder them?
The number is the order the ways are tried, so a list that read differently would mislead; it is a real ordered list for the same reason. There is no dragging: change the order in the array. A way that isn't set up is skipped when someone recovers an account.
Is it accessible?
The rows are an ordered list with a name saying so, state is written in words and an icon, never colour alone, and masked values are read as written. Each button names its row ("Set up security key", "Send a test to recovery email"), and the Set up or Change button says whether its field is open with aria-expanded. Opening a field moves focus into it; Save and Cancel return focus to the button that opened it. The problem line sits under the field, tied to it, with an icon and words in the text colour. One polite status line is present from the start.
How does it look on a phone?
Each row keeps its number, name, state and value, with the two buttons dropping under them. An open field takes the full width of the row, with Save and Cancel under it. The advice line may take two or three lines; its space is reserved, so it never moves the list when the count changes.
Related
- Pro
Backup Codes Account
Sign-in methodsAn account's backup codes: ten one-time codes in a hairline grid with the spent ones struck through, a meter of how many are left, a real text file to download and copy, and a new set behind a password.
- Pro
Two-Factor Methods Account
Sign-in methodsAn 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
Security Review Account
Sessions and devicesA 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.
- Pro
Trusted Devices Account
Sessions and devicesAn account's trusted devices as a table of devices against two switches, one to skip the sign-in code and one to skip the password prompt, with a sentence on what each device's choice means and a meter against the limit.
- Pro
Recovery Email Confirmation Login
Recovery and resetA recovery step for a casual game that shows the address on file masked and asks for the full address before it sends a code, then takes the six-digit code, with a helpdesk note for anyone without access.
- Pro
Lockout Recovery Login
Recovery and resetA recovery chooser for a utility account where ticking what you still have (email, phone, a backup code or none) ranks the ways back in live, with a daily request count.