Skip to content
caliper ui docs

Pro

Session timeout

A fair warning before a session ends: a dialog counts down with a ring, offers to stay signed in, and signs out at zero.

Pro
pnpm dlx shadcn@latest add @caliper/session-timeout

Idle sign-out

Shared computers sign out after 15 minutes without activity

Lena FischerSigned in since 09:12.
Installs components/ui/session-timeout.tsxDepends on @radix-ui/react-dialog, @radix-ui/react-slot, lucide-reactMotion shared motion tokens

When to use

Use it for

  • Banking, health and admin tools with short sessions.
  • Shared computers.

Skip it when

  • Consumer apps that keep people signed in.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/session-timeout

Adds its 5 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage

Import it from your copy of the source. The example behind the preview comes with the source.

example.tsx
import { SessionTimeout } from "@/components/ui/session-timeout"

The worked example comes with Pro

The 51-line example behind the preview opens here, ready to copy.

  • 626 Pro parts, blocks and page templates, all with source
  • $149 once, with lifetime updates. No renewal
  • A full refund within 14 days if it is not for you
Checking your licence…

API reference

SessionTimeout

component
PropTypeDefaultDescription
expiresAt *number—When the session ends, in milliseconds since 1970 (Date.now() style).
warnBeforenumber60Seconds before the end to show the warning.
onExtend *() => void | Promise<void>—Extends the session; may return a promise.
onSignOut *() => void—

Accessibility

It exposes alertdialog semantics, with aria-hidden and aria-live kept in step with state. Changes that matter are announced through a live region.

Keyboard and focus handling comes from Radix dialog: arrow keys move through items, Enter and Space select, and Escape closes and returns focus.

Motion

Transitions use the shared duration and easing tokens. Under prefers-reduced-motion those tokens collapse to instant and travel distances go to zero, so state changes still happen without movement.

All Changing values examples