shadcn.io is not affiliated with official shadcn/ui
Smart Card Login Block for React
A contractor portal's smart-card sign-in: a vertical rail of four steps (reader, card, certificate, PIN) beside one panel per step, with two certificates and three PIN attempts before the card locks.
Installation
Overview
Walk someone through a smart-card sign-in, with this smart card login block for React with Base UI. It's the sign-in page of Ironmere Systems, a contractor's secure portal: the page's rails run the full height of the screen and one band crosses it, split in two. At the start, the heading and a read-only vertical Steps list the four things the card needs, Reader, Card, Certificate and PIN, each finished step showing what it found. At the end, behind a divider, a small drawing of a reader and a card follows the list, over the one panel of the step in hand. Detect reader and "Insert card (demo)" each wait a moment. The certificate step offers two rows, Authentication and Signing, with the chosen one's subject, issuer and expiry in a list, and only the first can sign you in. The PIN step prints the demo PIN once and counts "3 attempts before the card locks". A Shine Button is the only coloured control and carries each step's action. The panels share one grid cell so nothing moves, and on a phone the list becomes a row of four. No reader or card is touched; each result says so. It's built from Steps, Field, Input, Button, Shine Button and Guides. For contractor, government and enterprise portals that sign in with a card.
FAQ
Does this read a smart card?
No. There is no reader, PC/SC call, WebUSB or card behind it: the waits are 700 ms timers, the certificates are typed data and the PIN is one typed value printed in the hint. In a real deployment the browser or the operating system draws the certificate picker and the PIN prompt during the TLS handshake (client-certificate sign-in), and your page never sees either, so a real page can only describe these steps, as this one does.
Why can't the Signing certificate sign me in?
Cards usually hold separate certificates for separate jobs, and a certificate's key usage says what it may do: one is for client authentication, one for signing documents and email. Choosing Signing and pressing "Use this certificate" shows a short reason ("Choose Authentication to sign in") in the page's problem line and keeps focus where you are; choose Authentication and it goes on to the PIN.
How does the lock work?
The demo PIN is 482916. A wrong PIN costs an attempt and the line says how many are left, "3 attempts before the card locks" counting down; the third wrong one locks the card, and the lock panel says that a real card would then be unlocked by the help desk. "Reset the card (demo)" returns to the PIN step with three attempts again. The page checks nothing but that one typed value.
How does the rail behave?
It is read-only: you move with the panel's button, not by pressing a step. A finished step shows what it found (the reader, the card's last digits, the certificate you chose) and a step that is still to come says "Not yet". Under the large breakpoint the list becomes a row of four numbers with their names, and the descriptions are read to screen readers but not drawn.
Where does focus go after each step?
To the next step's heading, so a screen reader reads where you are, and to the PIN field when the PIN step opens. A polite status line says what happened ("Reader found", "Card inserted", "Signed in, in this demo"), and each panel keeps its own button, so Enter in the PIN field presses the right one.
Related
- Pro
Hardware Key Login
Biometrics and keysA custody service's security-key page: a USB or NFC switch, three sign-in states, one button that waits for the key and then accepts it, and a drawing of a key and a port or a reader.
- Pro
PIN Entry Login
Biometrics and keysA wallet app's unlock page: four dots over a keypad of three by four keys on hairline cells, typed digits and Enter, tries counted down and a lock after the third miss.
- Pro
Multi Step Rail Login
Step by stepA three-step sign-in for a support desk: a vertical Steps rail at the start (Email, Password, Code) with what was given and an Edit button on each finished step, and the one panel of the step in hand at the end.
- Pro
Biometric Auth Login
Biometrics and keysA health app's sign-in page built around a press-and-hold fingerprint pad: hold it for two seconds to match, let go early and it says so, or press Scan if you cannot hold.
- Pro
Passkey Login
PasswordlessAn online bank's sign-in page and its passkey chooser shown open over a drawn sign-in screen: two passkeys as radio rows, Cancel and Continue, a verifying step and a signed-in result, with the real dialog behind the Use your passkey button.
- Pro
Facial Recognition Login
Biometrics and keysAn office check-in page with a drawn viewfinder over four prompts (look straight, turn left, turn right, blink): press Start and each prompt runs for 800 ms, with no camera opened.