4.2.0
Patterns

WorkspaceNav

The rail a product declares rather than assembles — hand it sections and items and it draws the whole navigation, switcher and slots included.

Default

The rail as most products use it: a brand slot, one labelled section, the row the reader is on and a count on a live one. Reach for it when the navigation is DATA — you hand it sections and items and it renders the whole rail, which is the trade `Sidebar` asks you not to make. It has no width and no edge of its own: the box around it here is what a product's `AppShell` is.

Usage

import { WorkspaceNav } from '@oceanic-hub/brand-system'

The trade is data instead of composition, and it is worth naming before you take it. You declare the sections; the rail draws the switcher, the headings, the rows, the selection and the footer. That is right for most products most of the time — five to twenty destinations that change when somebody edits an array. It stops being right the moment the rail needs a shape the array cannot hold: a per-item action, a nested submenu, a group with its own button, an icon-only mode the reader operates. None of those is an extension of this model, and bending it toward them rebuilds Sidebar badly. Switch to Sidebar instead — it ships in this package, composed part by part, and it brings its own frame.

It is a rail, not a frame, and since @OCE-1878 it behaves like one. There is no main column here: AppShell is the two-column geometry this sits in, and the two compose with nothing to pass between them. The frame owns the rail's width and the rule down its edge; this fills what it is given and draws content. It used to pin w-[248px] and a border-r of its own inside a w-64 aside that had both, which put two hairlines eight pixels apart down the side of every screen in the product, and the fix was advice — className="w-full border-r-0" — on every demo and on the archetype. That advice is now wrong: pass it and you get an aside with no rule at all. Standalone, give it a container with a width, the way the demos below do.

Navigation is the host's, in both directions. active is a prop rather than something the rail computes: it has never heard of your router, so exactly one item carries it and your route matching decides which. And an item navigates through a Radix Slot, which is how a package that imports no framework still hands you a real link — pass href and the host's own link component slots in, keeping the middle-click, the open-in-new-tab and the status bar that an onSelect handler silently loses. An item given both is a link, and its onSelect never fires.

disabled is for a surface that exists in the plan and not yet in the product — an inert row that never navigates and never fires, so a rail can advertise without lying about it. It is not, however, the only row that can carry a badge: the badge draws on ANY item since @OCE-1878, and on the selected one it sits beside the check rather than instead of it. It used to render on a disabled row alone, so a count on a live row drew nothing and nothing warned you — if you find that limitation written somewhere, it is out of date. One softness that remains: the switcher's avatar is initials on a flat brand plate, a placeholder for per-workspace colour rather than a decision about it.

onSwitch gates the affordance, not just the behaviour. The switcher block used to draw its chevron unconditionally while the handler was optional, so a rail given a client and no onSwitch shipped a focusable, hover-highlighting control that did nothing when pressed — which is what a product got the day its project switcher was retired and the handler stopped being passed. Pass the handler and you get a button with a chevron; omit it and the block is an identity plate: a div, no chevron, no hover, out of the tab order. There is deliberately no way to ask for the chevron separately, because a prop that can contradict the handler is the same bug wearing a nicer shape. The ground, border, padding and layout are identical either way, so the rail does not reflow when a host starts or stops passing it.

headerActions is the one zone that is DATA rather than a slot, and the asymmetry is the decision. brand, context and footer hold whatever you give them because their contents are yours — a mark, an environment picker, a meter. A header affordance row is not: it is equal-width icon buttons with one corner, one badge placement and one rest/hover/active/ disabled ladder, and all four of those are this package's answer rather than your product's. Given a slot, every consumer re-derives them and they drift, which is the argument that made sections data in the first place. So you declare the affordances and the rail draws the row. Two consequences worth knowing before you fill it: label is required because the row is icon-only, so it is the button's only accessible name — and the badge is optional because an affordance whose count is unknown should draw its glyph alone. A rail that invents a number to have something to show is worse than one that shows nothing.

That plate is an Avatar with shape='square' now, not a hand-drawn span. It was the last entity chip in the package written as its own class list — and it was also the one that looked right, which is how it became the reference the shared AvatarFallback was corrected against.

Upstream has no counterpart. shadcn documents a rail SYSTEM — Sidebar, which this package ships under that name — and a horizontal NavigationMenu for links across the top of a site. Neither is a rail you declare. A reader arriving from either page wants Sidebar if the rail has state, and this if it does not.

Workspace switcher

Pass client and project and the rail grows a switcher above the sections, with an Avatar monogram on a square plate — square because a client or a project is an organization. onSwitch is the whole of its behaviour AND its affordance gate: the rail opens nothing itself, so the picker is yours, and without a handler the block is an identity plate instead (see below).

Slots

Three zones the rail deliberately draws nothing in: brand at the top, context under the switcher, and footer pinned to the bottom whatever the sections do. Your mark, your environment picker, your SpendBar — the rail owns the rhythm and none of the contents.

Spend612 / 1,000

61% used · This month

The selected item

active paints the row brand-soft with a brand label, adds a check and sets aria-current="page". Selection is deliberately a different colour from hover, so the row you are ON and the row under your pointer can never be confused; exactly one item carries it.

An item with href renders through a Radix Slot, so a host can hand it a router link and keep middle-click, open-in-new-tab and the browser's status bar; without one it is a button driven by onSelect. Give an item both and the link wins, so pick one per item.

Roadmap items

disabled renders an inert row — it never navigates and never fires onSelect — so a rail can advertise a surface that does not exist yet without lying about it. badge is where the "Soon" goes; it is the same badge a live row carries, and nothing about the row is special.

Badges

badge is a short trailing string on ANY item — a count on a live row, a "Soon" on a roadmap one. It stays quiet in every case: subordinated type, never the row's colour. On the selected row it sits beside the check rather than instead of it, because a count and a selection say different things and a row is entitled to say both.

What is inside the navigation landmark, and what is not

footer renders in a <footer> OUTSIDE the <nav>. Its documented use is an ambient, asynchronous meter, which is not navigation — and inside the landmark it made every navigation-scoped assertion depend on it. The failure mode is why this matters: a count-of-links assertion passes on its first poll while the footer is still a skeleton, then starts failing months later when the footer reports honestly at first paint and contributes a link. The visual result is identical; only the outline moved. Sections also announce as role="group" named by their heading, so a label has a programmatic relationship to the items under it, and every item emits data-nav-item with the id the type already requires.

Spend318 / 400

80% used · this week

A switcher that cannot switch

Omit onSwitch and the block stops pretending. It becomes an identity plate — a div, no chevron, no hover, not in the tab order — because the chevron is a promise about what pressing will do and there is no handler to keep it. Compare with the switcher above: same ground, same border, same padding, so a rail does not reflow when a host starts or stops passing the handler.

Header affordances

headerActions is the row of icon affordances a rail header carries — a command menu, an agenda, an alert bell — and it is DATA for the same reason sections is: the equal widths, the corner, the badge's placement and the four states are the design system's answer, so a slot would hand all four back to you. Every button here is disabled and none carries a badge, which is the honest first frame: the row exists before the counts do, and a placeholder count is worse than no count. Pass shortcut for a keyboard hint, badge only once the number is real, and active on the surface the reader is already looking at.

API Reference

See the WorkspaceNav API page for every prop of every part, with types, defaults and the contract that pins them.

On this page