SessionList

Where you are signed in. Each device signs out on its own row: it dims while it runs, then leaves and the rows below slide up. A failure keeps the row and offers a retry. Auth.

Open playground
  • MacBook Pro

    Lisbon, active now

    This device
  • iPhone 15

    Lisbon, 2 hours ago

  • Windows desktop

    Porto, 3 days ago

  • iPad Air

    Madrid, last week

About

SessionList is a React component in the Auth category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { SessionList } from "@ashutoshswamy/smoui" and set sessions, onRevoke, onRevokeOthers.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { SessionList } from "@ashutoshswamy/smoui";

<SessionList
  sessions={[
    { id: "mac", device: "MacBook Pro", detail: "Lisbon, active now", current: true },
    { id: "phone", device: "iPhone 15", detail: "Lisbon, 2 hours ago" },
  ]}
  onRevoke={(id) => api.revokeSession(id)}
  onRevokeOthers={() => api.revokeOthers()}
/>

Props 3

sessions

Signed-in devices. The current one cannot be signed out from here.

{ id: string; device: string; detail?: string; current?: boolean }[]
onRevoke

Sign one device out. Resolve to remove its row, reject to keep it with a retry.

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

Adds Sign out of all other devices.

() => void | Promise<unknown>