Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Trusted Device Management Login Block for React

A panel of trusted devices for a smart-home app: each has a trust-expiry meter, Forget asks in an alert dialog, Undo brings the last one back and a Shine Button trusts this browser for 30 days.

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

Let people decide which devices skip the code, with this trusted device management login block for React with Base UI. It's the choice about this browser at the sign-in gate of Voltlark, a smart-home app, shown as a panel with a short header over one framed panel. Four devices (a MacBook that is this browser, an iPhone, a Work PC and an iPad) each carry a thin Progress meter and "Expires in 21 days", worked out from a typed day. Forget asks first in an Alert Dialog where Cancel takes the first focus and the confirm names the device; the row then leaves the list, Undo in the foot brings the last one back, and forgetting every device shows an Empty state in the list's own space. Forgetting this browser wakes the one Shine Button, Trust this browser for 30 days, which starts its meter over. It's built from Progress, Alert Dialog, Badge, Empty, Button, Shine Button and Guides, with a CSS entrance only. For sign-ins that skip a code on devices the person already trusts.

FAQ

What stays in the page, and how do I wire it for real?

Everything. The four devices and the day trust began are typed constants, forgetting and trusting change the page's state only, and no cookie is written. In a product, give each trusted browser a random token in an HttpOnly cookie and keep a record on your server with the day trust began; the expiry is that day plus 30 days. Forget deletes the record (and signs that device out of the shortcut), and Trust this browser creates a new one after the person has passed the full sign-in.

How is Expires in 21 days worked out?

From two typed days, never the clock: the demo's own today and the day each device's trust began. Days remaining are 30 minus the days elapsed, and the meter is that number over 30. Because the day is typed, the page reads the same whenever it is opened. Trusting this browser again sets its day to the demo's today, so its meter reads 30 days.

What does Forget do, and why does it ask first?

Forgetting removes the shortcut, so the next sign-in from that device asks for a code again. It opens an alert dialog: Cancel, labelled Keep trusting, takes the first focus, Escape also keeps the device, and the confirm names the device ("Forget iPhone"). It is the destructive style with text tuned to read at AA in both themes.

What does Undo do, and what happens if I forget every device?

Undo is always in the foot and brings back the most recently forgotten device in its old place, one press per device. When nothing is left, a designed empty state takes the list's space, and the panel does not change height because an unseen copy of the full list holds it. Trust this browser then brings this browser back with a fresh meter.

How is this different from the session limit and the account's trusted devices page?

The session limit is a gate that blocks the sign-in until a screen is given up. The account area's trusted devices page is the full manager, used after you are in, with a switch per device. This is the pre-sign-in choice about this browser: how long each device keeps skipping the code, forget one, trust this one.

Is it usable with a keyboard and a screen reader?

Yes. Each Forget button is named for its device ("Forget iPhone", an icon alone on a phone), the meters are decorative because the words say the same thing, and the status line announces each change. After a device leaves the list, focus moves to Undo, which is always present.

  • Pro

    Session Limit Login

    Sessions and devices

    A sign-in gate for a video streaming service: a meter of screens in use, three sessions as radio rows, and one button that ends the chosen session so this browser can continue.

  • Pro

    Trusted Devices Account

    Sessions and devices

    An 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

    Remember Device Login

    Sessions and devices

    A full-height sign-in page for an email client where trusting the browser is a choice with a consequence: a switch opens a 7, 30 or 90 day choice and a live line works out the date from a typed today.

  • Pro

    Device Approval Login

    Codes and approvals

    A sign-in screen with a drawn phone: it asks whether the request is you, shows three number buttons, approves the matching one, denies a wrong one and points Deny to a password change.

  • Pro

    Session History Account

    Sessions and devices

    The last seven days of sessions as a swimlane: a lane per device, each session a bar placed by its start and length, revoked ones ending in a cut mark, and a popover with the id, length, address and how it ended.

  • Pro

    Session Policy Settings

    Sign-in and security

    A session policy settings panel that leads with the sentence the settings amount to, two sliders with stops for the idle timeout and the longest session that hold each other to one rule, a device limit and an end-all-sessions dialog.