# Session manager

Review active devices and request revocation with explicit current-session protection.

Access: pro. Category: Blocks. Kind: composite.

## When to use

- Use it when a page needs review active devices and request revocation with explicit current-session protection.
- Choose it inside an authenticated product surface when the host application owns routing, persistence, and service calls.

## Alternatives

- Choose empty-state instead when empty collections, search results and errors with a clear next action is the actual interface need, rather than session manager.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Session manager

```sh
npx shadcn@latest add @tidal-pro/session-manager
```

Stylesheets: `components/ui/tidal.css`, `components/ui/session-manager.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/session-manager.css";
import{TidalSessionManager}from"./components/ui/session-manager";
export default()=><div className="tidal-scope"><TidalSessionManager sessions={[{id:"example",device:"value",lastActive:"value"}]} title={"Demo"}/></div>;
```

## Structured props

- `TidalSessionManager.sessions: ReadonlyArray<TidalSessionRecord>`: Required sessions value accepted by this exported component.
- `TidalSessionManager.title: ReactNode`: Required title value accepted by this exported component.
- `TidalSessionManager.confirmation?: ReactNode`: Optional confirmation value accepted by this exported component.
- `TidalSessionManager.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalSessionManager.emptyContent?: ReactNode` (default "No active sessions."): Optional empty content value accepted by this exported component.
- `TidalSessionManager.error?: ReactNode`: Optional error value accepted by this exported component.
- `TidalSessionManager.headingLevel?: "h2" | "h3" | "h4" | "h5" | undefined` (default "h2"): Optional heading level value accepted by this exported component.
- `TidalSessionManager.labels?: Partial<{ sessions: string; current: string; active: string; lastActive: string; location: string; revoke: string; revoking: string; revokeOthers: string; revokingOthers: string; }> | undefined`: Optional labels value accepted by this exported component.
- `TidalSessionManager.loading?: boolean | undefined` (default false): Optional loading value accepted by this exported component.
- `TidalSessionManager.loadingContent?: ReactNode` (default "Loading sessions…"): Optional loading content value accepted by this exported component.
- `TidalSessionManager.onRevokeOthersRequest?: ((event: MouseEvent<HTMLButtonElement>) => void) | undefined`: Callback invoked when the revoke others request interaction is proposed.
- `TidalSessionManager.onRevokeRequest?: ((session: TidalSessionRecord, event: MouseEvent<HTMLButtonElement>) => void) | undefined`: Callback invoked when the revoke request interaction is proposed.
- `TidalSessionManager.otherSessionsButtonProps?: SessionButtonProps | undefined`: Optional other sessions button props value accepted by this exported component.
- `TidalSessionManager.otherSessionsButtonRef?: Ref<HTMLButtonElement> | undefined`: Optional other sessions button ref value accepted by this exported component.
- `TidalSessionManager.pendingSessionId?: string | undefined`: Optional pending session id value accepted by this exported component.
- `TidalSessionManager.revokingOthers?: boolean | undefined` (default false): Optional revoking others value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/session-manager.tsx) | [Manifest](https://tidalui.com/examples/session-manager.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
"use client";

import "./components/ui/tidal.css";

import { useId, useRef, useState } from "react";

import { Laptop, Monitor, Smartphone } from "lucide-react";

import { TidalSessionManager, type TidalSessionRecord } from "./components/ui/session-manager";

import { TidalAlertDialog } from "./components/ui/alert-dialog";

import "./components/ui/alert-dialog.css";

import "./components/ui/session-manager.css";

import "./components/ui/status-badge.css";



const tidalExampleStyles = ".session-manager-demo {\n  display: grid;\n  width: min(100%, 820px);\n  min-width: 0;\n  gap: 13px;\n}\n\n.session-manager-demo-footer {\n  display: flex;\n  min-width: 0;\n  align-items: center;\n  justify-content: space-between;\n  gap: 14px;\n}\n\n.session-manager-demo-footer output {\n  min-width: 0;\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.5;\n  overflow-wrap: anywhere;\n}\n\n.session-manager-demo-footer button {\n  min-width: 44px;\n  min-height: 44px;\n  flex: none;\n  padding: 9px 13px;\n  border: 1px solid var(--t-border);\n  border-radius: 10px;\n  background: var(--t-surface);\n  color: var(--t-ink);\n  font: inherit;\n  font-size: 11px;\n  font-weight: 650;\n  cursor: pointer;\n}\n\n.session-manager-demo-footer button:focus-visible {\n  outline: 2px solid var(--t-ink);\n  outline-offset: 3px;\n}\n\n@media (max-width: 420px) {\n  .session-manager-demo-footer {\n    display: grid;\n  }\n\n  .session-manager-demo-footer button {\n    width: 100%;\n  }\n}";

const INITIAL_SESSIONS: readonly TidalSessionRecord[] = [
  {
    id: "current",
    device: "MacBook Pro · Chrome",
    detail: "This browser",
    location: "Austin, TX",
    lastActive: "Active now",
    dateTime: "2026-10-15T14:32:00-05:00",
    current: true,
    icon: <Laptop aria-hidden="true" />,
  },
  {
    id: "phone",
    device: "iPhone · Safari",
    detail: "iOS 19",
    location: "Austin, TX",
    lastActive: "Today, 8:14 AM",
    dateTime: "2026-10-15T08:14:00-05:00",
    icon: <Smartphone aria-hidden="true" />,
  },
  {
    id: "studio",
    device: "Studio PC · Edge",
    detail: "Windows 12",
    location: "Chicago, IL",
    lastActive: "October 12",
    dateTime: "2026-10-12",
    icon: <Monitor aria-hidden="true" />,
  },
];

type RevokeRequest =
  | { kind: "session"; session: TidalSessionRecord }
  | { kind: "others" };

export function SessionManagerDemo({
  theme = "light",
  dir = "ltr",
}: {
  theme?: "light" | "dark";
  dir?: "ltr" | "rtl";
}) {
  const statusId = `${useId().replace(/:/g, "")}-session-status`;
  const [sessions, setSessions] =
    useState<readonly TidalSessionRecord[]>(INITIAL_SESSIONS);
  const [request, setRequest] = useState<RevokeRequest | null>(null);
  const [status, setStatus] = useState(
    "Fictional local sessions. No account connection is active.",
  );
  const rootRef = useRef<HTMLElement>(null);
  const openerRef = useRef<HTMLButtonElement | null>(null);

  const requestName =
    request?.kind === "session" ? String(request.session.device) : "all others";

  return (
    <div className="session-manager-demo" dir={dir}>
      <TidalSessionManager
        ref={rootRef}
        aria-describedby={statusId}
        title="Active sessions"
        description="Review the devices currently shown for this sample account."
        sessions={sessions}
        onRevokeRequest={(session, event) => {
          openerRef.current = event.currentTarget;
          setRequest({ kind: "session", session });
        }}
        onRevokeOthersRequest={(event) => {
          openerRef.current = event.currentTarget;
          setRequest({ kind: "others" });
        }}
      />
      <TidalAlertDialog
        open={request !== null}
        onOpenChange={(open) => {
          if (!open) setRequest(null);
        }}
        trigger={
          <button type="button" hidden tabIndex={-1}>
            Confirm session request
          </button>
        }
        title={
          request?.kind === "others"
            ? "Revoke other sample sessions?"
            : `Revoke ${requestName}?`
        }
        description="This removes only local sample rows. It does not sign out a device or contact an account service."
        cancelLabel="Cancel"
        confirmLabel="Remove sample session"
        tone="danger"
        theme={theme}
        dir={dir}
        onCancel={() => setRequest(null)}
        onConfirm={() => {
          if (request?.kind === "session") {
            setSessions((current) =>
              current.filter((session) => session.id !== request.session.id),
            );
            setStatus(`${requestName} was removed from this local sample.`);
          } else if (request?.kind === "others") {
            setSessions((current) =>
              current.filter((session) => session.current),
            );
            setStatus("Other sessions were removed from this local sample.");
          }
          setRequest(null);
        }}
        contentProps={{
          onCloseAutoFocus: (event) => {
            event.preventDefault();
            const opener = openerRef.current;
            const nextAction =
              rootRef.current?.querySelector<HTMLButtonElement>(
                "[data-session-action]:not([aria-disabled='true'])",
              );
            const target =
              opener?.isConnected === true &&
              !opener.disabled &&
              opener.getAttribute("aria-disabled") !== "true"
                ? opener
                : (nextAction ?? rootRef.current);
            openerRef.current = null;
            target?.focus({ preventScroll: true });
          },
        }}
      />
      <div className="session-manager-demo-footer">
        <output id={statusId} aria-live="polite">
          {status}
        </output>
        <button
          type="button"
          onClick={() => {
            setSessions(INITIAL_SESSIONS);
            setRequest(null);
            openerRef.current = null;
            setStatus("The fictional session list was reset.");
            rootRef.current?.focus({ preventScroll: true });
          }}
        >
          Reset sample
        </button>
      </div>
    </div>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <SessionManagerDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order.","Arrow-key behavior follows the exported composite-control implementation."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Consumer-owned sessions require unique IDs, device content and exact last-active content; optional detail, location, dateTime, current/disabled state, icon, revoke label and native revoke button props/ref are supported. Controlled pendingSessionId, revokingOthers and loading states keep unavailable actions focusable except native-disabled props. Revoke-one and revoke-other handlers run only after caller-first unprevented native clicks; current sessions never expose revoke. A synchronous accepted action that removes its focused control restores focus to an available session action, the other-sessions action or the programmatically focusable root without scrolling. Optional confirmation/error/loading/empty slots, root native section props/ref, h2-h5 hierarchy and labels are supported. Consumers own confirmation, authorization, real sign-out, authentication, account state, requests and persistence. The component performs no network or session mutation.
