Session List

Active sign-ins, with the current one pinned and unrevokable from here. Signing yourself out of the session you are using is a footgun, so it is simply not offered.

src/components/ui/session-list.tsx

About

From the component's own source, where it was written.

Active sessions, revocable.

The current session is marked and cannot be revoked from this list — revoking it logs you out mid-action, which reads as a crash rather than a choice. "Sign out everywhere else" is the safe form of that intent and is offered separately.

Location is labelled as approximate. It comes from IP geolocation, which is routinely a different city and sometimes a different country; presenting it as fact makes people hunt for a breach that is actually a VPN endpoint.

Install

npx astralyx-ui add session-list

Usage

import { SessionList } from '@/components/ui/session-list'

<SessionList sessions={sessions} onRevoke={revoke} onRevokeOthers={revokeAll} />

Composer

Change the props and the source below follows.

Active sessions4
  • Chrome 141on macOS 27This device

    London, UK (approx.)81.2.69.142active

  • Safarion iOS 27

    London, UK (approx.)81.2.69.142active

  • Firefox 139on Windows 11Unusual

    Frankfurt, DE (approx.)45.83.220.11active

  • Chrome 138on Android 16

    Manchester, UK (approx.)92.40.11.7active

Props
tsx
<SessionList sessions={sessions} onRevoke={revoke} onRevokeOthers={revokeAll} />

Examples

One session flagged as suspicious

Only this device

API

Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.

SessionList

Extends ComponentProps<'div'>.

PropTypeDefaultDescription
titlestring'Active sessions'—
sessionsSession[]required{ id, device, browser?, os?, ip?, location?, lastActive?, current?, suspicious? }.
onRevoke(id: string) => void——
onRevokeOthers() => void—The "sign out everywhere" action. This is what someone reaching this screen after a scare actually wants.
nowDate——
localestring'en-GB'—
currentLabelReactNode'This device'—
suspiciousLabelReactNode'Unusual'—
unknownBrowserLabelReactNode'Unknown browser'Stand-in when a session reports no browser.
onLabelReactNode'on'Joins browser and OS — "Chrome 141 on macOS".
approxLabelReactNode'(approx.)'Qualifies the IP-derived location.
activeLabelReactNode'active'Precedes the last-active time.
signOutLabelReactNode'Sign out'—
signOutOthersLabel(count: number) => ReactNodeDEFAULT_SIGN_OUT_OTHERS_LABELTakes the count, so the plural is yours to form.
confirmNoteReactNode'This device will need to sign in again.'—
confirmLabelReactNode'Sign out'—
cancelLabelReactNode'Cancel'—

Types

Session

Active sessions, revocable.

FieldTypeDescription
idstring—
device'desktop' | 'mobile' | 'tablet' | 'unknown'—
browser?ReactNode—
os?ReactNode—
ip?string—
location?ReactNodeLabelled as approximate. IP geolocation is routinely a hundred miles out, and presenting it as fact leads people to dismiss a real intrusion.
lastActive?Date—
createdAt?Date—
current?booleanPins the session to the top and hides its revoke control.
suspicious?booleanYour judgement, not the component's — it renders the marker, it does not decide what is suspicious.