@softure-ai/theme-notion
v0.42.0
Published
SOFTURE AI Notion theme: shadcn/ui components (new-york v4, Radix, Tailwind CSS v4, lucide) with the Notion design system's tokens and deltas, ready to import.
Readme
@softure-ai/theme-notion
The Notion design system as a package: shadcn/ui (style new-york v4, Radix primitives, Tailwind CSS v4,
lucide-react icons) with Notion's tokens and the system's component deltas. The look: lots of white, warm graphite
instead of black, grey highlights instead of borders, colour only where it carries meaning. Built on
@softure-ai/theme-kit.
Install and wire up (Next.js App Router)
npm i @softure-ai/theme-notion tailwindcss @tailwindcss/postcss/* app/globals.css */
@import "tailwindcss";
@import "@softure-ai/theme-notion/theme.css"; /* tokens, utilities, dark:, animations, the components' classes */
@import "@softure-ai/theme-notion/sft-bridge.css"; /* optional: @softure-ai/ui components and package pages */
@import "@softure-ai/theme-notion/base.css"; /* body on the theme's background, text colour and font */
@import "@softure-ai/theme-notion/page.css"; /* body text 14 px, blue text selection, font smoothing */
@import "@softure-ai/theme-notion/maplibre.css"; /* only if the app shows MapLibre maps */Every stylesheet comes from the theme. base.css, maplibre.css and preflight.css are the kit's
(@softure-ai/theme-kit), re-exported by the theme: they resolve the kit from the theme's own
dependency, so the app declares only the theme and gets the kit version the theme was built against, in any package
manager layout.
theme.css names the package's components as Tailwind sources, so their classes are generated without the app
listing node_modules. It clears Tailwind's default palette: only the theme's colours exist as utilities.
@softure-ai/ui components on the theme. sft-bridge.css points ui's --sft-* tokens (colours, fonts, radii,
shadows) at the Notion tokens on every scheme scope (:root, .light, .dark, [data-theme]) and in every
PageFrame, outside any @layer, so a ui component takes the theme wherever it sits: a chat panel in the app shell,
a card in a .dark band, or a package page (sign-in, OAuth consent) in a PageFrame. Spacing, text sizes and
durations stay ui's. An app that wants another value for one token writes its own --sft-* rule after the import.
An app that also renders pages of the SOFTURE packages (on @softure-ai/ui's --sft-* tokens) keeps their base by
taking the scoped preflight instead of Tailwind's:
@import "@softure-ai/ui/styles.css"; /* first: it declares the layer order */
@layer theme, base, components, utilities;
@import "tailwindcss/theme.css" layer(theme);
@import "@softure-ai/theme-notion/preflight.css"; /* Tailwind's preflight, only inside [data-slot] elements */
@import "tailwindcss/utilities.css" layer(utilities);
@import "@softure-ai/theme-notion/theme.css";
@import "@softure-ai/theme-notion/sft-bridge.css";
@import "@softure-ai/theme-notion/base.css"; /* nothing else styles body under the scoped preflight */
@import "@softure-ai/theme-notion/page.css";
@import "@softure-ai/theme-notion/maplibre.css"; /* only if the app shows MapLibre maps */base.css gives body the theme's background, text colour and sans font without the browser's 8 px margin, so a
page without a shell root, the dark scheme and the Radix portals mounted on body (select lists, menus, sheets) all
take the theme. It also gives every border without a colour class the theme's border grey and outlines a
half-transparent ring (shadcn/ui's globals.css rule), so table rows, accordion items, alerts and sheets do not
draw in the text colour. maplibre.css puts the theme's sans font on MapLibre maps (markers, popups, the attribution), which
maplibre-gl.css sets to Helvetica. page.css carries the rest of the design system's base layer: text outside the
components at the panel size (text-sm, 14 px, instead of the browser's 16 px), selected text on blue-tag, and
-webkit-font-smoothing: antialiased on html. All three read the theme with --theme() or its tokens, so they go through the app's Tailwind
after theme.css; the app's globals.css keeps only @import lines.
import { Button, Badge, Status, PageHeader, TooltipProvider, Toaster } from "@softure-ai/theme-notion";
import { CircleCheck } from "lucide-react";
<TooltipProvider>
<PageHeader title="Projects" crumbs={[{ label: "Workspace", href: "/" }, { label: "Projects" }]} />
<Badge variant="tag" color="blue">Marketing</Badge>
<Status color="green" icon={CircleCheck}>Done</Status>
<Button>Save</Button>
</TooltipProvider>
<Toaster />Dark scheme. Light by default, dark by the system setting; class="dark" (next-themes with
attribute="class") or data-theme="dark" (@softure-ai/ui's ThemeScript and ThemeSwitch) choose it, and
light the other way. Toaster follows the system unless it gets theme="light" | "dark".
Copy. The components' built-in texts are accessible names in English (notionMessages.en). Pass the app's own
wording by props: Breadcrumb aria-label, BreadcrumbEllipsis label, PageHeader crumbsLabel,
DialogContent closeLabel, DialogFooter closeLabel (the showCloseButton button's text), SheetContent closeLabel, SidePanel closeLabel, AsidePanelToggle showLabel hideLabel,
AsidePanel widenLabel narrowLabel closeLabel, AsidePanelSidebarOpener label, Steps stateLabels, CopyButton label copiedLabel, HelpTooltip label, TableSortHead label,
TableViewSettings label messages, DatePicker messages, DateTimePicker messages,
Sidebar mobileTitle mobileDescription, SidebarTrigger label, SidebarRail label, Spinner aria-label,
CommandDialog title description (title also names its search field), Command label (the search field's
name outside a CommandDialog; without it the field has none), SortableList instructions announcements, SortableHandle label.
Rules, in short
Background
background, textforeground, secondary textmuted-foreground. Never pure black.Hover is the grey
accentbackground, never a border or a shadow; selected and pressed useaccent-strong.One
primary(blue,#0171cf) action per screen. Other buttons aresecondary,outlineorghost; a button over a map or an image isfloating.A palette colour (
gray,brown,orange,yellow,green,blue,purple,pink,red, each with-bg,-tag,-tag-foreground) marks an area (a tag) or a state (a status, a callout), never decoration. The same colour always means the same thing; the app keeps its own table of meanings.Borders are quiet. Form fields have the grey
fieldbackground and a thininputborder; focus is the bluering. Things that float use shadows, not borders:shadow-menu,shadow-dialog,shadow-card.Type: system sans, mono for identifiers.
text-page-title40/48 bold once per screen,text-heading-1..330/24/20,text-body16/24,text-ui14/20 (panels),text-small12/16,text-section-label12/16 medium.Spacing on a 4 px grid (
p-1= 4 px). Sizes:sidebar-width240,content-width708,content-width-wide1152,control-height28,row-height34,touch-target44 (rows and controls meant to be tapped on a phone, e.g.min-h-touch-target md:min-h-row-height). Radius:rounded-xs3 (tag, checkbox),sm4 (tooltip, kbd),md6 (button, field, menu item),lg8 (callout, card),xl10 (menu, select, dialog),full(switch).Icons: lucide at
ICON_STROKE_WIDTH(1.75), 16 px in text; they inherit the text colour. No emoji in the interface.Statuses always carry a word and an icon, so states read apart without telling green from red.
A badge never leaves its container (
max-w-full). In a narrow one (a grid card, a table cell) aStatusword that does not fit ends in an ellipsis while the icon keeps its size, and the full word is the badge'stitlewhen it is a string or a number (passtitlefor any other node). A plainBadgeclips its text at the end; wrap the text in<span className="min-w-0 truncate">for an ellipsis.A badge names its colour and variant in attributes, so a browser test checks them without parsing classes: a
Badgewith a palettecolorrendersdata-color="<color>"next todata-variant(none forcolor="none"), and aStatusrendersdata-colorthe same way ([data-slot=badge][data-color=red]).Installed on a phone's home screen (
viewport-fit=cover), the parts at a screen edge pad by the screen's safe-area insets on the edges they touch:SheetContent(everyside, its close button too), theSidebaron a phone, the popperSelectContent(its height stops short of the inset it opens towards) andPageFrame. The insets are 0 on a desktop and in a browser with its own bars. Padding passed toSheetContentreplaces the inset on that edge, so put content padding on its children (SheetHeader,SheetFooter, an innerdiv). An app pads its own screen roots with the same classes:pt-[env(safe-area-inset-top)],pb-[env(safe-area-inset-bottom)],pl-[env(safe-area-inset-left)],pr-[env(safe-area-inset-right)].DialogContentandSheetContentfocus their first form field on open (input,select,textareaor acombobox, not disabled), not the first focusable element, so a helpTooltipTriggerbeside a label does not open its tooltip over the form. With no field Radix's default focus stays; an app'sonOpenAutoFocusruns first and keeps control when it callsevent.preventDefault(). Tab onto the trigger still shows the tooltip.Figures, bar segments and box edges take a tone by what they mean:
default(text colour),success(green, done),warning(orange, to do),danger(red, owed or failing),muted(gray, out of play).TONE_COLORSgives a tone's palette colour (nullfordefault);TONE_TEXT,TONE_FILLandTONE_EDGEgive literal class names (text-*,bg-*,border-l-*) that the shippedtheme.cssalready generates, so the app adds no@source. The app keeps only its meaning-to-tone table:import { TONE_TEXT, type Tone } from "@softure-ai/theme-notion"; const PAYMENT_TONE: Record<"paid" | "due" | "overdue", Tone> = { paid: "success", due: "warning", overdue: "danger" }; <span className={TONE_TEXT[PAYMENT_TONE.overdue]}>1 200</span>
Components
All 37 shadcn/ui components of the design system, exported from the package root: accordion, alert, alert-dialog,
avatar, badge, breadcrumb, button, button-group, card, checkbox, collapsible, command, dialog, dropdown-menu, empty,
field, input, input-group, item, kbd, label, popover, progress, radio-group, scroll-area, select, separator, sheet,
sidebar, skeleton, sonner (Toaster), spinner, switch, table, tabs, textarea, tooltip. Compositions: Status (badge, icon,
word), ResultBadge (a result as a filled tag in its tone's colour, with an icon and a word, below), PageHeader (breadcrumb, icon box, title, description, actions), PageLayout (a screen in the app shell: its
PageHeader, then its sections, at one width and spacing, below), PropertyList (fields of one record),
DetailTable (an item's details as a label and value table, laid out fixed at its container's width, each label
above its value where the table is narrower than 28rem), FoldRow (a list row folding open to a DetailTable
and more, a native <details>), PageFrame (a page outside the app shell, such as a package's sign-in page),
SidePanel (a non-modal panel at a side of a canvas, below), ResizeHandle (a drag handle that sets a column's width, below), AsidePanelProvider, AsidePanelToggle,
AsidePanel and AsidePanelSidebarOpener (a panel slid in from the right of the app shell, beside the content, below), SheetMenu, SheetMenuItem and SheetMenuButton
(navigation rows in a side Sheet, a phone's drawer, below), TabBar (a screen's tabs as links with an optional icon
and count, the shown tab in the address; Tabs keeps it in client state), MarkPopover (a counted tag that opens a
list of what it counts, below), FilterChip and FilterChipAdd (a list's filter pills, below), Steps (numbered
stages with a state, below), Timeline (dated entries on a vertical rail, below), Code (inline code) and CodeBlock (a mono block for logs and paths, below),
CopyButton (one value to the clipboard, with a moment of "Copied", below),
HelpTooltip (a field's "?" hint that opens on hover, focus, click and tap, below),
TableSortHead with sortRows and nextSortDirection (a table column header that sorts its column, with
aria-sort and a direction chevron, below),
TableViewSettings (a table's columns shown, hidden and reordered from a Notion-style "Properties" menu, with
applyColumnVisibility and useTableColumns, below),
DatePicker and DateTimePicker (a day, or a local date and time, picked from the theme's calendar, below),
Prose (the text styles of a long read the app does not draw itself, such as Markdown rendered to HTML, below),
SortableList, SortableItem, SortableHandle and SortableActivator (rows reordered by dragging, below),
List, ListItem and ListRow (a list of rows, compact or roomy by the page's density, below),
ListEntry (a list row with an identity and a right column, its state over its controls, below),
RowActionsMenu (a row's other actions behind a "More actions" button, the destructive one last and confirmed, below),
ListGroup and ListGroupHeading (a run of rows under a heading that sticks at the top of its scroll, below),
MiniProgress (a compact bar with its figure inside, for a table cell or a tile, below),
UpdatePrompt (the offer to reload into a new build, for an installed app, below),
InstallBar (the offer to install the app on a phone, below),
LaunchScreen (an installed app's icon, name and progress while its first page loads, below),
TopLoadingBar (a thin bar at the top while a route loads on a wide screen, below),
RouteLoading (the launch screen or the top bar, picked by the browser, below),
UploadField, UploadList and UploadItem (pick or drop files, one row per file with progress, retry and remove,
below),
FileInput (a compact file picker for a form row: a button and the chosen file's name, below),
DocumentViewer, DocumentList and DocumentRow (a PDF's pages or an image shown inside the page, with page count
and zoom; one row per document with its type, size and an "available offline" mark, below),
FormGrid (fields side by side whose label, control and hint line up across columns, below).
Touch sizes. The controls a phone view taps most reach the touch-target token (44 px, Apple's HIG and WCAG
2.5.5): Button sizes touch (44 px high, padded like lg) and icon-touch (44 × 44), SelectTrigger
size="touch", and SelectItem at least 44 px high, for a whole list (SelectContent size="touch") or one item
(SelectItem size="touch"; an item's own size wins over its list's). The same rule holds for the dropdown menu
(DropdownMenuContent size="touch", or size="touch" on a DropdownMenuItem, DropdownMenuCheckboxItem,
DropdownMenuRadioItem or DropdownMenuSubTrigger) and the tabs (TabsList size="touch" grows to its triggers,
each at least 44 × 44, or TabsTrigger size="touch"). TabBar size="touch" draws every tab link at least 44 × 44 (data-size="touch"), and its
tabClassName goes on every link after the size (tabClassName="md:h-control-height md:min-w-0" on a desktop). When its tabs overflow the strip (a phone), TabBar scrolls the strip itself, never the page, so the current tab is
whole on load and whenever current changes, and fades each edge that hides tabs (data-overflow-start,
data-overflow-end on the nav, a static 32 px mask, so nothing moves under reduced motion). Switch size="touch" is a 44 × 44 square that draws the same 26 × 16 track
inside it and keeps the track's place in the layout (negative margins), so a phone taps the whole square; className="md:m-0
md:h-4 md:w-[26px]" brings the plain switch back on a desktop. AccordionTrigger size="touch" is at least 44 px high
whatever its padding, and DialogContent closeButtonSize="touch" draws the close button 44 × 44 around the same
icon. Each sets its height with a plain class, so one breakpoint class brings the pointer size back on a desktop.
<Button size="touch" className="md:h-7 md:px-2.5">Save</Button>
<Button size="icon-touch" aria-label="Add" className="md:size-7"><Plus /></Button>
<Select>
<SelectTrigger size="touch" className="md:h-7" aria-label="View"><SelectValue /></SelectTrigger>
<SelectContent size="touch" position="popper">
<SelectItem value="table" className="md:min-h-7">Table</SelectItem>
</SelectContent>
</Select>
<DropdownMenuContent size="touch">
<DropdownMenuItem className="md:min-h-7">Rename</DropdownMenuItem>
</DropdownMenuContent>
<TabsList size="touch">
<TabsTrigger value="all" className="md:min-h-0 md:min-w-0">All</TabsTrigger>
</TabsList>PageLayout. A screen inside the app shell: its PageHeader (the header prop takes the same props), then its
sections, usually titled Cards, in one grid with the theme's 16 px spacing (gap-4). Every page that uses it gets
the same width and the same gap under the header, so an app needs no wrapper of its own. width="full" (the default)
takes the content area's width; width="content" caps a reading page at 48 rem (max-w-3xl) and centres it. The grid
is min-w-0, so a wide table scrolls inside its card instead of widening the page. data-slot="page-layout" and
data-width mark the root.
<PageLayout header={{ title: "Projects", crumbs: [{ label: "Workspace", href: "/" }, { label: "Projects" }] }}>
<Card>
<CardHeader>
<CardTitle>Active</CardTitle>
</CardHeader>
<CardContent>…</CardContent>
</Card>
</PageLayout>FoldRow. An item as one list row in a native <details>: a chevron, the title, short facts and badges on the
right; opened, it shows a DetailTable and its children. The bar and the opened content share one 8 px
horizontal inset (px-2; the content is padded 12 px top and bottom, py-3), so the table starts under the chevron;
isInset indents it under the title instead (32 px on the left) and sets data-inset on the content, like
StatsFold. A row with a summary of its own (icons, a status) passes summary,
drawn after the chevron in place of title, facts and badges; details and detailsLabel are optional together,
so the content can be several tables or a list. size="touch" makes the summary at least the touch-target height
(44 px) instead of the row height, for a phone list. actions puts controls in a right column of the row's bar (a
delete button, a menu), beside the <details> rather than inside its <summary>, so clicking one never folds the row;
status puts the item's status above them in the same column. The column spans the summary's full height however
many lines it wraps to, and the summary and the column light as one box when the row is open or hovered. Below md
the column falls under the summary and each action is at least 44 px. With a column the row is a grid
(data-slot="fold-row-with-actions", which carries the bottom border) and the opened content sits under the whole bar
as the details' sibling, shown while it is open. By default the chevron and the column are centred on the bar;
align="start" lines both up with the summary's first line instead, for a summary of several lines (a title, a stage,
an outcome): the chevron sits in a box one line of ui text high (data-slot="fold-row-chevron"), and the column is
top-aligned, the status on the first line and the actions under it. sideLayout="inline" puts the status left of
the actions on one line from md up instead (state left of the controls, right-aligned, wrapping when it runs out of
room; centred on the bar, or at its top with align="start"); below md the column is one line under the summary
either way. isOpenInitially renders the row open (<details open>), for the row the
address points at; only the first render reads it, and the reader can still fold the row.
<FoldRow title="Dentist" facts={["12.01.2027"]} badges={[]} detailsLabel="Visit details" details={rows} />
<FoldRow summary={<><Receipt aria-hidden="true" className="size-4" /> Invoice 12/2026 <Badge>Paid</Badge></>}>
<InvoiceLines />
</FoldRow>
<FoldRow title="clip.mp4" badges={[]} status={<Status color="green">Paid</Status>} actions={<DeleteButton />} />
<FoldRow align="start" size="touch" summary={<ItemLines />} status={<Status color="blue">In progress</Status>} actions={<OpenButton />} />
<FoldRow sideLayout="inline" title="softure/ai" badges={[]} status={<ResultBadge tone="success">Readable</ResultBadge>} actions={<DeleteButton />} />FilterChip. The filters above a list or a table, drawn the way a Notion database view draws them: a 24 px pill
icon · Label: value ▾ that opens a menu of options in the design system's popover. While the default value is
chosen the pill is muted; isActive (a non-default value) turns it into the blue tag and sets data-active. The
children are DropdownMenu items, so the menu works from the keyboard. FilterChipAdd is the "+ Add filter" pill
next to them (label replaces the built-in "Add filter"), opening a menu of the fields to filter by.
<div className="flex flex-wrap gap-1">
<FilterChip label="Status:" value={status ?? "all"} icon={<CircleDot aria-hidden="true" />} isActive={status !== null}>
<DropdownMenuRadioGroup value={status ?? "all"} onValueChange={setStatus}>
<DropdownMenuRadioItem value="all">All</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="failed">Failed</DropdownMenuRadioItem>
</DropdownMenuRadioGroup>
</FilterChip>
<FilterChipAdd>
<DropdownMenuItem onSelect={() => addFilter("owner")}>Owner</DropdownMenuItem>
</FilterChipAdd>
</div>SidePanel. A panel next to a canvas (a map) that leaves the canvas usable, so a switch inside shows its effect
at once (Sheet is modal). It floats on background with shadow-menu, 24 rem wide, full width on a phone, with a
heading and a ghost close button. Layouts: over (over the canvas's right side), left (over its left side),
beside (after the canvas, which shrinks to at least 24 rem or half) and list (a 24 rem column before the canvas);
beside and list cover the whole canvas on a phone. While closed it is hidden. Focus moves into it when it opens;
Escape inside or the close button calls onClose, and the caller moves focus back to its opener. An optional
footer is a strip with a top border pinned below the scrolling content (data-slot="side-panel-footer"), for an
action that belongs to the panel's foot; without it the panel has no strip.
<div className="relative flex h-full">
<button type="button" aria-controls="layers" aria-expanded={isOpen} onClick={() => setOpen(true)}>Layers</button>
<Map className="flex-1" />
<SidePanel id="layers" heading="Layers" layout="over" isOpen={isOpen} onClose={() => setOpen(false)}>
{/* switches */}
</SidePanel>
</div>SidePanel width (pixels, optional) sets its width on a wide screen; phone-wide beside and list keep covering the
canvas. The width lives in the CSS variable SIDE_PANEL_WIDTH_VARIABLE (--side-panel-width) on the panel itself;
page.css registers it with @property … inherits: false, so a change restyles the panel alone, not every row inside
it (a panel of a few hundred rows went from ~1.3 s to ~30 ms of style work per drag, #1326).
ResizeHandle. A vertical handle on the right edge of a column (a list, a SidePanel layout="list") that sets the
column's width: a pointer drags it, the arrow keys step it by RESIZE_HANDLE_STEP (16 px, Shift four times that), Home
and End go to min and max, a double click restores defaultValue. It is a focusable separator naming its column
with aria-controls and the width with aria-valuenow; it takes no width of its own (it lies over the border between
the columns) and shows ring while hovered, focused or dragged; hidden phone-wide. onChange gets every width,
onCommit the width once a drag, key or reset ends (the moment to keep it, e.g. in a cookie). clampSize(value, min,
max, fallback) (a plain module, callable in a Server Component) reads a kept width back within the limits.
<div className="relative flex h-full">
<SidePanel id="days" heading="Days" layout="list" isOpen onClose={close} width={width}>…</SidePanel>
<ResizeHandle label={copy.resizeDays} controls="days" value={width} min={240} max={480} defaultValue={384}
onChange={setWidth} onCommit={keepWidth} />
<Map className="flex-1" />
</div>A drag calls onChange on every pointer move, so a width kept in React state re-renders its whole screen per move.
liveVariable avoids that: during a drag the handle writes the width straight to that CSS variable on the controls
element and to its own aria-valuenow, then calls onChange and onCommit once, on release, with the final width
(nothing for a drag that ends where it started). Keys and a double click still call both at once. On release the
handle puts the variable back to its rendered value before onChange, so the next render owns the width again; a
missing controls element falls back to onChange per move. For a SidePanel:
<ResizeHandle label={copy.resizeDays} controls="days" value={width} min={240} max={480} defaultValue={384}
liveVariable={SIDE_PANEL_WIDTH_VARIABLE} onChange={setWidth} onCommit={keepWidth} />AsidePanel. A column of the app shell that slides in from the right, beside SidebarInset: the content
narrows next to it and stays usable (SidePanel is a panel over a canvas instead). AsidePanelProvider replaces
SidebarProvider (every other prop passes through) and keeps one side panel open at a time: while the panel is open
on a wide screen the left Sidebar (offcanvas) is folded, and opening the sidebar any way (its trigger, Ctrl+B,
AsidePanelSidebarOpener) closes the panel; closing the panel brings the sidebar back unless the user folded it.
keepsSidebarOpen lets both stay open instead: the sidebar keeps its own state, opening the panel never folds it and
opening the sidebar never closes the panel (the content narrows between the two).
AsidePanelToggle: one icon button fixed at the top-right edge, in the same place open or closed, witharia-expanded,aria-controlsand a label that switches between show and hide;outlinewhile closed,secondarywhile open. Opening from it moves focus to the panel's heading (tabIndex=-1).icon(aLucideIcon) replaces the panel icons in both states, for a panel that holds one tool its users know by its icon. The toggle, the width switch and the sidebar opener show their label as a hover hint (title) too.AsidePanel title: anaside(sticky top-0 h-dvh,border-l) with a header holding the heading and a ghost width switch:standard(two fifths) orhalf(the shell split half and half). Escape closes it and returns focus to the toggle unless a dialog, menu, listbox or popover is open (isOverlayOpen(document): Radixdata-state="open",:popover-openordialog[open]; a closed popover left in the page does not count). BelowMOBILE_BREAKPOINTit is a rightSheet, opened for that page only: the kept state never opens it there;descriptionadds one line under the sheet's title (itsaria-describedby). Theasidecarriesmax-md:hidden, so a phone served the wide-screen HTML (the server cannot tell the width) never paints it before hydration. Its children render only while it is open, so pass a lazily loaded body (next/dynamicwithssr: false) and screens that never open it never load its code.AsidePanelSidebarOpener: an icon button fixed at the top-left edge, shown only while the sidebar is folded on a wide screen; it brings the sidebar back and closes the panel (underkeepsSidebarOpenit only brings the sidebar back, so give it alabelthat does not mention the panel).- Kept state:
initialState({ isOpen, width }) andsave(state), called after each change on a wide screen; keep it per signed-in user (the app's database), so the panel opens the same way across screens, reloads and devices. A failed save keeps the choice on the page and reachesonSaveError.isHiddenmarks a screen that offers no panel: no toggle, no panel, and the sidebar stays open whatever the kept state says.useAsidePanel()reads the state.
const MapPanel = dynamic(() => import("./map-panel"), { ssr: false });
<AsidePanelProvider initialState={panelState} save={savePanelState} isHidden={!offersMap}>
<AppSidebar />
<SidebarInset>
<AsidePanelSidebarOpener />
<AsidePanelToggle icon={MapIcon} />
{children}
</SidebarInset>
<AsidePanel title="Map">
<MapPanel />
</AsidePanel>
</AsidePanelProvider>SheetMenu. A phone's navigation drawer: a Sheet from the right with a heading and a ghost close button,
navigation rows at the top and one row at the foot, the way a desktop Sidebar ends with its foot menu.
SheetMenu (ul), SheetMenuItem (li) and SheetMenuButton (the row) mirror SidebarMenu, SidebarMenuItem
and SidebarMenuButton, but need no SidebarProvider. A row is full width, its icon and label left-aligned in the
foreground colour (text-ui, icons 16 px), 44 px tall on a phone (min-h-touch-target) and a 34 px list row from
md (min-h-row-height); hover, press and the active row (isActive, data-active) take accent, focus the
ring; disabled (or aria-disabled on a link) dims it to 50 % and drops its clicks. asChild renders a link with
the row's look (add aria-current="page" on the active one); wrap a row in SheetClose asChild to close the drawer
on a click. The heading and the foot are a recipe from the existing parts: showCloseButton={false} on
SheetContent, the close as a ghost icon Button in a SheetHeader row, and the foot rows in a SheetFooter
(already pushed to the panel's foot by mt-auto) with border-t.
<Sheet open={isOpen} onOpenChange={setOpen}>
<SheetContent side="right" showCloseButton={false} className="gap-0">
<SheetHeader className="flex-row items-center justify-between gap-2 border-b py-2 pr-2 pl-4">
<SheetTitle>Workspace</SheetTitle>
<SheetClose asChild>
<Button variant="ghost" size="icon" aria-label={t("menu.close")}>
<X aria-hidden="true" strokeWidth={ICON_STROKE_WIDTH} />
</Button>
</SheetClose>
</SheetHeader>
<nav aria-label={t("menu.label")} className="p-2">
<SheetMenu>
<SheetMenuItem>
<SheetClose asChild>
<SheetMenuButton asChild isActive>
<Link href="/" aria-current="page">
<House aria-hidden="true" strokeWidth={ICON_STROKE_WIDTH} />
<span>{t("menu.home")}</span>
</Link>
</SheetMenuButton>
</SheetClose>
</SheetMenuItem>
</SheetMenu>
</nav>
<SheetFooter className="border-t p-2">
<SheetMenu>
<SheetMenuItem>
<SheetMenuButton onClick={signOut}>
<LogOut aria-hidden="true" strokeWidth={ICON_STROKE_WIDTH} />
<span>{t("menu.signOut")}</span>
</SheetMenuButton>
</SheetMenuItem>
</SheetMenu>
</SheetFooter>
</SheetContent>
</Sheet>An app that laid out ghost Buttons itself (size="lg" className="min-h-touch-target w-full justify-start text-ui
text-foreground") moves each row to SheetMenuButton and drops those classes.
A screen's summary figures: StatsFold (figures folded under a heading, closed by default, on native <details>),
StatCards (a wrapping row of figure cards: label, figure in its tone, optional progress bar under the figure,
optional hint, optional aside tag; isFullWidth and isOneRow change the grid) and StatPills ("label value" tags in one row). Each figure takes a
tone; the app keeps only its own table of which meaning takes which tone. A card's progress (0–100, clamped) draws
the package's 6 px Progress under the figure, filled in the card's tone (primary without one) and named by
progressLabel (default: the card's label). A card's icon (a Lucide icon component) is drawn before the label: 16 px,
ICON_STROKE_WIDTH, the label's muted colour, 6 px apart, aria-hidden (the label stays the card's text).
StatsFold's content spans the heading row's full width (the same left and right edges as the row); isInset indents
it to line up with the title after the chevron.
<StatsFold title="Summary">
<StatCards
label="Totals"
cards={[
{ key: "paid", label: "Paid", value: "1,200", tone: "success", icon: Wallet },
{ key: "owed", label: "Owed", value: "300", tone: "danger", hint: "2 invoices", aside: { text: "+5%" } },
{ key: "hours", label: "Hours", value: "21.5 / 23.4 h", progress: 92, progressLabel: "Hours used" },
]}
/>
<StatPills label="Counts" pills={[{ key: "late", label: "Late", value: "1", tone: "danger" }]} />
</StatsFold>An ordered process: Steps (the stages of a multi-step task, the phases of a migration, the steps of one run). An
<ol> where each step has a number in a badge coloured by its state (done green, current primary, failed red,
todo muted, the default), a title, an optional note and an optional aside at its end (a tag naming the service
the step uses). Layouts: row (default, a wrapping grid of cards, the current one on blue-bg) and list (compact
rows with a square badge). The current step carries aria-current="step"; each state is also a word for a screen
reader (stateLabels replaces the English words). data-slot="steps", data-step and data-state mark the parts.
<Steps
label="Invoice stages"
steps={[
{ key: "period", title: "Period", state: "done" },
{ key: "document", title: "Document", state: "current", note: "2 files attached" },
{ key: "invoice", title: "Final invoice", aside: <Badge variant="tag" color="blue">KSeF</Badge> },
]}
/>A dated sequence: Timeline (a trip's stays and the moves between them, an order's history, a project's milestones).
An <ol> named by label where each entry sits on one continuous vertical rail, running from the first marker to the
last: a marker in a palette color (gray by default) with an optional Lucide icon, then the body: an optional time
(muted, tabular figures), the title, an optional muted description, an optional badges row (statuses, tags) and
optional children under it (deadlines, notes). size default is a major entry (a 24 px round marker in the colour's
tag fill, the time above the title); compact is a minor entry between two major ones (the icon or a dot in the
colour on the page, the time after the title, the description and badges on one wrapping line). line: "dashed" dashes the rail through an entry for something
missing. With onSelect the body is a button; actionLabel is read before its visible text ("Show on the map"), so
the button's name says what it does and still contains every word it shows; aside sits at the right edge outside that
button, so a mark with its own popover never nests in it. With fold the entry folds open and closed instead: the body is
a disclosure button (aria-expanded, aria-controls, a chevron that turns when open) at least the touch-target
height, and children show only while it is open; fold: {} keeps its own state (closed, or open with
isOpenInitially), fold: { isOpen, onOpenChange } lets the app keep it. fold and onSelect exclude each other.
The colour never carries a meaning alone: put the state in
words in badges. data sets an app's own data-* attributes on the item. data-slot="timeline",
timeline-item (with data-item, data-size, data-line), timeline-rail, timeline-marker, timeline-item-body
and the body's parts mark the parts.
<Timeline
label="Trip"
items={[
{ key: "flight", size: "compact", icon: Plane, color: "green", title: "Flight", time: "7 Dec, 07:15", description: "Home → Hanoi" },
{
key: "hanoi", icon: BedDouble, color: "green", time: "8–9 Dec · 2 nights", title: "Hanoi",
badges: <Status color="green" icon={CircleCheck}>Booked</Status>,
onSelect: () => showOnMap("hanoi"), actionLabel: "Show on the map",
},
{ key: "sapa", icon: CircleDashed, color: "yellow", line: "dashed", time: "11–12 Dec", title: "Sa Pa",
badges: <Status color="yellow" icon={CircleDashed}>No stay</Status> },
{ key: "train", icon: TrainFront, color: "blue", time: "10 Dec, 22:00", title: "Train to Sa Pa",
fold: {}, children: <p>Car 4, berth 12.</p> },
]}
/>List, ListItem, ListRow: list density. A list of rows (days, places, a bag of items) that is compact
(tight rows, no line between them, the default) or roomy (a quiet border line between rows and one more 4 px step
around each, so the rows breathe). The density comes from data-density on the nearest ancestor (<html> for a user
setting, a page, a section) or density on the list itself; the lengths are theme-kit's --list-row-y,
--list-item-y and --list-divider-width (theme-kit README, "List density"). The line is drawn between rows only, so
a list of one has none; ListItem keeps the row away from the lines, so a row's rounded hover never touches them. On a
grey card (secondary, muted) pass surface="tinted": the line takes the page's background, because in the dark
scheme the theme's border is that card's own grey.
<html data-density="roomy">
…
<List as="ol" aria-label="Days">
{days.map((day) => (
<ListItem key={day.id}>
<ListRow asChild>
<button type="button" onClick={() => open(day.id)}>{day.label}</button>
</ListRow>
</ListItem>
))}
</List>
<List surface="tinted" density="compact">…</List> {/* this one stays compact on a roomy page */}ListItem asChild and ListRow asChild keep the app's own element (a sortable item, a link). For a list the app
renders with other components, LIST_CLASSES holds the same classes (list, tintedList, item, row), e.g.
<SortableList className={LIST_CLASSES.list}> with <SortableItem className={LIST_CLASSES.item}>.
ListEntry: a row with a right column. The most common row of an admin list: what the row is on the left
(title, in the medium weight, and details, the lines under it in the muted colour) and a right column with the
row's state on top (status, badges that wrap right-aligned) and its controls under it (actions). Both sides align
to the top: the state stands on the title's line however many detail lines the identity has. With href the
title is a link stretched over the whole row, so the row is one box lit on hover with one focus ring, and a muted arrow
sits beside the column: on the state's line when the state stands over controls, otherwise level with the column's
middle, so an icon button beside it shares its line; the arrow and the column are one group, so the arrow never wraps onto a
line of its own. The
column stays above the link: its controls are their own targets, and a click on the gap between them or on the arrow
still opens the row. Pass linkComponent for a router's link (it takes href, className and children). On a
phone (below md) the column wraps under the identity, right-aligned, and every control is at least the touch target
(44 px). A control that needs room while it is open (an inline answer form) carries data-row-wide: the column then
takes the full row width under the identity, its lines starting on the left. sideLayout="inline" puts the state
left of the controls on one line instead of over them (a watched repository: a "Readable" badge, then its delete
button): the status first, then the inline control and the menu, right-aligned and wrapping when the line runs out of
room; a data-row-wide control still takes the full-width column, and on a phone the line wraps under the identity
with the same 44 px targets. The default, stack, keeps the state over the controls. Place the row in a ListItem, so
it follows the list's density.
<List aria-label="Deploys">
{deploys.map((deploy) => (
<ListItem key={deploy.id}>
<ListEntry
href={`/deploys/${deploy.id}`}
linkComponent={Link}
title={deploy.name}
details={<><span>{deploy.branch}</span><span>{deploy.startedAt}</span></>}
status={<ResultBadge tone={TONE_BY_RESULT[deploy.result]}>{deploy.resultLabel}</ResultBadge>}
actions={<Button variant="ghost" size="icon-sm" aria-label="Retry"><RotateCw /></Button>}
/>
</ListItem>
))}
</List><ListEntry
sideLayout="inline"
title={repository.name}
details={<span>{repository.watchedSince}</span>}
status={<ResultBadge tone="success">{t.repositories.readable}</ResultBadge>}
actions={<Button variant="ghost" size="icon-sm" aria-label={t.repositories.stopWatching}><Trash2 /></Button>}
/>Row controls and row state. A row shows at most one control inline in actions: a switch, or the row's one
primary action. Every other action goes into menu, a RowActionsMenu on the same line: an icon-only "More actions"
button (its name from label, English by default) that opens a menu of actions, with destructiveAction last,
after a separator, in the danger tone. Give the destructive action a confirm (title, description,
confirmLabel, cancelLabel) and it opens an alert dialog first, running only on the destructive confirm; focus goes
back to the menu button. A destructive onSelect that returns a promise (a server action) keeps the dialog open with
both buttons disabled and confirm.pendingLabel ("Deleting…") on the confirm button until it settles: it closes on
success and stays open on failure, where the app shows its own error. An action that opens the app's own dialog sets
opensDialog, so the menu leaves focus to that dialog; pass triggerRef and return focus to the menu button from the
dialog's onCloseAutoFocus. Below md every item, and the confirmation's Cancel and confirm buttons, are the 44 px touch target; an action's id renders as
data-row-action for browser tests. The menu opens with Enter, Space or ArrowDown, and the arrow keys move between items. A row
with a single action keeps it inline and has no menu. The inline control and the menu button never wrap apart, and on
a phone each is at least the touch target (44 px): pass the switch size="touch" (with className="md:m-0 md:h-4
md:w-[26px]" for the plain switch on a desktop), since the row never stretches a switch's track. Each fact is said once: a switch is its own on/off state, so no
badge or label repeats it; a ResultBadge carries its own icon, so no separate state icon stands next to it.
<ListEntry
title={hook.name}
details={<span>{hook.url}</span>}
status={<ResultBadge tone={TONE_BY_RESULT[hook.lastResult]}>{hook.lastResultLabel}</ResultBadge>}
actions={<Switch size="touch" className="md:m-0 md:h-4 md:w-[26px]" checked={hook.isOn} onCheckedChange={toggle} aria-label={t.hooks.enabled} />}
menu={
<RowActionsMenu
label={t.rows.more}
actions={[
{ label: t.hooks.test, onSelect: test },
{ id: "replace-token", label: t.hooks.replaceToken, onSelect: openReplaceDialog, opensDialog: true },
]}
triggerRef={menuButton}
destructiveAction={{
id: "delete",
label: t.hooks.delete,
onSelect: () => deleteHook(hook.id),
confirm: {
title: t.hooks.deleteTitle,
confirmLabel: t.hooks.delete,
pendingLabel: t.hooks.deleting,
cancelLabel: t.common.cancel,
},
}}
/>
}
/>ResultBadge: a result in its tone. A result (passed, failed, skipped, running) as a filled tag in its tone's
colour (TONE_COLORS: success green, warning orange, danger red, muted gray, default the default tag), with
the tone's icon (RESULT_BADGE_ICONS: CircleCheck, TriangleAlert, CircleX, CircleMinus, Circle; pass
icon for another) and always a word. The app keeps its own table of which result takes which tone; the theme owns
the colours, so "failed" is red in every list. isSpinning marks a run still in progress: the icon (a
LoaderCircle unless icon is given) spins with motion-safe:animate-spin, still for a reader who asked for reduced
motion. Status is the ghost counterpart, for a state written in text colour. Every other span prop (data-*,
id, ARIA) reaches the badge, so an app marks it with what it shows and its tests read that; the theme's own
data-slot, data-tone, data-color and data-spinning always win.
<ResultBadge tone="danger">Failed</ResultBadge>
<ResultBadge tone="muted" isSpinning>Running</ResultBadge>
<ResultBadge tone="success" data-read-status="ok">Read</ResultBadge>ListGroup, ListGroupHeading: a sticky group heading. A heading over a run of rows (a country's days, a month's
entries) that sticks at the top of the scroll container while its rows pass under it, and is pushed away by the next
group's heading. Put the groups straight in the scrolling element and give it no padding: a sticky box sticks at the
scroll container's padding edge, so top padding would leave a strip above the stuck heading. ListGroup holds the side
room (px-2) and the heading bleeds over it (-mx-2 px-4), so the heading spans the whole scrollport and its text
lines up with the rows'. The heading is text-ui-medium in foreground on the page's background with a border
line under it, 40 px high; every ListItem in the group gets the same scroll margin, so a row scrolled into view
(scrollIntoView({ block: "nearest" })) stops below the heading. On a grey card pass surface="tinted" to both the
heading and the list: the heading takes secondary and its line the page's background.
<div className="h-full overflow-y-auto">
{countries.map((country) => (
<ListGroup key={country.id} asChild aria-labelledby={`country-${country.id}`}>
<section>
<ListGroupHeading asChild>
<h3 id={`country-${country.id}`}>{country.name}</h3>
</ListGroupHeading>
<List as="ol" aria-label={`Days in ${country.name}`}>
{country.days.map((day) => (
<ListItem key={day.id}>
<ListRow asChild>
<button type="button" onClick={() => open(day.id)}>{day.label}</button>
</ListRow>
</ListItem>
))}
</List>
</section>
</ListGroup>
))}
</div>LIST_CLASSES.group, groupHeading and tintedGroupHeading give the same classes to a group the app renders itself.
MiniProgress. A share with its figure inside the bar, for a table cell or a tile where a figure next to a
Progress would collide with it: a 20 px rounded track (primary/12) that takes the cell's width (at least 64 px),
filled in primary (the link blue in dark, as in Progress) or in its tone's colour. value is 0–100, clamped
(non-finite reads as 0); label is the text inside (default: the rounded percent). The label is drawn twice: in
foreground on the track and in the page background clipped to the fill, so it reads at any value, also where the
fill's edge crosses a letter, and passes AA on the track and on every fill in both schemes. A label wider than the cell
ends in an ellipsis inside the bar. The bar is Radix's progressbar: a string label is its aria-valuetext (the amount
is announced, not only the percent), the drawn copies are aria-hidden; give it a name with aria-label. Slots:
mini-progress (with data-tone), mini-progress-indicator, mini-progress-label.
<TableCell className="w-24">
<MiniProgress value={task.costShare} label={formatUsd(task.costUsd)} aria-label={messages.costShare} />
</TableCell>
<MiniProgress value={82} tone="warning" aria-label={messages.budgetUsed} />An app that set a figure in a fixed-width span next to Progress (flex gap-2 + w-16 + Progress) swaps the
pair for one MiniProgress and drops the widths.
MarkPopover. A tag in a palette colour with an icon and a count; a click or Enter opens the design system's
popover listing the entries, Escape or a click outside closes it. It runs on the browser's Popover API (no client
state, no portal): the panel sits in the top layer, so a card's overflow never clips it, centred on a phone and
under its mark where CSS anchor positioning is supported. Only phrasing elements, so it fits inside a <summary> or
a paragraph; a click on the panel's text does not toggle an enclosing <details>, links and buttons inside still
work. The colour means the worst of what it lists; the copy is props.
<MarkPopover color="red" icon={TriangleAlert} count={2} label="2 open warnings, show the list"
heading="Open warnings" closeLabel="Close" buttonData={{ "data-kind": "warnings" }}>
<span role="listitem">Payment overdue</span>
<span role="listitem"><a href="/tickets">Tickets to buy</a></span>
</MarkPopover>Code and CodeBlock. Code is inline code: the text-code style (13/20 mono) in its own red,
code-foreground (a shade of the palette red that reaches 4.5:1 on its chip), on secondary, as in Notion. CodeBlock is a <pre> for logs and file paths on muted, radius 8; long lines scroll sideways, wrap wraps
them. With label the block is a named region (role="region") that keyboard users can focus and scroll; without it,
plain text. No syntax highlighting. data-slot="code" and data-slot="code-block" mark the parts.
<p>Run <Code>npm ci</Code> first.</p>
<CodeBlock label="Build log" wrap>{log}</CodeBlock>CopyButton. One value to the clipboard, for a URL, a command or a code the reader pastes elsewhere: a
secondary button (any Button variant and size) with Lucide's copy icon that turns into a tick and says
copiedLabel for two seconds once the browser took the text, announced politely to a screen
reader. A refused write (an insecure page, a denied permission) leaves it as it was, so keep the value visible beside
it (a CodeBlock) for the reader to select by hand. The value is never part of the button's name; onCopied tells the
app after a copy. A client component. data-slot="copy-button", data-copied while it says "Copied".
<div className="flex items-center gap-2">
<CodeBlock className="min-w-0 flex-1">{url}</CodeBlock>
<CopyButton value={url} label="Copy URL" copiedLabel="Copied" />
</div>HelpTooltip. A field's "?" hint: a ghost icon button (Lucide's circle-help) whose tooltip opens on hover, focus,
click and tap, since a phone has no hover. A click opens rather than toggles, so a press during which hover opened the
tooltip still ends with it open (a plain Tooltip toggled on click closes again: Radix's trigger closes on every
click). Escape, a press outside, blur and the pointer leaving the button and the tooltip close it. Below md the
button is the 44 px touch target. The hint is also rendered hidden under hintId (generated when not given), so the
field points to it with aria-describedby. label names the button ("Help" by default; name the field where it
helps), side and align place the tooltip, onOpenChange tells the app. It brings its own TooltipProvider. A
client component. data-slot="help-tooltip-trigger" on the button, data-slot="help-tooltip-hint" on the hidden hint.
<div className="flex items-center gap-1">
<Label htmlFor="email">Email</Label>
<HelpTooltip label="Help for Email" hintId="email-hint">The address we send receipts to.</HelpTooltip>
</div>
<Input id="email" type="email" aria-describedby="email-hint" />TableSortHead. A sortable column's header for Table: a TableHead whose content is a ghost button with the
column's name and a chevron for its direction (up for ascending, down for descending, a muted up-down one for
none). aria-sort is set on the sorted <th> only, as the WAI-ARIA sortable table pattern asks. A press calls
onSortChange with the next direction: none → descending → ascending → none, or with cycle="two-state" descending
⇄ ascending, never back to none (nextSortDirection(direction, cycle) gives the same answer). The button is the tab
stop, Enter and Space press it. Hidden text inside the button says what a press does ("Sort descending", "Sort
ascending", "Remove sorting" by default); label replaces it with the app's copy, while the visible column name
stays the start of the button's name. align="end" fits a right-aligned column of amounts; other <th> props pass
through, buttonClassName reaches the button. The sorting itself stays in the app, on the client or the server;
sortRows(rows, key, direction, compare?) sorts an array in memory into a new one, stable in both directions (equal
rows keep their order), empty values last, numbers, dates and booleans by value and strings with numeric,
case-insensitive collation; key is a property name or an accessor. A client component.
data-slot="table-sort-head" with data-sort on the <th>, data-slot="table-sort-button" on the button,
data-slot="table-sort-label" on the hidden text.
const [sort, setSort] = useState<{ key: "number" | "amount"; direction: SortDirection }>({ key: "amount", direction: "descending" });
const directionOf = (key: typeof sort.key): SortDirection => (sort.key === key ? sort.direction : "none");
const rows = sortRows(invoices, sort.key, sort.direction);
<Table>
<TableHeader>
<TableRow>
<TableSortHead direction={directionOf("number")} onSortChange={(direction) => setSort({ key: "number", direction })}>
{messages.number}
</TableSortHead>
<TableSortHead align="end" direction={directionOf("amount")}
onSortChange={(direction) => setSort({ key: "amount", direction })}
label={messages.sortLabel[nextSortDirection(directionOf("amount"))]}>
{messages.amount}
</TableSortHead>
</TableRow>
</TableHeader>
<TableBody>{rows.map((invoice) => <InvoiceRow key={invoice.id} invoice={invoice} />)}</TableBody>
</Table>TableViewSettings, applyColumnVisibility, useTableColumns. A table's view settings, as Notion's
"Properties" menu: a ghost icon button (Lucide's sliders, label names it, "View settings" by default) for the
table's toolbar opens a panel with a heading, the shown columns under "Shown in table" with "Hide all", and the hidden
ones under "Hidden in table" with "Show all" (a group only when it has columns, a bulk button only when it changes
something). Each row is the column's name and a Switch named by it; a click anywhere on the row toggles it, and below
md the row and the button are 44 px touch targets. columns is { id, label, isVisible, canHide? }[] in the table's
order; onChange(nextVisibleIds) gets the ids to show in that order. A column with canHide: false (the selection
checkbox, the title) keeps its switch on and disabled and stays through "Hide all". With canReorder the shown
columns get a drag handle (SortableList, so Space, the arrow keys and Space move one by keyboard), and
onReorder(nextOrder) gets every id: the shown ones in their new order, the hidden ones in their slots. Tab moves
between the switches, Escape closes the panel and returns focus to the button. messages replaces the panel's copy
(trigger, title, shown, hidden, showAll, hideAll, reorder); align, open, defaultOpen and
onOpenChange as on Popover.
applyColumnVisibility(definitions, visibleIds, order?) returns the definitions to render: the visible ones, in
order when given (ids it does not name after, in their own order). useTableColumns({ columns, store }) keeps the
state for one table: columns are { id, label, canHide?, isVisibleByDefault? }, and store is the app's choice
(local storage, the URL, its settings API) as { load(): { visible, order } | null, save(state) }. It renders the
defaults first and calls load once after mount, so a store reading browser storage never breaks hydration; stored ids
no longer defined are dropped, new columns take isVisibleByDefault (true by default), and save gets every change.
It returns columns, onChange- and onReorder-ready setVisibleIds and setOrder, visibleIds, order and
reset. Client components. data-slot="table-view-settings-trigger" on the button,
data-slot="table-view-settings" on the panel, data-group="shown" | "hidden" on its groups, data-column on every
row.
const COLUMNS = [
{ id: "number", label: t("invoices.number"), canHide: false },
{ id: "client", label: t("invoices.client") },
{ id: "notes", label: t("invoices.notes"), isVisibleByDefault: false },
];
const view = useTableColumns({
columns: COLUMNS,
store: {
load: () => readJson(localStorage.getItem("invoices.columns")),
save: (state) => localStorage.setItem("invoices.columns", JSON.stringify(state)),
},
});
const shown = applyColumnVisibility(DEFINITIONS, view.visibleIds, view.order);
<TableViewSettings
label={t("invoices.viewSettings")}
columns={view.columns}
onChange={view.setVisibleIds}
canReorder
onReorder={view.setOrder}
/>DatePicker, DateTimePicker. A day, or a local date and time, picked in the theme's look instead of the
browser's native date and time inputs. The trigger has the Input look (the 44 px touch height below md), a calendar
icon, the value in the app's locale (en-US by default: "Nov 26, 2026", "Nov 26, 2026, 9:30 AM") or the
placeholder, and the app's timeZone as a muted suffix. It opens a Popover with a month calendar that follows the
WAI-ARIA date picker pattern: a grid labelled by the month, focus on the chosen day (else today in timeZone),
arrows by day and week, Page Up/Down by month (with Shift by year), Home/End to the week's edges, Enter or Space to
choose, Escape to close; aria-selected on the chosen day, aria-current="date" on today, the week from
weekStartsOn (Monday by default). Days outside min / max are disabled, and the keys and the month buttons stay
inside them. DateTimePicker adds an hours and a minutes field (native selects with the field look, so a phone opens
its own wheel), the minutes by minuteStep (1 by default; 5 or 15 are common), and a Done button; the time field
waits for a day, a first day starts at defaultTime (09:00), a new day keeps the chosen time, and a time outside
min / max moves to the nearest allowed one. DatePicker closes when a day is chosen.
The value is a string with no zone: YYYY-MM-DD for DatePicker, YYYY-MM-DDTHH:mm (core's LocalDateTime) for
DateTimePicker, controlled (value, onValueChange, null for none) or not (defaultValue); a value that is not
one of those counts as none. With name, a hidden input carries it, so a server action form needs no client state.
The app turns it into an instant with core's getLocalDateTimeInstant(value, timeZone) after isLocalDateTime.
open, defaultOpen and onOpenChange drive the popover; the trigger takes a button's props (id for a Label,
aria-invalid, aria-describedby, disabled); name it with a Label, not aria-label, which would hide the shown
value from its name. messages replaces the English copy (notionMessages.en.datePicker).
A client component. data-slot="date-picker-trigger", date-picker-value, date-picker-time-zone,
date-picker-calendar, date-picker-caption, date-picker-grid, date-picker-time; each day button carries
data-day="YYYY-MM-DD".
<Label htmlFor="publish-at">Publish at</Label>
<DateTimePicker
id="publish-at"
name="publishAt"
locale="pl-PL"
timeZone="Europe/Warsaw"
min={nowInWarsaw}
minuteStep={15}
/>Prose. A long read whose elements the app does not draw itself, such as Markdown rendered to HTML (a help page,
a documentation article, a CMS body): headings take heading-1 to heading-3 with more room above than below,
paragraphs the body style, lists their markers in the quiet foreground, links the link colour underlined, inline
code the Code look and a pre block the CodeBlock look, quotes and rules a quiet border line, and a table the
ui size with lines between rows (a wide one scrolls inside its block). The blocks share one rhythm, with none before
the first or after the last. Put the page's title in a PageHeader above it. asChild keeps the app's element (an
article); PROSE_CLASSES gives the same classes to a wrapper the app styles itself. Pass HTML only from content the
app trusts (its own files), never a visitor's text. data-slot="prose".
<PageHeader title={doc.title} description={doc.description} />
<Prose asChild>
<article dangerouslySetInnerHTML={{ __html: renderMarkdown(doc.body) }} />
</Prose>UpdatePrompt. The offer to reload into a new build, for an installed app on @softure-ai/pwa: a floating
Alert at the bottom of the screen (shadow-menu, at most max-w-md), padded by the safe-area insets so it clears a
phone's home indicator and notch, with a reload Button at the touch height (md:h-7 on a desktop). It is a polite
status, not an alert, so it never interrupts a screen reader. It draws nothing until open. The copy is props,
keyed like pwaMessages.en.update; data-slot="update-prompt" marks the root.
const { isUpdateReady, activate } = useServiceWorkerUpdate(); // @softure-ai/pwa/react
<UpdatePrompt open={isUpdateReady} onReload={activate} {...messages.update} />InstallBar. The offer to install the app on a phone, for an app on @softure-ai/pwa: a floating Alert like
UpdatePrompt (bottom of the screen, inside the safe-area insets, max-w-md), with the browser's install Button at
the touch height for offer="browser_prompt", or the two iOS steps with their icons (Share, then Add to Home Screen)
for offer="ios_steps", and a ghost close Button at icon-touch (md:size-7 on a desktop) labelled by close. It
is a polite status and draws nothing for offer="none". The copy is props, keyed like pwaMessages.en.install:
const { offer, install, close } = useInstallOffer({ app: "fire" }); // @softure-ai/pwa/react
<InstallBar offer={offer} onInstall={() => void install()} onClose={close} {...messages.install} />LaunchScreen. What an installed app on @softure-ai/pwa shows from its first byte until the page arrives,
streamed at once from the root app/loading.tsx: full screen on the theme's background (light and dark), the app's
icon (size-16, rounded-2xl, decorative), its name, a Progress (w-48) named by label, and the percentage
(hidden from screen readers: the bar reports the value). It renders at 0; the inline script
(buildLaunchProgressScript() from @softure-ai/pwa) moves the bar's value, its indicator and the percentage through
data-slot="progress", progress-indicator and launch-screen-percent, and stops once the page replaced the screen:
// app/loading.tsx
import { buildLaunchProgressScript, ICONS_PATH } from "@softure-ai/pwa";
const ICON = `${ICONS_PATH}/icon-192.png`; // the manifest's icon, drawn by the icon route
const SCRIPT = buildLaunchProgressScript();
export default function Loading() {
return <LaunchScreen name={messages.app.name} iconSrc={ICON} label={messages.pwa.launch.label} script={SCRIPT} />;
}TopLoadingBar. The wide-screen counterpart of LaunchScreen: a Progress fixed to the top edge (inset-x-0
top-0 z-50), 2 px high, square, on a transparent track and pointer-events-none, so the page under it stays usable
while a route loads. Named by label; value (0–100) when the app knows the progress, otherwise it is indeterminate:
a third of the track sliding across it for ever (still, full and half-opaque with reduced motion). The inline script
(buildLaunchProgressScript({ rootSlot: "top-loading-bar" }) from @softure-ai/pwa) gives it the launch counter's
values where the browser runs it, a streamed first load; its first value makes the bar determinate. A client-side
navigation never runs a script React inserts, so there the bar keeps sliding. Any Progress without a value is
indeterminate the same way.
RouteLoading. The loading state for the root app/loading.tsx, picked in the browser, so reading the request
(which makes static pages dynamic) is not needed: it streams both LaunchScreen and TopLoadingBar and CSS shows
the launch screen below md or in an installed app (display-mode: standalone), the top bar on a wide screen in a
browser tab (md and display-mode: browser). Each takes its own counter script:
// app/loading.tsx
import { buildLaunchProgressScript, ICONS_PATH } from "@softure-ai/