# Secondary rail

The list column between the main sidebar and a page's content. Every one is [`SecondaryRail`](https://github.com/Fzkuji/OpenProgram/blob/main/apps/web/components/ui/secondary-rail.tsx); no page styles its own rail rows.

## Parts

| Part | Built from | Notes |
| --- | --- | --- |
| `RailSplit` | CSS grid | Rail column is `--sidebar-width - 1px`, so it lines up with the main sidebar; `--rail-collapsed-w` when collapsed. |
| `SecondaryRail` | `nav` or `aside` | 8px padding, 1px rows gap, right hairline, no background of its own. |
| `RailSearch` | `ui/search-input` | The one search box. Hidden when collapsed. An optional `action` sits beside it. |
| `RailGroupLabel` | `GROUP_LABEL` from `menu-styles.ts` | Same section label as menus. An optional `action` sits at its right end. |
| `RailAction` | `ui/button` `ghost` `icon-xs` | Icon action in a search or label `action` slot (Memory's refresh), with a `HoverTip`. |
| `RailItem` | `.ui-list-item` | The main sidebar's row: 30px, 6px 8px padding, 12px gap, `--nav-color` text. A `description` makes it a two-line row (min 48px, clamped to two lines). `depth` indents a tree level by 16px. `href` renders a `Link`, otherwise a `button`. |
| `RailBadge` | `ui/badge` outline | Small tag after the name ("Default", "Hidden"). |
| `RailCount` | text | Quiet trailing count. |
| `RailSeparator` | `ui/separator` | Above an "Add …" row. |

Top to bottom: search, group labels, rows, separator, a quiet "Add …" row. The page header (`ManagePageHeader`, 64px) spans above rail and content.

## Row states

| State | Style |
| --- | --- |
| Hover, keyboard focus | `--bg-hover` |
| Selected | `--bg-hover` with `--text-bright`; one selected colour for every rail |
| "Add …" row | `quiet`: muted text |

Recipe: [surface system](https://fzkuji.github.io/OpenProgram/docs/reference/design/ui/visual-system/surface-system.html).

### Folder glyph

The main sidebar's Solar `folder` and `folder-open` (duotone, `--folder-color`, one value per light and dark scheme), in the project rail, Memory topics tree, Programs tree and Files panel tree (its Pierre sprite and root path).

| Item | Glyph |
| --- | --- |
| Expanded tree folder, selected project | Open folder |
| Page | Solar `file-text` |
| Missing folder | Solar `danger-triangle` |
| Section row (Memory's Topics, Timeline, …) | The main sidebar's line nav icons |

## Collapse

A rail with a `railKey` collapses to an icon column. `RailToggle` sits in the page header before the title (`ManagePageHeader` `railToggle`), on the row icons' vertical axis.

| Aspect | Rule |
| --- | --- |
| Hidden when collapsed | Search, group labels, text, trailing slots, nested rows |
| Top-level row | 32px square; its name moves to a `HoverTip` |
| Stored | `localStorage["&lt;railKey&gt;NavOpen"]`: `settingsNavOpen`, `projectsNavOpen`, `agentsNavOpen` |
| At or below 760px (phone) | One column: the open rail is the page's section list, full width with 44px rows; choosing a row shows its content, and the toggle, a back chevron there, returns to the list. Opens on the list and stores nothing ([phone layout](https://fzkuji.github.io/OpenProgram/docs/reference/design/ui/phone-layout.html)) |
| Window narrows to 760px | Shows the content without saving; widening never expands |

## Pages

| Page | Rail | Collapsible |
| --- | --- | --- |
| History | Projects (`PROJECTS_RAIL`) | yes, toggle in the History header |
| Agents | Agent list with search, two-line rows, shown with the full editor (the page opens on cards) | yes |
| Settings | Categories (`Link` rows) | yes |
| Abilities → Programs | Catalog tree (`depth`) | no; the Abilities header belongs to all four tabs |
| History → project → Memory | Sections, topics tree (folders, a type badge when it differs from the folder, date), timeline (year › month › day) | no; it sits inside the project page |
| Chat list (stand-alone) | Recency filters with counts | no |

Pages without a list column (Scheduler, Applications, Abilities' Plugins, Skills and MCP) use the page header's tabs and `ManageSubnav`.

## Buttons

| Role | Variant |
| --- | --- |
| The page's main action (New, Add, Install, Open) | `default` |
| Secondary actions (Update, Retry, Memory settings) | `outline` |
| Row icon actions (pause, delete) via `ManageIconButton` | `ghost`, `icon-xs`, with a `HoverTip` |
| Removing something (Uninstall) | `destructive` |

Nova `ui/button` variants only, no per-page overrides. Icon-only buttons name themselves with `aria-label` and show a `HoverTip`, never a native `title`. Page menus are `ui/dropdown-menu` styled with `menu-styles.ts`.

## Guard

`apps/web/scripts/ui/check-secondary-rail.mjs`, run by `npm run check`, fails when a rail page stops using `SecondaryRail`, its stylesheet defines rail rows again, or a collapsible rail and its header toggle use different keys.
