Session List

Keeps the current device safe while cleaning up sessions: it's pinned and marked, excluded from "sign out all others", and confirmed inline.

StopsSigned out own device by mistake

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/session-list.json

The files land in your project. They're yours to edit.

Usage

session-list-usage.tsx
import { SessionList, type Session } from "@/components/ui/session-list"

<SessionList sessions={sessions} onRevoke={(id) => remove([id])} onRevokeOthers={remove} />

What it catches

  • Signing out the current device by accident (inline confirm, Cancel focused)
  • "Sign out all others" including this device (it never does)
  • Sessions from a different country than this device
  • Location shown as approximate, not exact

Props

SessionList props
PropTypeDefault
sessions* (required)

Signed-in sessions; mark the current one with current: true.

Session[]—
onRevoke* (required)

Ends one session. Return a promise to show a pending state; a rejection keeps the row.

(id: string) => void | Promise<void>—
onRevokeOthers

Ends every session except the current one. Defaults to calling `onRevoke` for each.

(ids: string[]) => void | Promise<void>—
locale

Locale for relative times.

string—
title

Templates: `{count}` is filled in.

string"Where you're signed in"
thisDeviceLabel

Badge on the current device.

string"This device"
activeNowLabel

Shown for sessions active right now.

string"Active now"
revokeLabel

Label of each sign-out button.

string"Sign out"
signOutHereLabel

Label of the sign-out button on this device.

string"Sign out here"
revokeOthersLabel

Label of the sign-out-all-others button.

string"Sign out all others ({count})"
currentWarning

Inline warning before signing out this device.

string"This signs you out of this browser now. Anything unsaved…
confirmCurrentLabel

Label of the confirm button for this device.

string"Sign me out"
cancelLabel

Label of the Cancel button.

string"Cancel"
awayText

Flags a session from another country.

string"Different country from this device. Don't recognise it? …
approximateText

Note that locations are approximate.

string"Locations are approximate, based on IP address."
noOthersText

Shown when this is the only session.

string"You're only signed in on this device."
revokedText

Announced after sessions are signed out.

string"Done: {count} signed out."

* required. Also accepts the native props of <section> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Section labelled by its title; rows set aria-busy while revoking
  • Inline confirm is a labelled group; Cancel gets focus, Escape closes and focus returns
  • Revoke buttons include sr-only device and location
  • Outcome announced in a polite live region

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

This is a UX guard rail. Enforce on the server: Revoke sessions server-side and never trust a client flag for which session is current.

  • Country comparison uses the IP-derived location you pass, which can be wrong (VPNs, mobile carriers)
  • Does not revoke sessions itself; your callbacks do

What it stops

Signed out own device by mistake

Also known as

active sessions · devices · logged in devices · sign out everywhere · security settings · where you're logged in · login activity

Dependencies

Pairs well with