Workspace Rail

The narrow strip of workspaces and places at a chat app's edge, and the same places as a phone's tab bar.

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/workspace-rail

Usage

import { TabBar, WorkspaceRail } from "./ui/uicontext/components/kit/WorkspaceRail.ts"
const places = [	{ id: "home", label: "Home", href: "/", icon: "home" as const },	{ id: "dms", label: "DMs", href: "/dms", icon: "dms" as const, count: 3 },	{ id: "activity", label: "Activity", href: "/activity", icon: "activity" as const, unread: true },]// the rail on a wide screen, the same places as tabs on a phoneexport const AppRail = <M>(h: Html.H<M>, current: string) => [	WorkspaceRail(h, { label: "Northwind Labs", places, current }),	TabBar(h, { label: "Sections", places, current }),]

Examples

Phone tabs

API reference

WorkspaceRailView function

Options

WorkspaceRail options
NameTypeDescription
labelrequiredstringThe rail's accessible name
workspacesRailWorkspace[]—
workspacestringThe workspace you're in
placesrequiredRailPlace[]—
currentstringThe place you're in
footerView.InputUnder the places: the reader's avatar, a create button

TabBarView function

Options

TabBar options
NameTypeDescription
labelrequiredstring—
placesrequiredRailPlace[]—
currentstring—

Accessibility

  • The rail and the tab bar are navigation landmarks of links; the current place has aria-current.
  • A count or a dot is read with the place's name: “DMs, 3 new”, “Activity, unread”.

Source