# ActivityRail

Use the rail for a short list of peer destinations. Give the navigation landmark an `aria-label`, supply a stable `id`, `label` and decorative `icon` per item, and set `selectedId` when navigation completes.

```tsx
import { useState } from 'react'
import '@ancrel/tokens/css'
import '@ancrel/workspace/styles.css'
import { ActivityRail } from '@ancrel/workspace'

export default function App() {
  const [page, setPage] = useState('overview')
  return <ActivityRail aria-label="Project pages" selectedId={page} onSelect={setPage}
    items={[
      { id: 'overview', label: 'Overview', icon: '▦' },
      { id: 'updates', label: 'Updates', icon: '◷', badge: 121 },
      { id: 'saved', label: 'Saved', icon: '☆', badge: 'dot' },
    ]} />
}
```

Expected:

Tab enters on Overview. Arrow Down focuses Updates. Its badge displays 99+ and its accessible name includes 121. Enter selects Updates. Saved has a dot and announces “Saved (new)”.

Tab enters the item list once. Up and Down wrap through enabled destinations. Home and End jump to either end. Enter or Space activates the focused destination. The current page carries `aria-current="page"`; moving focus alone preserves selection. The footer accepts independently focusable controls.

An item with `href` renders a link. For a router, pass `renderLink` and forward its props, including children and keyboard handler, to the focusable link. Setting `showLabels={false}` hides the visible labels while preserving accessible names. A numeric badge displays at most 99+ and announces the exact count. A dot adds “new” to the name. Return the complete localized name from `formatBadgeLabel`.

The width comes from `--ac-comp-rail-width`. Labels use `--ac-sys-type-meta-size`. Import `@ancrel/tokens/css` and `@ancrel/workspace/styles.css` in the application entry point.

| `Context` | `--ac-comp-rail-width` |
| - | - |
| `dark/compact` | `4.375rem` |
| `dark/comfortable` | `4.375rem` |
| `light/compact` | `4.375rem` |
| `light/comfortable` | `4.375rem` |

| `Context` | `--ac-sys-type-meta-size` |
| - | - |
| `dark/compact` | `0.6875rem` |
| `dark/comfortable` | `0.6875rem` |
| `light/compact` | `0.6875rem` |
| `light/comfortable` | `0.6875rem` |

| `Prop` | `Type` | `Required` | `Default` |
| - | - | - | - |
| `aria-label` | `string` | `true` | `—` |
| `footer` | `ReactNode` | `false` | `—` |
| `formatBadgeLabel` | `((item: ActivityRailItem) => string) \| undefined` | `false` | `—` |
| `items` | `readonly ActivityRailItem[]` | `true` | `—` |
| `key` | `React.Key \| null \| undefined` | `false` | `—` |
| `onSelect` | `((id: string, event: React.MouseEvent \| React.KeyboardEvent) => void) \| undefined` | `false` | `—` |
| `ref` | `React.Ref<HTMLElement> \| undefined` | `false` | `—` |
| `renderLink` | `((props: { href: string; className: string; children: React.ReactNode; "aria-current"?: "page"; tabIndex: number; onKeyDown: React.KeyboardEventHandler; }) => React.ReactElement) \| undefined` | `false` | `—` |
| `selectedId` | `string \| null` | `false` | `—` |
| `showLabels` | `boolean` | `false` | `—` |

```ts
import * as React from 'react';
import type { ActivityRailProps } from './types.js';
export declare const ActivityRail: React.ForwardRefExoticComponent<ActivityRailProps & React.RefAttributes<HTMLElement>>;
```

* default — dark/compact, dark/comfortable, light/compact, light/comfortable
* hover — dark/compact, dark/comfortable, light/compact, light/comfortable
* focus-visible — dark/compact, dark/comfortable, light/compact, light/comfortable
* disabled — dark/compact, dark/comfortable, light/compact, light/comfortable
