Component conventions
Elevation & shadows
A surface gets a drop shadow only to signal it sits on a layer above what's
directly behind it — the bigger the elevation jump, the bigger the shadow. Flat
(border only) is the default; add a shadow to communicate elevation, never for
decoration. Use the design-system tokens, not ad-hoc shadow-* values. See
ADR 0005 for the rationale.
| Role | Shadow | Examples |
|---|---|---|
| In-flow grouped rows / settings / list card | none (border only) | list-rows Card, detail rows, sections |
| Raised primary content container (on the page background) | shadow-prominent | data-table card, stat / summary / ranking cards, the active card, horizontal scrollers |
| Drawer / sidebar / rail surface | shadow-sidebar | the sliding aside, station rails |
| Floating chrome over content | shadow-floating | FABs, floating action toolbars/pills, banners/toasts, overlay CTAs |
| Modal / dialog / full-screen overlay (over a backdrop) | shadow-2xl | confirm dialogs, full-screen overlays |
Peer consistency is the rule reviewers enforce: all surfaces in the same role
on the same screen get the same treatment. Most inconsistency is a peer mismatch
(a raised card next to a flat sibling), not a missing token. Keep the two in-flow
card tiers distinct: the iOS-settings list-rows Card stays flat; a
primary content container that is a feature's content uses shadow-prominent.
Where components live
- Reusable, presentational components:
packages/ui/src/(@enode/ui) —Button,TagPill,Sheet,SortableList,BottomSheetCard,ChoiceMenu(a value button's choices, anchored under the button on a desktop or tablet, a bottom sheet on a phone),LottieCircle,TagsCard,ConfirmDialog,AvatarUploadField, … These are the components worth a Storybook story. (AvatarUploadFieldis an exception with no story: its real behaviour is the file-pick → canvas crop pipeline, which a static story can't exercise.TagsCard's story covers the row itself — pills, themaxfold, theleadingslot — with literal-named fixtures; its "Add tag" picker opens against the empty module catalogue, since the catalogue is backend-fed. See the exclusions below.) - App-specific feature components: under each app's
src/app/— composed from co-locateduse-*hooks. Mostly tied to live session state, so generally not good Storybook candidates without a mock.
Form parts
A form anywhere in the portal or the tracking app is made of the parts below.
There is one implementation of each; the Live Hub had its own copies
(setting-row.tsx, choice-card.tsx, form-group.tsx under
dashboard/live) until 2026-10-13, and has none now.
| Idea | Part | Where | Story |
|---|---|---|---|
| A group of settings under a label | SettingsGroup | @enode/ui/settings/settings-rows | settings/setting-row.stories.tsx |
| One setting: label, hint, any control | SettingRow | same | same |
| A value that opens its choices | ValueButton | same | same |
| A quiet text control under a group | FORM_LINK (a class) | same | same |
| A switch | Toggle | same | settings/settings-rows.stories.tsx |
| A compact row with its control built in | ToggleRow, NumberRow, SliderRow, LinkRow | same | same |
| One of a few answers, as a card | SelectableCard | @enode/ui/selectable-card | selectable-card.stories.tsx |
| One of a few answers, as a chip | ChoiceChip | @enode/ui/choice-chip | — |
| A labelled input in a drawer's card | FieldRow | apps/portal/src/components/field-row.tsx (portal-only) | — |
| A drawer | DrawerStack + DrawerView, hosted with useDrawerHost | @enode/ui/drawer-stack | — |
Which won, and why
- Setting rows: the Live Hub's
SettingsGroup/SettingRow/ValueButtonwon and moved to@enode/ui/settings/settings-rows.SettingRowtakes any control, a hint, and abelowlayout, and wraps by itself on a phone;ToggleRow/NumberRow/LinkRoweach hard-wire one control and a string label, so they could not have drawn the set-up. The compact rows stay as they are — same file, the same idea at the density of alist-rowsCard— because the account settings, the tag drawer and the tracking app's settings are drawn with them and were not to change here. New forms takeSettingRow; when the settings and users pages are next worked on,ToggleRowandFieldRowshould become aSettingRowwith aToggleor an input in it (SettingRowthen needsFieldRow's required / optional mark). - Choice cards: the portal's
SelectableCardwon, moved to@enode/ui, and took the Live Hub'sChoiceCardin aslayout="row". It had five users, a disabled state and two tones;ChoiceCardhad two users and a layout the other lacked (picture, text and mark on one line). The two layouts still mark the chosen card differently — "stacked" with a grey ring that fills, "row" with the sharedSelectionCircleand a stronger tint — so that neither the Live Hub nor the export, migration and user pages changed by a pixel. Next time one of those pages is worked on, pick one mark for both (theSelectionCircleis the shared one). FormGroupis gone and nothing replaced it. No screen used it any more once the set-up was rebuilt; only itsFORM_LINKclass was alive, and that moved besideSettingRow.FieldRowstays the portal's labelled-input row for the user drawer (see the first point for where it should go).- "Announce lifts" is a
SettingRowwith the sharedToggle, not a pair of Off / On chips. - The Live Hub's athlete drawer stays (
dashboard/live/athlete-drawer.tsx) and is not aSlideOverDrawer. It already stands on the sharedDrawerStack/DrawerViewanduseDrawerHost, like the profile and user drawers, so it is the same shell.SlideOverDraweris a different wrapper of that shell for wide wizards (roster import, migration, export): 1024 px wide, a plain-text title, mounted only while open, and it tells its caller that it closed 320 ms after the press. The athlete drawer is 538 px, has an avatar in its bar, and tells the board at once — it opens over a running board, whose "which row is open" must not lag behind. Wrapping it would mean overriding the width, the header and the closing, and changing how four board views mount it, for no part saved.
LOOK, Eyebrow, Figure, Stat, Panel
@enode/ui/live/look is not a second
design system. It holds recipes over the tokens of design-system.css:
LOOK.panel is rounded-2xl border border-surface-stroke bg-surface-base,
LOOK.eyebrow / Eyebrow is the label in small capitals (stat-small,
uppercase, muted), LOOK.caption is body-small muted, LOOK.name is
heading-normal; Figure and Stat draw a number with its unit, Panel a
container with a title. They add no colour and no size of their own — only
the wall* entries do, for gym displays (wall-type.ts).
They were written for the Live Hub and are general: SettingsGroup and
SelectableCard use them, and any page may. The path keeps live/ in it
because some fifty files import it; treat it as a name, not a fence. Stories:
live/look.stories.tsx. For the plain grouped card of the account settings
(Card, SectionLabel, RowDivider) use @enode/ui/list-rows; LOOK.panel
and Card are the same border, radius and surface.
Page head buttons
A page head (and a drawer head) uses exactly three control types, defined in
header-button.tsx. All three are
40 px tall, so the controls in a head line up:
| Type | Use | Component |
|---|---|---|
| Primary | The head's one main action ("New chart", "Create user") — at most one | <Button variant="primary" size="header"> |
| Secondary | Every other labelled action ("Watch the demo", "Catalogues", "Import ▾", "Present") | <Button variant="secondary" size="header">, or HEADER_PILL for a menu trigger |
| Icon | Back, sidebar, "…", filter, refresh, a phone's short form of an action | <HeaderIconButton>, or HEADER_ICON_BUTTON for a menu trigger |
Secondary and Icon share one chrome (HEADER_CHROME: surface fill, shadow,
surface-stroke-muted ring). Don't use neutral, tertiary or ghost
buttons, a muted-fill circle, or a hand-written chrome string in a head.
The same rule holds in both apps and in every kind of head: a page, a drawer
(DrawerView), a sheet, a bottom sheet and the tracking app's training
screens. Two additions cover the tracking app's heads:
-
Primary icon. A sheet head's ✓ Confirm (next to a ✕ Cancel) is the primary action without a label:
HEADER_PRIMARY_ICON_BUTTON, a filled red 40 px circle. At most one per head. -
Status controls keep their tint, not their own size. The sensor connection pill (
ConnectChip), the live-session button, the voice-station button and the distance-threshold button carry a state colour, but all are 40 px tall. The account avatar in a head is drawn at 40 px (AvatarButton size={40}). -
PageShell's structuredactionstakevariant: "primary" | "secondary" | "destructive"(default"secondary") and render them withsize="header". -
The "How it works" entry is
PageShell'shelpprop, not an action (see walkthroughs.md). -
On phones a head shows Icon buttons only: the labelled actions fold into the "…" menu, or a page keeps one as its Icon form (Exercises' "+", the result's export).
Portal list pages: desktop table + mobile cards
The portal's list pages (Users, Exercises, History) render the same rows twice:
a DataTable from md up and a card list below it
(data-table-view.tsx).
The card list gets the table's abilities from
mobile-list.tsx:
- Sort. The page owns the sort (
sortStateonDataTable) and orders the cards withsortByColumn, so both layouts show one order. The cards offer it throughMobileListToolbar's sort sheet. - Count + paging. Fully loaded lists show "Showing x of y" and render 25
cards at a time (
useShowMore+ShowMoreButton). Server-paged History keeps its pager. - Bulk actions. As in the workout builder's drawer, one floating pill at
the bottom of
<main>swaps its contents:MobileSelectPill("Select") while browsing,MobileSelectionPillin select mode — the desktopTableSelectionBarin itscompactform (the count circle, icon-over-label actions, ✓ apply). As on desktop, the count circle clears the selection; on mobile it also leaves select mode, so there is no separate exit button. In select mode cards draw aSelectMarkand toggle on tap, and "Select all" sits above the list. It takes the sameSelectionActionItems as the desktop pill; export stays desktop-only. The mobile pill needs its own tag picker instance (its own trigger ref), and the list ends with aMOBILE_PILL_SPACERso the last card clears the pill. - Row actions that can't fit a card live where tapping the card leads (the session drawer's Details tab offers the History row actions: change athlete / exercise, inspect profile, delete).
Columns the coach arranges
A table can let the coach show, hide and arrange its columns
(table-columns.ts,
columns-menu.tsx). The page
declares the columns as ColumnOptions, reads the arrangement with
useTableColumns(tableKey, options), passes arrangeColumns(columns, shown)
to DataTable, and puts <ColumnsMenu> — a small icon button — into the
empty header cell above the row actions (on Users: the header of the
actions column). DataTable itself knows nothing about it.
- Default. Every option that is not
defaultHidden, in declared order. A coach who never opens the menu sees the table unchanged. fixedcolumns (the name) are always first and can be neither hidden nor moved.available: falsedrops an option whose data does not exist.- Ready-made views (
viewsonColumnsMenu) set an arrangement with one click. The trigger turns from muted to default ink while the arrangement is not the default. - Storage. Per signed-in user and
tableKey, in localStorage (enode.table-columns.<userID>.<tableKey>); the default is stored as no entry.tableKeyand column keys must stay stable across releases — a key that no longer exists drops out of a stored arrangement, a column added later starts hidden for coaches who already arranged the table. - Groups. An option's
group("Account", "Training", "Body") sections the menu's list of columns that can be added; the shown ones stay one ordered list with drag handles. Each row has an eye switch. - Many columns. A column with
sticky: "left"(the name) and one withsticky: "right"(the row actions) stay in view while the table scrolls sideways. Pinning only exists while the table is wider than its card (data-overflowon the scroll container): a table that fits renders plain cells. A table with pinned columns uses separated borders: every cell draws the row separator itself (TableScroll separate), so pinned and scrolling cells share one line. While pinned, the cells paint the row surface and its hover tint with the row's own transition, and show an edge only while content lies under them (data-under-left/data-under-right); give data columnswhitespace-nowrapso the table scrolls instead of squeezing them. - Sticky header.
stickyHeaderonDataTablemakes the table scroll on both axes inside its card (TableCard bounded,TableScrollwithoverflow-auto), so the header row sticks with plain CSSposition: stickyand the pinned header cells stick both ways above the pinned body cells. The host bounds the height: the Users page uses PageShellfilland flex columns down to the table, so on desktop the table fills the rest of the window and the search and filters stay put. When the rows fit, the card is as tall as its rows. - Scope. Desktop table only; the mobile cards keep their fixed layout.
Only the Users table uses it so far. Its training columns load their figures
only while shown (
users/roster-figures.ts; the server ask is in users-table-backend-handoff.md). - TODO: store the arrangement on the user's settings on the backend, so it follows the coach across devices (no endpoint yet).
Search and filter bars
Every portal list page and searchable drawer filters through one compact bar,
so a coach finds every filter in the same place and the page stays calm. The
parts live in
search-and-filter-card.tsx
and menu-panel.tsx (stories:
UI/SearchAndFilterCard → FilterBarPattern, UI/MenuPanel). A page that
needs fewer controls omits them; nothing else moves.
One row at rest
SearchAndFilterCard, left to right:
- Search field (icon, input, clear ✕).
actions— the date window only:DateRangePicker variant="inline"withpresets(History). Inline triggers useFILTER_TRIGGER: icon first, icon-only belowsm.- "Filters" — the one control for everything else, with the number of applied filters beside it. It opens the Filters menu (next section) on every page with facets or tags; a tag-only page (Workouts, the tracking Library, the user and exercise pickers) gets the same menu with just its Tags section.
There are no permanent facet rows and no inline row labels in the bar.
The Filters menu: the settings-popover vocabulary
The Filters menu and the tables' Columns menu
(columns-menu.tsx) are
built from the same parts in menu-panel.tsx, so every settings popover in
the portal reads the same:
MenuPopover— the white rounded panel (MENU_PANEL, 288 px), portaled under its trigger with the right edges aligned, its height capped to the room below the trigger (long lists scroll inside); closes on a press outside or Escape. On phones the Filters menu shows the same body in aBottomSheetCard, scrolling within 75 % of the screen.MenuPanelHeader+MenuPanelAction— the title row with a red-orange text action: "Reset" in Columns, "Clear" in Filters (shown only while something is applied). Filters makes itsticky, so "Clear" stays in reach.MenuPanelSection— a rule, a small uppercase heading, then rows: one per facet group (filterGroups: roles, tracking source, owner, "Show" for video / not in plan / archived / favourites), then Tags.MenuCheckRow— a full-width row: label, trailing check while on, row tint on hover; a tag row leads with its colour dot.- Tags stay in the menu — no second popover or picker. The Tags section
first lists the page's
suggestedTags(History's most used workout tags) and any other applied tag;MenuExpandRow"Show all tags (n)" expands it in place to every tag intags(those rows first, the rest by name). With nothing suggested or applied the full list shows straight away. Over six tags, the expanded section starts with aMenuSearchFieldthat narrows the rows (MenuEmptyRowwhen nothing matches). The menu remembers neither the expansion nor the search between openings. MenuPanelFootnote— a muted note under a rule (Columns' "Drag to arrange…").
Applied filters
Only while something is applied, a strip under the input lists it, once:
neutral AppliedFilterChips (History's "Athlete: …" tokens via
appliedFilters, and every active facet option), the applied tags as
SelectedTagChips in their tag colours, the "Any tag / All tags" switch with
two or more tags (onTagMatchChange), and one ClearFiltersButton at the end.
onClearFilters lets the page reset everything in one step (History runs one
search); without it the card toggles each active tag and option off.
One chip family
Every chip in the applied strip has the tag-pill size (stat-small,
px-2.5 py-1, 1 px border): SelectedTagChip in the tag's colour,
AppliedFilterChip neutral, each with a trailing ✕.
Counts and empty results
- A count that local filters make necessary sits under the bar as one
body-small text-foreground-mutedline (History's "Showing x of y sessions on this page"). Paged tables show theirs in their pagination. - A search or filter that leaves nothing renders
NoResults(no-results.tsx) in place of the list, with "Clear search" / "Clear filters" and, where the page can find near-matches, "Did you mean" chips.
Kept visible on purpose: navigation, not filters
- Content sources — "Mine / Shared with me / Public" on Tags and the template feed's source chips (Workouts' explore drawer, the planner's template picker, the tracking Library): they pick which feed you browse, appear only when there is more than one source, and Tags defaults to "Mine". They stay a chip row under the card.
- Exercises keeps its visual muscle-map, muscle-group and equipment-icon rows, the whose-figures athlete filter and the usage views between the card and the table — the page's way into the catalogue. Its "Clear filters" is the shared button.
- Planner has no search field: its filter bar sits in the calendar's
chrome, leads with the live count, and adds athletes and tags through
"+ Athletes" / "+ Tags" popovers. Applied tags use
SelectedTagChip, the clear is the shared button. - Profiles (Data → Profiles) sets its timeframe in the sticky
ChartRangeToolbarover the analyses pane: it scopes the charts, not the athlete / exercise lists. - Exports and the Insights builder pick dates in form fields
(
DateRangePicker variant="field",TimeframeField) — a form, not a filter bar. - Popovers (planner athlete filter, Live hub stream filters, chart legend "Find…", add-to-template picker, Insights spotlight) keep a compact search header inside the popover.
Chart text on canvas
Chart.js draws on a <canvas>, which doesn't inherit the page's font or the
app's text scale (--text-scale). In the portal's charts
(chart-setup.ts):
ensureChartsRegisteredsets chart.js's default font family to the page's font (Roobert) and its tooltip title weight to 500. Without it, chart.js falls back to its built-in Helvetica.- Chart options size text with
chartFont(theme, size, weight?), never a barefont: { size }. It applies the page font and the text scale. - Text a plugin draws itself (end labels, bar values) uses
pluginFont(size, weight?)instead of a hard-codedctx.fontfamily. - Sizes and weights come from the type scale in
design-system.css: 9 / 11 / 12 / 14 / 15 / 17 / 22 px, weights 400 / 500 / 600 (Roobert has no 700). The PDF / slide renderer (report-render.ts) follows the same scale and waits fordocument.fonts.readybefore drawing.
Chart colours in Insights
- Grey by default, metric colour for what's highlighted. On Trend, Correlation and Distribution every series is a neutral grey. Only a highlighted series takes colour, in shades of the chart's metric category colour (velocity pink, power purple, …). Highlighted means focused by the coach, named by the answer, or picked on a crowded chart.
- Several highlighted athletes: each athlete gets one shade (the full colour first, then lighter and darker steps), shared by all their series. One athlete with several lifts: all in a slightly lighter tint, the hovered lift (legend row or plot) in the full colour. One series: the full colour (
withMetricShadesinchart-legend.tsx). useMetricHue(metric-hue.ts) resolves the metric.- Correlation uses its vertical (y) metric.
- Until the metric resolves, highlighted series keep
SERIES_PALETTEcolours. - The spotlit athlete stays brand red-orange on every chart.
- Several highlighted athletes: each athlete gets one shade (the full colour first, then lighter and darker steps), shared by all their series. One athlete with several lifts: all in a slightly lighter tint, the hovered lift (legend row or plot) in the full colour. One series: the full colour (
- The kicker's metric name (and its unit) takes the chart's metric colour too (
ChartSubject.topicColor), so the heading names the colour the plot uses. A Correlation's topic names two metrics, so each metric's label is coloured in its own colour (topicTints, found in the translated topic bytintedTopicRuns). Profile has no single metric and keeps the kicker colour. - Correlation dots are two-coloured: a highlighted athlete's dots are split on the diagonal from north-east to south-west: the vertical metric's colour upper-left, the horizontal metric's lower-right, drawn by the
splitDotsplugin incorrelation-chart.tsx; their fit line is neutral grey. - Ranking keeps its own marks: top 3 (and a focused athlete) in the metric's colour, one colour without shades; bottom 2 in
feedback-warningamber; the rest grey. - Better and worse:
feedback-successgreen for better,feedback-warningamber for worse (legend changes, small multiples, "few sets" hints). The trend matrix keeps platinum green for rising andfeedback-errorred for falling.
Storybook
Stories document the reusable @enode/ui layer, co-located with the component as
ComponentName.stories.tsx. Storybook renders them with the real design tokens
(Tailwind v4 + @enode/ui/styles/design-system.css, wired in
docs-site/.storybook).
Currently covered:
packages/ui/src/button.stories.tsx— all variants, sizes, disabled, rounded pill, leading/trailing icon.packages/ui/src/tag-pill.stories.tsx— contrast swap, no-colour fallback, interactive, long-content truncation.packages/ui/src/confirm-dialog.stories.tsx— destructive vs neutral confirm, child item list, busy (buttons locked during an async action).packages/ui/src/settings/setting-row.stories.tsx— a group of settings (value button, switch, a control under its label), a group without a title, a long value that wraps, the quiet text control.packages/ui/src/selectable-card.stories.tsx— both layouts ("stacked", "row" with and without a picture), the neutral tone, disabled.
Adding a story
-
Pick a reusable
@enode/uicomponent with meaningful visual states. Skip provider-only wrappers, route-only pages, and components that need live backend state without a safe mock. -
Create
ComponentName.stories.tsxnext to the component. -
Use Component Story Format with TypeScript:
import type { Meta, StoryObj } from "@storybook/react";import { fn } from "storybook/test";import { MyComponent } from "./my-component";const meta = {title: "UI/MyComponent",component: MyComponent,tags: ["autodocs"],args: { onChange: fn() },} satisfies Meta<typeof MyComponent>;export default meta;type Story = StoryObj<typeof meta>;export const Default: Story = { args: { /* realistic props */ } }; -
For
ReactNode/callback props, setargTypes: { prop: { control: false } }and add dedicated stories — editable controls produce broken values. -
Only document states the component actually supports. Use realistic args, mock callbacks with
fn(), never call real APIs, never invent props. -
Run
npm run storybookto preview,npm run docs:storybookto build.
Sheethas stories for what it does with the keyboard's focus (sheet.stories.tsx).TODO:
BottomSheetCard/SortableListare reusable but need a small amount of mock wiring (portals, drag context). Add stories when those mocks are in place — do not force a story that fakes behavior.The same applies to
NotificationFeed: it subscribes to the module-level notifications store rather than taking items as props, so a story would have to fake the store rather than the component. Its presentational children (NotificationItem/NotificationList/NotificationEmpty) have stories, and its state decision is covered byfeed-phase.test.ts.
Settings & account building blocks
Import paths and exported names:
@enode/ui/settings/nav-row:NavRow,NavRowDivider, typeNavRowProps.@enode/ui/settings/settings-card-group:SettingsPage,SettingsCardGroup,ScopeBand.@enode/ui/settings/save-feedback:useSaveFeedback,SaveErrorLine,SAVED_TOAST_DURATION_MS, typesSaveFeedback,SaveErrorLineProps.@enode/ui/avatar-button:AvatarButton,AvatarButtonProps.
NavRow or the compact rows
NavRowis the settings and account row in the enode screen look: an optional monochrome icon, label (and sublabel), current value, and a chevron — or an arrow-up-right forexternalrows (links or buttons that leave the app). It also covers destructive rows such as "Sign out" and rows with a trailingToggle.ToggleRow,NumberRow,SliderRowstay for compact drawers and existing forms; under the"screen"Settings look they take the screen spacing.- Separate rows with
NavRowDivider, a full-width hairline.
Page column and cards
SettingsPageis thespace-y-6column of a Settings or Account view; the view's frame (SettingsScreenFrame) provides the page background and centred column.SettingsCardGroupis a borderedbg-surface-basecard with an optionalheading-sectionheader, an optional quietfooter(may hold a link), andfindId, which is set asdata-find.
Underline tabs
@enode/ui/underline-tabs:UnderlineTabs, typesUnderlineTab,UnderlineLinkTab,UnderlineTabsLink,UnderlineTabsLinkProps,UnderlineTabsProps.- One tab row for the portal's Account and Settings pages and the tracking app's Settings screen: the active tab underlined in red-orange,
aria-current="page"on it. - Router-agnostic. Link tabs (
hrefper tab) render throughlinkComponent(the portal passes Next'sLink; default a plain<a>), withreplacefor query-parameter tabs. In-memory tabs passonSelectand render as buttons (the tracking app, which has no router). - When the row is wider than its box it scrolls sideways; a fade with a › marks the cut-off side, and the active tab is scrolled into view.
SettingsScreenFrametakes the row as itssubheader: pinned in the solid header under the title.
Scope band
ScopeBandtakesvariant="device"orvariant="everywhere".- It is one quiet line with a glyph. Copy comes from the caller via
t(), for example "Only on this device" with a caption, or "On all your devices" with a caption. - Put a band above any section whose scope differs from the sections around it.
Saving
- Settings save instantly. There is no Save button.
- Call
useSaveFeedback().saved()after a successful save. It shows a brief "Saved" toast, and repeated saves replace the previous toast. - On failure, the caller reverts the control and renders
SaveErrorLineunder the row ("Couldn't save. Try again.").
AvatarButton
- A 44 px round button that opens the Account page, showing a photo or, without one, the profile icon on a gradient (never initials — it stands for the signed-in account; athlete lists use
AthleteAvatar, which keeps initials). It renders an<a>when givenhref, otherwise a button. - The caller passes the
aria-label, for examplet("Account"). - An optional ring can be drawn around it. A smaller
sizeshrinks the circle while the 44 px tap area stays. - Used by the tracking app's
AccountButtonand the portal sidebar avatar.
Portal design consistency: which block for what
One row per need. Use the shared block; do not hand-write the equivalent.
| Need | Use | Source |
|---|---|---|
| Keyboard focus ring | FOCUS_RING (2 px red-orange, :focus-visible only). Already built into Button, the header buttons and SegmentedPicker; add it by hand only to a bare <button> or link | focus-ring.ts |
| Orange text vs. brand accent | text-foreground-red-orange (darker, for text/links) vs text-brand-red-orange (#ff4805, icons/tiles/selected pills/badges) | design-system.css |
| Hand cursor / not-allowed cursor | Nothing: the portal's base layer sets it on every clickable and disabled control | globals.css |
| Button size in a head | size="header" (40 px, level with the round icon buttons) | button.tsx |
| Button size elsewhere | size="rounded" | button.tsx |
| In-flight save | busy on the Button; the label stays, no "Saving…" swap | button.tsx |
| Round head or close button | HeaderIconButton; HEADER_ICON_BUTTON for a menu trigger | header-button.tsx |
| Loading state | Skeleton, SkeletonLines, SkeletonRows; never a plain "Loading…" text. The skeleton matches the final layout | feedback/skeleton.tsx |
| Disclosure body | Collapsible open: children stay mounted, inert while closed, no transition under reduced motion | collapsible.tsx |
| Segmented control | SegmentedPicker: the selected background is one thumb that slides between pills | segmented-picker.tsx |
| Drawer width | DrawerStack width: "default" (538 px), "wide" (720), "extraWide" (960), "full"; no ad-hoc max-w-[…] | drawer-stack.tsx |
| Pushed drawer view with unsaved state | usePopGuard | drawer-stack.tsx |
| Drawer form actions (Save, Assign, Apply) | DrawerFooter, last child of the DrawerView | drawer-footer.tsx |
| Confirm of a picker drawer | FloatingConfirm | floating-confirm.tsx |
| Centred dialog | DialogShell (under ConfirmDialog and every custom dialog); z-index DIALOG_Z_INDEX | dialog-shell.tsx, surface-z-index.tsx |
| Walkthrough with one journey | WalkthroughModal with singleFlow: no overview, no Back | walkthrough.tsx |
| First-run empty table | TableEmptyState with a bare icon and a tone; the primary CTA comes first | feedback/table-empty-state.tsx |
| Search or filters left nothing | NoResults | feedback/no-results.tsx |
| Card surface, eyebrow label | LOOK.panel, LOOK.eyebrow / Eyebrow | live/look.tsx |
| Absolute or relative date and time | formatAbsoluteDateTime, formatRelativeDayDateTime | date-time.ts |
| Unit symbol | Comes from the unit formatter, uppercase (KG, LB); never typed by hand | units.ts |
| A set as "load × reps" | LoadRepsLabel | load-reps-label.tsx |
DataTable columns and rows
- A numeric column sets
align: "end": header and cells right-aligned with tabular figures. - A row with
onRowClickopens with Enter or Space when the row itself has focus. - The header row is 44 px (
h-11). - The header sticks under the page header by default (
stickyPageHeader, defaulttrue). PassstickyPageHeader={false}inside a drawer or a nested scroll box.stickyHeader(defaultfalse) is the variant for a bounded host. - Source:
data-table-view.tsx.
Popover and menu panels
- The panel is
rounded-2xlwithp-1.5; its rows arerounded-xl.
Elevation
- Content surfaces are flat (border only). Shadows follow the table in Elevation & shadows and ADR 0005.
Feedback copy
- One success toast per completed save or delete.
- A one-phrase toast has no trailing period.
- A bulk action states the count.
- Errors go through the error presenter, not a hand-built toast; see error-handling.md.