Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Session History Account Block for React

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.

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

Show where and when an account was signed in, with this session history chart for React with Base UI. A hairline frame with a plus mark on each corner holds a framed figure with the last seven days across the top and a lane for each device: its browser and system at the start and its sessions as bars on a track of seven days, placed by when each started and how long it lasted. A session that is still signed in is solid and runs to a "now" line, one that ended on its own is a lighter solid, and one that was revoked is hatched and ends in a cut mark with the word Revoked, so the three read apart without colour. Each bar is a button that opens a Popover with the session id (shortened, with a Copy Button), when it started, how long it lasted, the address and how it ended. A Toggle Group in the header (All, Active, Ended, Revoked, each with its count) dims the other bars, and a live line says how many show. On a phone the chart is replaced by a list of the same sessions with the same facts written out. It's built from Popover, Toggle Group, Copy Button, Badge and Guides, with a CSS entrance only. For the security page of any app that wants to show activity at a glance.

FAQ

How do I draw my own sessions?

Edit LANES (one per device, with its browser and system, city and an icon kind) and SESSIONS: each has a lane, an sid, an ISO start (2026-10-12T07:55), an end (or an empty string while it is open), a how (open, signed-out, expired or revoked), the address and, for a revoked one, the session that revoked it. The chart's days, every bar's position and width, the lengths and the counts are worked out from those and from the typed NOW, so nothing is typed twice. Keep sessions in one lane from overlapping, as a bar would cover the one before.

Why are the bars not only different colours?

Colour is never the only signal. An active session is solid and reaches the now line, an ended one is a lighter solid, and a revoked one is hatched with a cut mark and the word Revoked beside it; the legend under the chart shows the three. Every bar's name for a screen reader says when it started and how it stands ("Chrome on macOS, 12 Oct, 07:55, ended"), and its popover says the rest. The filter dims the other bars instead of removing them, so the chart never moves.

How does the popover work from the keyboard?

Tab reaches each bar in order, from the first lane to the last. Enter or Space opens its popover, Tab reaches the copy button inside it, and Escape closes it and returns focus to the bar. Only one popover is open at a time, and choosing another filter closes it. The copy button copies the whole session id and says so aloud; the popover shows it shortened.

What stays local, and how do I connect it to real sessions?

Everything is typed: the chart reads no sessions, makes no request and revokes nothing; the popover only shows facts. To use it for real, build SESSIONS from your session store (start, end, how it ended, the address and its place) and pass the moment of the response as NOW. Sessions longer than the window can start before the first day: clamp their start to it. The addresses here are from the documentation ranges, so use your own, approximate as they are.

How does it look on a phone?

Seven days of bars would be about 40 pixels wide each, too small to press, so below the medium breakpoint the chart gives way to a list of the same sessions, newest first: browser and place, the address, when it started and ended with its length, and how it ended, under an outline badge that says Active, Ended or Revoked. The filter above it hides the sessions it doesn't match, and the list keeps its height, so the page doesn't jump.

Is a chart of buttons accessible?

On a wide screen the bars are real buttons in lane order, each named for its session, and the chart is a figure with a name; the same facts are in each popover. The lane labels are text, the time axis is drawn but not needed to understand a bar's name, and the live line is a polite status present from the start. On a phone the list carries the facts as text. The chart is read start to end in any language: the time axis never flips in a right-to-left page.

  • Pro

    Active Sessions Account

    Sessions and devices

    The open sessions of an account with how each one signed in, when it started, was last active and ends, an idle filter, a two-step sign-out per row and one button that signs out the rest.

  • Pro

    Devices Account

    Sessions and devices

    The devices that have signed in to an account as hairline tiles grouped by type, each with its browsers, sessions, place, address and a menu to rename or remove it, and one button to remove every other device.

  • Pro

    Sign-in History Account

    Sessions and devices

    Every sign-in attempt in the last 14 days in a sortable, searchable table with failed attempts marked by an icon and a reason, rows that open to the user agent and steps, pages of 5 or 10 and four derived figures.

  • Pro

    Activity Log Account

    Sessions and devices

    What changed on an account as a vertical timeline grouped by day: icon nodes on a rail, a filter with counts for sign-in, security and data events, and a Details button that opens the device, place and address of each.

  • Pro

    IP Allowlist Account

    Sessions and devices

    An allowlist built from the networks of the last 12 sign-ins and rehearsed against them: seen networks with Allow, the allowed set, one field to add a range, how many sign-ins would pass or be blocked, and a switch refused while your own address is outside the list.

  • Pro

    Sign-in Alerts Account

    Sessions and devices

    Sign-in alerts as a list and a reading pane in one panel: tabs for Needs review and Resolved, severity as an icon and a word, unread dots, and a pane with two actions, This was me and Secure my account with three steps to tick.