Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Biometric Auth Login Block for React

A 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.

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

Ask for a fingerprint the way a phone does, with this biometric login block for React with Base UI. It's the sign-in page of Wellhurst, a health app: the page's rails run the full height of the screen and one band crosses it, and in the band a centred column holds a drawn sensor pad, a round Long Press Button with a fingerprint of concentric arcs. Hold it for two seconds and a fill sweeps across until it matches; let go early and the line under it says "Lifted too soon. Try again" and counts the miss. Holding Space or Enter works the same way, and the one Shine Button, Scan, is the way in for anyone who can't hold: it waits a moment and matches. The result replaces the pad in the same space, takes focus and offers "Scan again", with a link to a password for the days a finger won't read. No sensor is read and nobody is signed in; every line says so. It's built from Long Press Button, Button, Shine Button and Guides, with a CSS entrance only. For health, finance and any app that unlocks on a body check.

FAQ

Does this read a fingerprint?

No. The page never touches a sensor and never calls navigator.credentials: a full hold is the button's own two-second fill finishing, Scan is a 700 ms wait, and the result says that no sensor was read and nobody was signed in. In a product the pad becomes the button that starts a WebAuthn request with user verification required, where the code says so; the browser and the operating system draw the real biometric prompt, and your page only receives a signed answer to check on the server.

How does the hold work, and what if someone can't hold?

The Long Press Button confirms only when its fill has run for the full duration, so a tap or an early release never signs in. Small listeners on the pad's wrapper only watch for the press starting and ending, to tell an early lift from a full hold. A press that lasts is a pointer held down, or Space or Enter held on the focused pad. Because holding is hard for many people, Scan always does the same thing with one press, and after a second early lift the line under the pad points to it.

What changes with reduced motion?

The fill fades in instead of sweeping across, the pad still needs the full two seconds, and nothing else on the page moves. The header and the body fade up once on load, and that entrance is switched off too.

How is it announced to a screen reader?

There is one polite status line, present from load. It says "Scanning. Keep holding the pad" when a hold starts, "Lifted too soon" when it ends early, and the result when it matches; the line you can see under the pad is hidden from assistive technology so nothing is read twice. The result's heading takes focus, and "Scan again" returns focus to the pad.

Why is there a password link under the pad?

A fingerprint fails often: wet or worn fingers, a cold day, a sensor that is dirty or missing. A sign-in that offers only the body leaves those people locked out, so the quiet link under the button goes to your password form; point it at your own route.

  • Pro

    Passkey Login

    Passwordless

    An 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

    WebAuthn Login

    Passwordless

    The add-a-passkey page a code host shows after a password sign-in: a three-step setup (where, name, done) with Back, Not now and a Dont ask again box, beside a note on what a passkey is.

  • Pro

    Facial Recognition Login

    Biometrics and keys

    An 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.

  • Pro

    Hardware Key Login

    Biometrics and keys

    A 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 keys

    A 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

    Pattern Lock Login

    Biometrics and keys

    A private gallery's unlock page with a three by three grid of dots: drag across them with a pointer or use the arrow keys, Space and the digits 1 to 9, then Unlock; three tries before it locks.