shadcn.io is not affiliated with official shadcn/ui
Verified Addresses Account Block for React
The addresses on an account with which are proven by a postcard code: three ruled rows with one primary, a verify band with a code field and a resend, a form that checks the postal code by country, and Remove with Undo.
Installation
Overview
Make people prove where they ship to before it matters, with this address panel for React with Base UI. A hairline frame with a plus mark on each corner holds three ruled rows, each saying "Verified by postcard on 12 Aug" or "Not verified", with one marked Primary. Make primary on an address that is not verified opens the verify band under the list: a sentence naming the address, a six-digit Input OTP with the demo's code printed beside it, and a Resend that brings the next code. Typing or pasting six digits checks them: a wrong code clears the field and says so, the right one verifies the address and makes it primary. Under the band a form adds an address, with a Native Select for the country and a postal code checked by country in words. Remove asks in an Alert Dialog and Undo walks back the last change. The header's Shine Button takes you to the form. It's built from Input OTP, Native Select, Alert Dialog, Badge, Field, Input, Button, Shine Button and Guides, with a CSS entrance only. For the account page of any app that ships or bills.
FAQ
How do I fill it with my own addresses and countries?
Edit START (each address has a street, city, postal code, a country and the ISO day it was verified, or nothing) and COUNTRIES, whose hint is the sentence a bad code gets. codeProblem holds the rule per country: five digits for the US and Germany, a pattern for the UK; add a branch and a regular expression for each country you serve. Days are fixed ISO values with AS_OF as today, never the clock.
How does the postcard code work?
In this demo the code is printed in the band, because no postcard is mailed: "In this demo the code is 482 913." Resend moves to the next typed code and says so. The six digits check themselves on the sixth one, typed or pasted with spaces and all, and Enter checks a short entry and says how many digits are missing. A wrong code clears the field and keeps focus in it. To make it real, mail a code from your server in make and resend and check it on the server in verify; never ship the code to the page.
What stays local?
Everything. Making an address primary, verifying, adding and removing change this page's state and say so in the foot; nothing is mailed or stored and a reload starts again. Undo walks back the last change, which a real server can't always do.
How does removing an address work?
Remove opens an alert dialog that says what stops (shipping and billing to it) and that the code would be needed again. Focus starts on Keep it, Escape closes it and focus returns to the button. The primary address cannot be removed: the button answers in the status line with what to do first. After you confirm, focus goes to the next row's Remove button.
Why does the verify band never move the page?
The band holds an unseen copy of its form's boxes, so it keeps the same height whether it says "choose an address" or shows the code field. The list also holds its height while the rows change, and the form's problem lines are always there.
Is it accessible, and how does it look on a phone?
The rows are a real list, every button says which address it is for ("Make Studio primary"), the code field is named "Postcard code" and its problem is linked to it, and the foot is a polite live region present from the start. Addresses keep their reading order in a right-to-left page. On a phone the actions sit under each address, the form's fields stack and the foot with Undo stays pinned to the bottom of the screen.
Related
- Pro
Basic Info Account
ProfileThe identity fields of an account as ruled rows that edit in place: full name, a username checked against taken names, an email that stays unverified until confirmed, a masked phone and a date of birth.
- Pro
Profile Completion Account
ProfileHow complete a profile is by section: a derived percent over a segmented bar, four sections that open one at a time to their items, and a Not applicable that counts as done and can be undone.
- Pro
Recovery Options Account
Sign-in methodsAn 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.
- Pro
Billing Address Dialog
Payments and plansAn invoice page with its billing-address dialog shown open: the form relabels, reorders and revalidates for the United States, the United Kingdom, Germany and Japan, a switch fills the company's address, and the address is printed the way an envelope would carry it.
- Pro
Address Autocomplete Dialog
Pickers and searchA meal-kit delivery page with its address dialog shown open: typing filters eight addresses of an invented town into an inline list you can arrow through, a choice fills four editable fields, and Enter it manually offers the same four, empty.
- Pro
Verification Record Account
VerificationWhat an account has proven and when each proof ends: four rows with the method, the day and a derived end date, a due-soon state, one band that takes a six-digit code or a name, and Undo.