@morze/ui
v0.9.0
Published
Morze UI — React component kit built on shadcn/ui + Radix primitives with the Morze convex look.
Maintainers
Readme
@morze/ui
Morze UI — a React component kit shaped like shadcn/ui (latest) on Radix primitives, wearing the convex look from the Morze landing: a flat fill, a hairline rim, an inset highlight on top and a tone glow underneath.

background-color: rgb(tone);
border: 1px solid rgba(255,255,255,.18);
box-shadow: 0 3px 10px -4px rgba(tone,.4),
inset 0 1px 0 rgba(255,255,255,.35),
inset 0 -1px 0 rgba(0,0,0,.2);That recipe is applied to every active element: buttons, toggles,
checkboxes, radios, switches, sliders, tabs, the select trigger, badges and the
active navigation item. Every fill is one flat colour — the volume is drawn
on the edges of a control, never washed across its face. The recipe carried a
135° gloss sweep until the fills were flattened; it survives as a hook that is
off by default (--mz-fill-sheen, and --mz-face-sheen / --mz-glass-sheen
for the neutral and frosted faces), so a host that wants the gloss back
re-points one token per family. The label stays flat for the same reason the
landing dropped it — the embossed text-shadow is off
(--mz-convex-text-shadow: none), because on a 34px control it only made the
text shout.
The surfaces that other content passes behind are glass: menus, popovers,
dialogs, the sheet, the sidebar rail and a sticky table header are a
translucent cut of the same surface ramp over a backdrop blur
(--mz-glass*), so a menu frosts the page under it and a pinned header
frosts the rows scrolling past. Controls stay convex and opaque — glass is
for what things float over, not for what you press. With
prefers-reduced-transparency, or in an engine without backdrop-filter,
the glass falls back to the opaque ramp.
Install
npm i @morze/uireact and react-dom 19 are peer dependencies: like shadcn after its
React 19 rewrite, components take ref as a plain prop and use no forwardRef.
Tailwind is not required — the package ships compiled CSS.
// once, at the app root
import '@morze/ui/styles.css'
import { Button, Switch, MorzeThemeProvider } from '@morze/ui'
export default function App() {
return (
<MorzeThemeProvider defaultTheme="dark">
<Button>Submit request</Button>
<Switch defaultChecked />
</MorzeThemeProvider>
)
}Tokens only, without components: import '@morze/ui/tokens.css'.
In a Tailwind v4 host, import the kit into a layer. The kit ships plain,
unlayered CSS, and unlayered CSS beats layered CSS regardless of source order —
imported naively, .mz-btn--primary outranks every utility passed through
className:
/* Layer order first — @layer statements may precede @import. */
@layer theme, base, components, morze-ui, utilities;
@import 'tailwindcss';
@import '@morze/ui/styles.css' layer(morze-ui);The kit then wins over the host's preflight, and a className on a component
still wins over the kit. Note that cn is plain clsx, not tailwind-merge:
conflicting classes are not de-duplicated, they are resolved by that cascade.
Themes
Dark is the default, light is opt-in through an attribute (or the
.mz-theme-light / .mz-theme-dark classes if attributes are inconvenient):
<html data-mz-theme="light">MorzeThemeProvider does that for you, remembers the choice in localStorage
and understands system:
const { resolvedTheme, setTheme } = useMorzeTheme()
setTheme('light') // 'dark' | 'light' | 'system'The first render is always defaultTheme, so server and client markup agree
and hydration does not break; the stored and the system preference are applied
in a layout effect, before the mounted page paints. What the provider writes to
<html> is worked out from storage and matchMedia directly, so it never
passes through a dark guess on the way. Storage access is wrapped in
try/catch — with site data blocked the theme simply does not persist.
The page still paints once before the bundle runs. themeScript() is the
provider's own logic as an inline script for the head: same storage key, same
system resolution, same attribute, so a light-system user's first frame is
already light. Its entry has no "use client", so a server component can call
it:
import { themeScript } from '@morze/ui/theme-script'
<head>
<script dangerouslySetInnerHTML={{ __html: themeScript({ defaultTheme: 'system' }) }} />
</head>Pass it what you pass the provider (storageKey, defaultTheme, attribute).
The provider renders a wrapper with the mz-root class (background and text
colour from the tokens). By default data-mz-theme is written to <html>, so
portalled dialogs and menus follow the theme too. target="element" scopes the
theme to the wrapper instead.
An application that already has a theme switch drives the provider rather
than the other way round. A dark or light class on <html> — what
next-themes and Tailwind's class strategy write — selects the kit's palette
by itself, so next-themes' own pre-paint script already gets the first frame
right, and nothing has to copy its answer into data-mz-theme. Hand the
resolved theme to the provider so useMorzeTheme() agrees with it; given
theme, the provider keeps no state and touches no storage, and setTheme
only calls onThemeChange:
import { ThemeProvider, useTheme } from 'next-themes'
function KitTheme({ children }: { children: React.ReactNode }) {
const { resolvedTheme, setTheme } = useTheme()
return (
<MorzeThemeProvider
theme={resolvedTheme === 'light' ? 'light' : 'dark'}
onThemeChange={setTheme}
attribute="class"
>
{children}
</MorzeThemeProvider>
)
}
<ThemeProvider attribute="class"><KitTheme>…</KitTheme></ThemeProvider>attribute="class" makes the provider write the same class next-themes does
instead of data-mz-theme, so the two never disagree on <html>. It is also
the switch for a kit-owned theme in a Tailwind app: the provider's class is
what dark: utilities read. Only the root element is matched — .light
elsewhere in the page is somebody else's class.
Tones
Every active component accepts tone, which re-points the fill, the glow
and the focus ring:
<Button tone="accent">Save</Button>
<Switch tone="success" defaultChecked />
<Badge tone="danger">Live</Badge>
<Progress value={40} tone="warning" />primary (violet) · accent/success (emerald) · danger · warning ·
info. A tone is the --mz-tone custom property, so a one-off value works
too, in any colour syntax: style={{ '--mz-tone': '#ff6482' }}. Every glow,
wash and rim the kit draws in a tone is a color-mix() cut of that one colour.
Each tone also names two colours that go with it:
- the label on its fill,
--mz-<tone>-fg(read through--mz-tone-fg): white on a deep fill,--mz-on-fill— a near-black leaning the brand's way — on a light one. Every dark-theme fill is light, so dark labels throughout; in light, white on the violet and the red, dark on the emerald, amber and blue. - the tone as text,
--mz-<tone>-text(read through--mz-tone-text): a soft badge's label, an active tab, a link, an error line. A fill colour is not a text colour — the light emerald read 2.8:1 on white — so each one is cut darker (light) or lighter (dark) until it reads..mz-text-success….mz-text-infoput it on your own markup.
Every pair is held to WCAG AA (4.5:1) by tests/contrast.test.ts, resolved
from the tokens. A tone of your own sets --mz-tone-fg and --mz-tone-text
alongside --mz-tone; re-pointing a whole tone re-points its -fg and
-text with it, since only you know how light your colour is.
A sequential ramp for anything where colour means "how much" — a
heatmap, a cohort grid: --mz-seq-1 … --mz-seq-7 run from the card to the
brand in each theme, and --mz-seq-ink-1 … --mz-seq-ink-7 name the text
colour that reads on each step at 4.5:1.
<td style={{ background: `var(--mz-seq-${step})`, color: `var(--mz-seq-ink-${step})` }}>{value}</td>Re-skinning the kit is one colour per tone, per theme: --mz-primary,
--mz-accent, --mz-success, --mz-danger, --mz-warning, --mz-info, and
--mz-text for the text. A hex, an oklch(), or a var() of the
application's own tokens all work:
:root, .dark {
--mz-primary: var(--primary);
--mz-danger: var(--destructive);
--mz-text: var(--foreground);
}
.light {
--mz-primary: var(--primary);
/* … */
}The --mz-<tone>-rgb channel triplets (168, 124, 248) are where the kit
writes its defaults, and a theme that already sets them keeps working — the
colour is built from the triplet unless the colour is set itself.
Shape and type
The default shape is rectangular: one small radius for controls, a slightly larger one for surfaces.
| Token | Value | Used by |
| --- | --- | --- |
| --mz-radius-sm | 6px | items inside containers: menu items, tabs, checkbox |
| --mz-radius | 8px | buttons, inputs, select, toggles, badges, alerts |
| --mz-radius-lg | 12px | cards, dialogs, popovers, menus |
| --mz-radius-xl | --mz-radius-lg × 11/6 (22px) | large surfaces: the content panel beside the sidebar |
| --mz-radius-pill | 999px | only what is round by meaning: the radio and its mark |
Fully square corners: --mz-radius: 0; --mz-radius-sm: 0; --mz-radius-lg: 0.
The kit inherits your application's font. Every mz- element is
font-family: inherit, so a button, a table cell and a menu item read in the
same face as the text around them — the kit never renders a label in a font the
page does not use. Control labels are plain sentence case.
--mz-font-sans is the fallback, applied to .mz-root: 'Golos Text' (the
face morze.tech uses) with a system stack behind it. The main stylesheet
downloads nothing; the face ships with the kit, opt-in:
import '@morze/ui/fonts.css' // Golos Text, self-hosted: Latin and Cyrillic, 400–900It is one variable woff2 per script (about 100 kB together, each fetched only
when the page uses its characters), with font-display: swap, registered as
'Golos Text' so the token picks it up as is. The licence (SIL OFL 1.1) is in
dist/fonts/OFL.txt. Loading it from Google Fonts instead works the same way.
Without either, the browser falls back to whatever the OS has — Segoe UI, SF,
Noto Sans — and that face's digits decide whether a column of figures lines
up. MorzeThemeProvider says so once in the development console when the
first family in the stack is not available.
Set the font on body, not only inside the app shell: dialogs, menus and
tooltips are portalled to <body> and inherit from there.
Sizes come from a five-step scale, so a denser or a larger UI is one override rather than ninety, and your own headings can line up with the kit's:
| Step | Size / leading | Used by |
| --- | --- | --- |
| --mz-text-xs / --mz-leading-xs | 12 / 16 | hints, badges, counters, captions |
| --mz-text-sm / --mz-leading-sm | 13 / 18 | labels, table headers, menus, small controls |
| --mz-text-md / --mz-leading-md | 14 / 20 | body, fields, buttons, table cells |
| --mz-text-lg / --mz-leading-lg | 16 / 24 | large controls, card and popover titles |
| --mz-text-xl / --mz-leading-xl | 18 / 24 | dialog titles |
:root { --mz-text-md: 13px; --mz-text-sm: 12px; } /* one step denser */The leading is the kit's own, though: --mz-line (1.45) is applied at zero
specificity to every mz- element, so a landing-style line-height: 1.7 on
your body does not inflate a dialog description or a field hint. For the same
reason the kit zeroes the UA margins on the headings, paragraphs and lists it
renders itself — a host with no CSS reset used to get a dialog title pushed
14px away from its description. Your own markup inside a Card or Dialog is
untouched.
body { font-family: var(--mz-font-sans); }
:root {
--mz-primary: #785afa; /* brand colour */
--mz-font-sans: 'Inter', sans-serif; /* or your own face */
--mz-font-display: 'Unbounded', sans-serif; /* headings only */
--mz-radius: 4px; /* tighter */
}To bring back the landing's own look (pills plus mono caps):
:root {
--mz-radius-control: var(--mz-radius-pill);
--mz-label-font: 'JetBrains Mono', ui-monospace, monospace;
--mz-label-transform: uppercase;
--mz-label-tracking: 0.08em;
}Density
Every control shares one height scale, and the surfaces around them one spacing — so a dense app switches it once instead of mixing 34 and 40px controls in a toolbar:
<MorzeThemeProvider density="compact">…</MorzeThemeProvider>| Token | default | comfortable | compact |
| --- | --- | --- | --- |
| --mz-control-h-xs / -sm / --mz-control-h / -lg | 28 / 34 / 40 / 48 | 28 / 32 / 36 / 44 | 24 / 28 / 32 / 40 |
| --mz-row-h (DataTable normal) | 44 | 40 | 32 |
| --mz-nav-item-h (sidebar, navigation menu) | 36 | 36 | 32 |
| --mz-card-pad / --mz-card-gap | 20 / 18 | 16 / 16 | 12 / 12 |
Buttons, inputs, select-like triggers, toggles and tabs read the control
heights; a button's vertical padding is worked out from its step, so one line
still lands on it exactly and a wrapping label still grows it. The provider
writes data-mz-density where it writes the theme (<html>, or its wrapper
with target="element"); put the attribute on any element to scope a density
to part of the page. --mz-card-title-size and --mz-card-title-weight set
the card title. DataTable's own density prop still works on top of this.
States
Every control at rest belongs to one of three surfaces, and the hover belongs to the surface, not to the component. Which verb a control answers with is decided by what it looks like when nothing is happening to it:
| At rest | Hover | Press | Who |
| --- | --- | --- | --- |
| Filled — a tone fill | --mz-fill-hover | --mz-fill-press | primary / destructive button, toggle on, active tab, checked switch / checkbox / radio, sidebar active, selected day, solid badge |
| Raised — a neutral face | --mz-face-hover, rim unchanged | dip | secondary button, outline toggle, SelectTrigger, joined items, calendar nav |
| Flat — transparent | --mz-wash-hover | --mz-wash-press | ghost button, plain toggle, segmented item, menubar and nav triggers, sidebar item, every icon button |
:root {
--mz-hover-scale: 1.02; /* growth on hover */
--mz-press-scale: 0.98; /* dip on press — one depth for the whole kit */
--mz-hover-mix: 88%; /* fill colour: 88% tone + 12% black */
--mz-press-mix: 80%;
--mz-wash-hover: …; /* 8% of the ink: every flat control */
--mz-wash-press: …; /* 12% */
--mz-duration-fast: 0.15s; /* icon buttons, menu rows, the checkbox mark */
--mz-duration: 0.28s; /* anything with a face to repaint */
}Growth is a button's, not a group member's: a free-standing Button or
Toggle grows on hover; an item inside a segmented or joined ToggleGroup, or
a tab, does not — a swelling item climbs over the one beside it. One documented
exception runs the other way: the slider thumb grows under pressure, because
it is held rather than clicked and a cap that shrinks out from under the finger
reads as having slipped.
The glow under a filled control is one recipe in three sizes, by how big the lit thing is:
--mz-glow /* a control: button, toggle, tab, sidebar item */
--mz-glow-soft /* a small mark: checkbox, radio, switch, badge, a day */
--mz-glow-panel /* a floating surface: tooltip, alert, card hover */The tone fill is a flat colour (--mz-fill), so background-color animates
smoothly; the neutral face (--mz-face) is flat for the same reason. Both used
to be split into a colour under a fixed sheen purely because browsers cannot
interpolate a gradient — with the sweeps gone, so is the split. Darkening goes
through color-mix(); where that is unsupported the element simply does not
darken and everything else still works.
Only filled surfaces darken. Neutral variants (secondary, outline,
ghost) and unselected controls lighten instead — darkening would sink them
into the page.
Focus is two systems, deliberately: .mz-focusable draws an offset outline
on everything you press, and the fields (Input, Textarea, SelectTrigger)
draw a tone border plus a soft glow, with no outline. A field never wears both.
Customisation
The neutrals carry a whisper of the brand. Panels, inputs, table headers
and the sunken wells are a grey ramp with a few percent of --mz-tint mixed in
— three channel steps out of 255, enough that a surface is not flat cardboard,
not enough to name a colour. Dark runs the tint weaker than light (2.5% against
4%): there the brand is far lighter than the surfaces it sits in, so the same
percentage pulls a lot more hue. The tint follows --mz-primary, so the greys
move with the brand instead of keeping a violet cast that belongs to no one:
:root {
--mz-primary: #10af7a; /* panels and wells go faintly green */
--mz-tint-strength: 0%; /* …or take the hue out altogether */
--mz-tint: #808080; /* same thing, keeping the lightness */
}The grey under each mix is pre-compensated, so at the default strength the ramp
lands on the same lightness it would have with no tint at all; raising the
strength lifts the surfaces slightly. Text is deliberately left out: its
contrast is calibrated, and a saturated brand dragged through it costs more than
it buys. The tinted surfaces need color-mix() — Chrome 111+, Firefox 113+,
Safari 16.2+, the same baseline as the rest of the kit.
The page's own background — the ramp colour and the brand aurora above the
fold — is painted by .mz-root::before, a fixed layer under the content,
rather than by .mz-root itself. --mz-bg and --mz-halo are the knobs; a
host that would rather set background outright has to set it on the
pseudo-element.
Everything is driven by custom properties; override them after importing the
styles. The main groups: surfaces (--mz-bg, --mz-surface, --mz-elevated),
borders, text, tones and their label colours (--mz-*-fg), the convex recipe
(--mz-convex-*, --mz-face*, --mz-well*), the flat wash
(--mz-wash-hover, --mz-wash-press), the tone glow (--mz-glow,
--mz-glow-soft, --mz-glow-panel), the shared table header
(--mz-th-bg, --mz-th-color, --mz-th-font-size, --mz-row-hover,
--mz-row-selected), the glass layer (--mz-glass, --mz-glass-chrome,
--mz-glass-well, --mz-glass-filter, --mz-glass-sheen),
geometry (--mz-radius*), type (--mz-font-*, --mz-label-*),
motion and states (--mz-ease, --mz-duration, --mz-duration-fast,
--mz-hover-scale, --mz-press-scale, --mz-hover-mix, --mz-press-mix),
focus (--mz-ring-*).
Every token the kit publishes is a token the kit reads: --mz-bg-rgb,
--mz-surface-rgb, --mz-elevated-rgb, --mz-primary-soft and
--mz-primary-glow were declared and never used, so overriding them moved
nothing — they are gone as of 0.4. --mz-radius-xl went with them and came
back after 0.6.0 as a step the kit reads (the sidebar's content panel), derived
from --mz-radius-lg. --mz-face-fill and
--mz-face-fill-hover stay as deliberate aliases.
The full list lives in dist/morze-ui-tokens.css.
Surface classes
A few of the kit's classes are what an application reaches for when it builds a surface of its own — a search panel with its own animation, a trigger that has to read as a field. These are public API, like the tokens: a rename is a breaking change and is listed under Breaking in the changelog.
| Class | Helper | What it gives |
| --- | --- | --- |
| mz-panel | panelClass | the frosted floating surface of dialogs, menus and popovers |
| mz-dialog-overlay | overlayClass | the dialog backdrop: fixed, full viewport, the veil and its blur |
| mz-input (--sm, --lg) | inputVariants({ size }) | the field look, for an element that should read as an input |
| mz-focusable | — | the offset focus outline everything you press wears |
| mz-sr-only | — | visually hidden, still read |
| mz-text-<tone> | — | a tone as text that passes AA (primary, accent, success, danger, warning, info) |
Alongside them, buttonVariants / badgeVariants / toggleVariants put the
look of those components on any element, and the sidebar's helpers
(mz-sidebar-hide-collapsed, mz-sidebar-push, mz-sidebar-layout--grid)
are described under Sidebar.
import { inputVariants, panelClass, cn } from '@morze/ui'
// A popover trigger that looks like the field it stands in for.
<button className={cn(inputVariants(), 'mz-focusable')}>{summary}</button>
<div className={cn(panelClass, 'my-search-panel')}>…</div>Before composing a panel by hand, check DialogContent — position="top"
covers the usual reason for one (a search panel that grows downward).
Components
| Input and actions | Navigation | Output | Overlays |
| --- | --- | --- | --- |
| Button Toggle ToggleGroup | Tabs Accordion | Card Alert Badge | Dialog AlertDialog |
| Checkbox RadioGroup Switch | Sidebar Breadcrumb | Progress Avatar | DropdownMenu Menubar |
| Slider Input Textarea | Menubar NavigationMenu | Separator Skeleton Spinner | Popover Tooltip |
| Label Field Select | ScrollArea | Table Chart | Sheet Toast |
| Calendar DatePicker | | | |
| DateRangePicker DataTable | | | |
| Combobox MultiSelect | Collapsible | Empty Kbd | Command ContextMenu |
| NumberInput | | | |
| InlineEdit | PageHeader SectionHeader | Stat StatGroup Meter | InfoTip |
| | Pagination | StepIndicator ClampText | |
The API mirrors shadcn/ui: same names, same sub-component composition,
asChild, a data-slot on every part — so examples from the shadcn docs work
with barely any edits.
What this kit adds on top:
Button—variant:primary(default)secondaryoutlineghostdestructivelink;size:xs(28px)sm(34)md(40, default)lg(48) plus squareicon-xsicon-smiconicon-lg;loading,tone. Thesm/md/lgheights (34/40/48px) are shared by buttons, inputs and toggles, so controls line up in a row. WithasChildthe loading indicator is grafted inside the child element and the blocked state is expressed througharia-disabled, since a link has nodisabled. The heights are floors (min-heightplus vertical padding), sowrap— a label allowed to break over lines — grows the button instead of clipping it.Toggle/ToggleGroup—variant:defaultoutline;size:xs(28px)sm(34)md(40, default)lg(48), the same scale the buttons run on;tone.ToggleGroupalso takesappearance:segmented(a sunken well with the active item raised),joined(one continuous bar),spaced. The group'svariant,sizeandtoneare the default for every item in it, and an item that sets its own still wins:<ToggleGroup type="single" size="sm" appearance="joined" defaultValue="a"> <ToggleGroupItem value="a">A</ToggleGroupItem> <ToggleGroupItem value="b" size="lg">B</ToggleGroupItem> </ToggleGroup>TabsList—variant:default(well) orline(underline).Checkbox/Switch/Avatar/RadioGroupItem—size:smmdlg.Input/Textarea— the size prop isinputSize(smmdlg); the name differs from shadcn to avoid clashing with the nativesizeattribute on<input>.SelectTrigger—size:smmdlg, the same 34/40/48 scale, so a select stands in a row with aninputSize="lg"field.Dialog—size:sm(24rem)md(32, default)lg(44)xl(60)full;position:center(default) ortop. A top dialog is pinned--mz-dialog-top(16px) below the top edge and grows downward, which is what a search panel wants: centred, it jumps up and down as its results arrive. Focus trapping, Escape, the backdrop click andaria-modalare the same.Sheet—size:smmdlgxlfull(width on the side edges, height on the top and bottom ones), andSheetBodyfor the scrolling middle, with the padding the header and footer already had.Alert—live(defaultfalse).role="alert"interrupts a screen-reader user the moment the element renders, which is right for something that just happened and wrong for a banner that is part of the page. Turn it on for the former. (shadcn has the same problem and always sets the role.)SidebarProvider—shortcut(default'b', with Ctrl/⌘).nullgives Ctrl/⌘+B back to Firefox's bookmarks pane and to the editor's bold.ToggleGroupItem— its owntoneoverrides the group's, so one destructive item in a neutral bar is expressible.Progress—indeterminate: a travelling slice, and noaria-valuenowto claim a percentage nobody knows.Slider—aria-label/aria-labelledbyname the thumb, the element that is therole="slider";thumbLabelsnames each thumb of a range (['From', 'To']).AvatarGroup—max, which closes the stack with a "+N" chip.TableHead—sortable,sorted,onSort,sortLabel: the sort control the hand-laid table was missing, drawn the way the grid draws it, witharia-sortclaimed only where a column really sorts.DatePicker/DateRangePicker— theCalendarbehind a field, with the select trigger's own recipe for the trigger, a clear button,presetson the range, andtoISODate/fromISODatefor theYYYY-MM-DDa backend speaks.value={null}is a controlled empty field (undefinedleaves it uncontrolled), as onCombobox. The trigger is named by its date and its<label for>;aria-label/aria-labelledbyname a field with neither.<DateRangePicker value={range} onChange={setRange} locale="ru-RU" presets={[{ label: 'This month', range: { from: start, to: end } }]} />Combobox/MultiSelect— a searchable list on the same trigger, withoptionsfor a list you hold andloadOptionsfor one the backend filters. The async side debounces, waits forminChars, keeps the labels of values whose option the current answer no longer contains, and ignores an older request that answers after a newer one. The multi-select collapses its chips into "+N", takes All / None over what the search has narrowed to, and drops the last chip on Backspace in an empty box. An option'sgrouplists it under a heading — groups in the order their first option appears, a heading gone with its last match, the arrow keys walking the rows as drawn.<Combobox options={statuses} value={status} onChange={setStatus} /> <MultiSelect value={clientIds} onChange={setClientIds} loadOptions={async (q) => (await searchClients(q)).map(toOption)} minChars={2} maxChips={2} labels={combobox} />Command/CommandDialog— the ⌘K palette.CommandDialogbinds the shortcut itself (shortcut="k"by default,nullto own it), filters on each item'svalueplus itskeywords, hides a group whose items have all been filtered away, and runs the highlighted item on Enter through its own click — so an item wrapped in a link behaves like the link it is.position="top"keeps the search box still while the list under it changes height.<CommandDialog position="top"> <CommandInput placeholder="Type a command…" /> <CommandList> <CommandEmpty>Nothing matches</CommandEmpty> <CommandGroup heading="Orders"> <CommandItem value="New order" keywords={['create']} onSelect={run}> New order <CommandShortcut>⌘N</CommandShortcut> </CommandItem> </CommandGroup> </CommandList> </CommandDialog>ContextMenu— the right-click menu, with the same parts and the same trim asDropdownMenu.DataTable'sonRowContextMenufinally has somewhere to go.Collapsible— one fold on its own, animating on the accordion's own curve.NumberInput— a text field that knows it holds a number:inputMode,role="spinbutton"with its bounds, arrow keys (Shift for ten), steppers off the tab order, aunitinside the field, and a parser that takes a comma for a decimal point. Not<input type="number">, which spins under the scroll wheel, refuses that comma, and reports an empty string for anything it dislikes — so a host cannot tell "0,5" from "". Thousands are grouped the locale's way («1 200 000» for ru-RU; the tag comes fromlocaleorMorzeLocaleProvider), while typing and after, and the value stays a number;grouping={false}for codes and years. While the field is being edited the groups are spaces even where the locale writes commas, so nothing typed can be mistaken for one — and a comma in «1,5» is a decimal sign under any locale. A typed value outsidemin/maxsetsaria-invalidat once and callsonRangeChange('min' | 'max'), thenonRangeChange(false)once it is back; the field clamps it when left.Empty— the centred stack every list needs when it has nothing to show:Empty,EmptyMedia,EmptyTitle,EmptyDescription,EmptyActions.Kbd/KbdSequence— a key drawn as one.keys={['mod', 'k']}prints ⌘K on Apple hardware and Ctrl+K everywhere else, and reads the platform only after mount, so the server's markup and the client's first render agree.Card—interactiveadds the hover state; combined withonClickthe card also getsrole="button",tabIndexand Enter/Space activation.pressedmarks a chosen card — a filter, a segment — with the tone rim (andaria-pressedon a clickable one).asChilddraws the card onto its child, so a card that opens a page is the link itself:<Card interactive asChild><Link to="/orders">…</Link></Card>. A height set onCardContentis kept, so a chart in it has room.elevation:raised(a shadow and the top sheen) orflat(border and surface only). Left out, a card is flat insideSidebarPanel— the panel is raised already, and a shadow on every block in it is a third depth that means nothing — and raised everywhere else. Menus, popovers, dialogs and sheets keep theirs.Spinner—label(defaultLoading) is announced by screen readers;label={null}makes it purely decorative.Badge—variant:solidsoftoutline.Field/FieldHint/FieldError— form scaffolding.TabsList—overflow:wrap(default),scroll, ormenu, which collapses whatever does not fit into a trailing menu. See Tabs that run out of room.AlertDialogAction/AlertDialogCancel—variant,sizeandtonefromButton, so a destructive confirmation istone="danger".Table— brings its own horizontal scroll container, because a wide table otherwise scrolls the page instead of itself;containerRefhands that element back for a synchronised header or a virtualiser.pinnedon aTableHeadand its column'sTableCells keeps a row label at the start edge while the figures scroll under it, on an opaque ground (--mz-table-bg, the card's surface by default — set it to--mz-bgfor a table on the page) with a hairline seam once something is scrolled.ScrollArea— the kit's scrollbar in place of the platform's, so a pane looks scrollable on macOS too.viewportRefreaches the scrolling element. It is vertical unless told otherwise, and a vertical area holds its content to its own width, sotruncatein a list ends in "…" instead of widening the column.orientation="both"(or"horizontal") lets the content grow sideways and draws the horizontal bar; rendering a horizontalScrollBaramong the children still works and impliesboth.
<ToggleGroup type="single" defaultValue="week" appearance="segmented">
<ToggleGroupItem value="day">Day</ToggleGroupItem>
<ToggleGroupItem value="week">Week</ToggleGroupItem>
</ToggleGroup>Tabs that run out of room
overflow="menu" keeps a tab row on one line and folds the rest into a menu:
<TabsList overflow="menu" overflowLabel="More">
{sections.map((s) => <TabsTrigger key={s.id} value={s.id}>{s.name}</TabsTrigger>)}
</TabsList>Every trigger stays mounted inside the list — Radix wires them into one
roving-focus group and a trigger outside it throws — so the collapsed ones are
hidden rather than unmounted, which also takes them out of the tab order. The
button lights up when the selected tab is one of the hidden ones, so the row
never looks as if nothing is chosen. Widths are measured off a mirror row of
inert spans: a hidden trigger measures zero, and a second row of real triggers
would duplicate every value.
Figures and record fields
What a list page and a record card need around the table, from docs/gaps-erp-2026-11.md:
<PageHeader
title="Orders"
info="What the tabs hold and how they differ"
description="Customer orders, plans and purchases"
actions={<Button>Create</Button>}
/>
<Tabs defaultValue="orders">
<TabsList variant="line">
<TabsTrigger value="orders" count={18}>Orders</TabsTrigger>
<TabsTrigger value="plans" count={counting ? '…' : 5}>Plans</TabsTrigger>
</TabsList>
</Tabs>
<StatGroup aria-label="Order figures" minItemWidth={170}>
<Stat label="Open" value={18} />
<Stat
label="Overdue"
value={7}
tone="warning"
info="Deadline passed, not shipped"
selected={figure === 'late'}
onSelectedChange={(on) => setFigure(on ? 'late' : null)}
/>
</StatGroup>
<Input start={<SearchIcon />} placeholder="Search" />
<Pagination page={page} pageCount={pages} onPageChange={setPage} size="md" />Statis a figure; withonSelectedChangeit is a toggle (aria-pressed) with a check mark in its corner, for a figure that filters the list. The whole tile is the button and theInfoTipsits above it, so each takes its own clicks.hintis a line under the value,infohides behind «?»,tonecolours the value only,loadingshows a skeleton.InfoTip— the «?» button:type="button", a name (about="Overdue"reads "More info: Overdue"), keyboard focus,sizesmfor anxsline.Inputstart/end— an icon or a small button inside the field. With either, the field is wrapped in.mz-input-groupandclassNamegoes to the wrapper, which is what takes the width.Pagination— first, previous, "2 / 6", next, last;sizesmormd,edges={false}for just the arrows. Not tied toDataTable.Meter— a hairline share bar (role="meter") for a table cell:value,max,tone.Progressstays for work under way.StepIndicator— dots for a pipeline status:total, 0-basedcurrent,labelbeside them.InlineEdit— a record field that turns into a control:label,view,editor,onSave(a promise keeps it busy; a rejection keeps it open). Enter saves, Ctrl/⌘+Enter in a textarea, Escape cancels, focus returns to the pencil. The label is text and the pencil a separate button, and the edit row wraps inside its container instead of widening it.layoutplaces the parts:stack(default — a tile: label and pencil on top, value under),row(a property row: label at the start, value at the end, the pencil in a column of its own that a read-only row keeps, so values line up; width of the label column in--mz-inline-edit-label-w),inline(a word in a line of text, the label read but not shown) andlead(a headline figure with its label as a caption under it). Don't move the parts with your own CSS — pick the layout.ClampText—linesof text and "Show more" only when it overflows.PageHeader/SectionHeader—title,info,description,meta(badges by the title),actions(stay on the end edge when the row wraps),asfor the heading level.Avatarseed— initials coloured by a stable key (a login): one of eight--mz-avatar-1…8colours, each clearing 5:1 with white initials.
Figures on the start edge
numeric columns of DataTable and Table sit on the end edge. A product
that sets every column like text puts them on the start edge, digits still
tabular, with one attribute — on <html> for the whole app or on a container:
<html data-numeric-align="start">or the class .mz-numeric-start. An explicit align: 'right' is untouched.
A numeric DataTable column without align carries data-align="numeric".
Calendar
A month grid with no date library behind it. Names come from Intl, so a
locale tag is the whole of the localisation story.
<Calendar mode="single" selected={date} onSelect={setDate} locale="ru-RU" />
<Calendar
mode="range"
numberOfMonths={2}
selected={range}
onSelect={setRange}
disabled={{ before: new Date() }}
/>mode: single (clicking the chosen day clears it unless required),
multiple, range (the ends are ordered for you, and the span under the
pointer previews before you commit). disabled takes a Date, a Date[], a
{ from, to } span, an open { before, after } bound, or a predicate.
fromDate / toDate bound both selection and paging; captionLayout="dropdown"
swaps the caption for month and year selects; showWeekNumbers adds the ISO
column; weekStartsOn overrides what the locale says.
Six week rows are always drawn, so paging never resizes the popover it sits in.
Arrows move a day, Home/End a week, PageUp/PageDown a month, and exactly
one day is ever in the tab order.
Toast
Toaster mounts once; toast() is a plain function, callable from a fetch
handler or a store — the places a failure actually happens are rarely places
that can call a hook.
// once, at the root
<Toaster position="bottom-right" />
// anywhere
toast({ title: 'Saved', tone: 'success' })
const t = toast({ title: 'Uploading…', duration: Infinity })
t.update({ title: 'Uploaded', tone: 'success', duration: 4000 })
t.dismiss()Three live at once; beyond that the oldest is dropped, because a taller stack
is a log and nobody reads a log that is covering the page. useToast() returns
the same { toasts, toast, dismiss } for the rare case that needs to render
the queue itself.
Chart
The kit does not draw charts — it dresses them. ChartContainer publishes each
series colour as a CSS custom property scoped to itself, so any library that
takes a CSS colour can consume it, and the tooltip and legend read like the
rest of the interface.
const config = {
shipped: { label: 'Shipped', color: 'var(--mz-primary)' },
returned: { label: 'Returned', theme: { light: '#c2410c', dark: '#fb923c' } },
} satisfies ChartConfig
<ChartContainer config={config} className="h-64">
<ResponsiveContainer>
<BarChart data={rows}>
<Bar dataKey="shipped" fill="var(--color-shipped)" />
<Tooltip content={<ChartTooltipContent />} />
</BarChart>
</ResponsiveContainer>
</ChartContainer>The responsive wrapper stays yours: sizing belongs to the charting library, and a container that owned it would only ever work with one of them. Config values are validated before they are interpolated into the stylesheet — a config is data, and data ends up coming from a server.
ChartTooltipContent and ChartLegendContent take nameKey (and the tooltip
also labelKey) for the charts whose series key lives inside the datum
rather than in dataKey — a pie, where every slice comes from one series:
<Tooltip content={<ChartTooltipContent nameKey="material" hideLabel />} />A series drawn as a line keys as one: indicator: 'line' | 'dashed' (and
opacity) on its config entry draws a 12×2 stroke in its colour in both the
legend and the tooltip, so a compared period drawn dashed at half strength is
not a second identical dot:
const config = {
now: { label: 'This year', color: 'var(--mz-primary)', indicator: 'line' },
before: { label: 'Last year', color: 'var(--mz-primary)', indicator: 'dashed', opacity: 0.5 },
} satisfies ChartConfigChartTooltip and ChartLegend are not exported: they were only ever
recharts' own Tooltip and Legend, so import those from recharts directly.
Forms
React Hook Form bindings live behind their own entry point, because
react-hook-form is an optional peer dependency — an application that does
not use it should not carry it:
import { Form, FormField, FormItem, FormLabel, FormControl, FormMessage }
from '@morze/ui/form'
<Form {...form}>
<FormField
control={form.control}
name="email"
render={({ field }) => (
<FormItem>
<FormLabel>Email</FormLabel>
<FormControl><Input {...field} /></FormControl>
<FormMessage />
</FormItem>
)}
/>
</Form>What it adds over Field is the wiring nobody enjoys writing: one generated id
per field, htmlFor on the label, aria-describedby pointing at both the
description and the message, and aria-invalid flipped by the field's own
state. FormMessage renders nothing at all when there is no error, so a form
does not reserve a blank line under every input.
Without React Hook Form, Field / FieldHint / FieldError from the main
entry are the same layout with none of the binding.
The error state is aria-invalid="true", on every field the kit draws:
Input, Textarea, SelectTrigger, Combobox, MultiSelect, DatePicker
and DateRangePicker all turn their rim danger at rest and glow danger on
focus. The select-like fields forward aria-invalid and aria-describedby to
their trigger, so FormControl reaches them, and so does a hand-wired form:
<Combobox options={suppliers} aria-invalid={!supplier} aria-describedby="supplier-error" />
<FieldError id="supplier-error">Pick a supplier</FieldError>Sidebar
A navigation column: it collapses into an icon rail, turns into a sliding sheet on narrow screens and remembers its state between sessions.
<SidebarProvider>
<Sidebar collapsible="icon">
<SidebarHeader>
<Logo className="mz-sidebar-hide-collapsed" />
<b className="mz-sidebar-hide-collapsed">Morze ERP</b>
<SidebarTrigger className="mz-sidebar-push" />
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarGroupLabel>Work</SidebarGroupLabel>
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton isActive tooltip="Orders">
<OrdersIcon />
<span>Orders</span>
</SidebarMenuButton>
<SidebarMenuBadge>12</SidebarMenuBadge>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroup>
</SidebarContent>
<SidebarFooter>…</SidebarFooter>
</Sidebar>
<SidebarInset>
{/* the top bar stays on the page background, next to the navigation */}
<header>…</header>
<SidebarPanel>{children}</SidebarPanel>
</SidebarInset>
</SidebarProvider>Collapsing —
collapsible:icon(an icon rail, the default),offcanvas(slides away entirely),none. Toggled bySidebarTriggeror ⌘/Ctrl + B. There is also an optionalSidebarRail— an invisible strip along the panel edge that toggles it on click; it is not rendered by default, add it if you want that gesture.The rail hides labels; items with a
tooltipprop show theirs on the right instead. Anything that only makes sense at full width (a wordmark, a user name) is marked withmz-sidebar-hide-collapsed, otherwise the rail clips it. That class is declared with!important— it has to beat an inlinedisplayon a logo or an avatar. To push an element to the far end of the header usemz-sidebar-pushrather than an inlinemargin-left: auto: in the rail it switches off, otherwise the button drifts off the axis the menu items below sit on.Mobile — below
mobileBreakpoint(768px) the panel renders as aSheetover the content; a rail would eat what little width is left.State lives in
localStorage(storageKey,nulldisables it). The first render is alwaysdefaultOpenand the stored value lands in an effect, so SSR and hydration agree. It can also be driven from outside viaopen/onOpenChange.Variants —
variant:inset(default) — the navigation sits directly on the page background and the raised surface is the content insideSidebarPanel: only the corner facing the navigation is rounded, the other three sides are flush with the window, and the shadow is cast back towards the sidebar. Put the top bar and breadcrumbs inSidebarInsetabove the panel, not inside it.sidebar— the navigation gets its own surface and border.floating— the navigation lifts off the edge as a separate card.
The side is
side="left" | "right"(the panel's rounded corner mirrors itself). The panel's corner is--mz-radius-xl, so it follows the radius scale;--mz-sidebar-panel-radiusand--mz-sidebar-panel-padoverride the corner and the padding for the panel alone, and--mz-sidebar-panel-shadowits shadow (one near layer by default). Themz-sidebar-layout--gridclass onSidebarProvideradds a 48px grid to the background.
SidebarTrigger lives in the panel's own header: with collapsible="icon"
(the default) the sidebar never disappears completely — the rail stays, and so
does the button. Its icon says what a press does: a chevron folds an open
panel, a panel icon opens a collapsed one, and on a phone — where it is the
only way into the navigation — it is the menu. icon replaces all three.
The exception is mobile and offcanvas, where the panel leaves together
with everything inside it, so a second trigger is needed outside. To avoid two
buttons on desktop, render it conditionally:
function MobileTrigger() {
const { isMobile } = useSidebar()
return isMobile ? <SidebarTrigger /> : null
}The default height is 100dvh. When the sidebar lives inside a panel rather
than owning the page, set --mz-sidebar-h: 100% on SidebarProvider.
--mz-sidebar-width is the room the sidebar currently takes, for layout
outside it that has to line up with its edge — a fixed overlay, a sticky
scrollbar, a toast region: the full panel when expanded, the icon rail when
collapsed to one, 0px for a panel put away off-canvas or on mobile (plus the
16px of margin round a floating panel). It is set on SidebarProvider as an
expression over --mz-sidebar-w / --mz-sidebar-w-icon, so re-sizing the
panel moves it too, and on <html> as the resolved length for portalled
content:
.my-bottom-bar { position: fixed; left: var(--mz-sidebar-width, 0px); right: 0; }It changes at once, while the panel animates its width over --mz-duration;
add the same transition where the motion should match.
Sheet is exported separately — a dialog anchored to an edge of the screen
(side: top | right | bottom | left), and what the mobile sidebar uses.
DataTable
A table for server-driven data: it never sorts or filters anything itself, it collects state and hands it over as a single object. One user action, one request.
const { query, setQuery } = useTableQuery({
initial: { sort: [{ id: 'date', dir: 'desc' }], pageSize: 25 },
urlKey: 'orders.', // filters and sorting in the query string
})
const { rows, total, loading, error } = useOrders(query)
const columns: DataTableColumn<Order>[] = [
{ id: 'number', header: '#', width: 120, sortable: true, pinned: 'left',
cell: (row) => <b>{row.number}</b> },
{ id: 'client', header: 'Client', sortable: true,
filter: { type: 'select', options: clients } },
{ id: 'sum', header: 'Total', numeric: true, sortable: true,
accessor: (row) => formatMoney(row.sum),
filter: { type: 'number-range', step: 10_000 } },
]
<DataTable
columns={columns} data={rows} total={total} rowKey={(row) => row.id}
loading={loading} error={error}
query={query} onQueryChange={setQuery}
persistKey="orders" // column widths, order, visibility
maxHeight={560} // what makes stickyHeader work
search // the box lives in query.search
summary // totals row from column.footer
selection={selection} onSelectionChange={setSelection}
bulkActions={() => <Button size="sm">Export</Button>}
renderExpanded={(row) => <OrderDetails id={row.id} />}
/>What it does:
Sorting — a header click cycles
asc → desc → off, Shift adds the column to a composite sort (an ordered list reaches the backend).A height, or the header does not stick.
stickyHeaderis measured against the table's own scroller, so the scroller needs something to scroll within:maxHeight,height, orfillfor a table that should take the room its flex parent has. Without one the scroller grows with its content and never scrolls at all.Figures line up.
numeric: trueright-aligns a column and sets it in tabular digits; a right-aligned column gets the digits too. Golos Text, the kit's default face, has proportional digits, so without this a column only lined up where the OS fallback happened to be tabular. The plainTabletakesnumericonTableHeadandTableCell.frame—card(border, radius, shadow),flat(the same without the shadow) orplain(none of the three, for a table already inside aCard, where two frames doubled up). Left out, it isflatinsideSidebarPanelandcardelsewhere.Global search —
search(or{ placeholder, debounce }) puts a box in the toolbar whose value isquery.search. Because it is part of the query it resets the page, reaches the URL throughuseTableQueryasq, and arrives at the backend in the same request as the filters. A box wired in throughtoolbardoes none of those.Tree rows —
getSubRowsturns rows with rows of their own (a statement's groups and lines) into a tree: the first column steps in by depth, a group folds and unfolds from a toggle witharia-expanded, and a leaf keeps a spacer so a level lines up. Folding istreeExpanded/onTreeExpandedChange(open group keys) ordefaultTreeExpanded(keys, or'all'). The rows on screen are one flat list to everything else — the window, the grid keyboard, the page's selection — so the tree works with all of them.rowKeyhas to be unique across the whole tree.<DataTable rowKey={(r) => r.id} getSubRows={(r) => r.children} defaultTreeExpanded="all" … />Opening at the end —
initialScroll="end"opens a table wider than its box scrolled to its last columns (a statement with the latest month on the right), once, before it paints.scrollerRefhands over the scrolling element itself;.mz-dt__scrolleris an internal class, not API.A changed column set keeps your order — when
columnschanges (months instead of weeks), an order nobody touched follows the newcolumns; an order the reader changed or a saved layout restored is kept, and new columns join it beside their neighbours rather than at the end.Toolbar —
toolbarsits at the start of the row, after the search;toolbarEndat the end, before the Columns button — an export, a view switch.Glass is opt-in — the header, the summary row and pinned cells are solid (
--mz-surface-2).glassfrosts them over the rows passing behind; each frosted cell is a backdrop-filter layer, and a wide sticky table puts dozens on the page — with a moving chart tooltip beside it, Chromium stopped painting parts of the page.ChartTooltipContentis solid for the same reason and takesglasstoo.A summary row —
summary, with each column'sfooter(rows)filling its cell. It sticks to the bottom of the scroller, the way the header sticks to the top.Header filters —
text,select,number-range,date-range,boolean. A value is staged in the popover and committed on Apply: otherwise every keystroke would be a request. Active filters are echoed as chips above the table, written in the table'slocale— dates as the reader writes them, numbers grouped, a long value list closed with "+N".The controls say what they mean: a
multiple: falseselect and abooleanare radio groups, not checkboxes that behave like radios.texttakesops: ['contains', 'equals', 'startsWith']and sends the choice along asvalue.op;selecttakessearchableand offers All / None;number-rangedraws itsunitbeside both fields and in the chip;date-rangetakespresetsand puts the kit's ownCalendarunder the two typed fields, so the usual case is a locale-correct month grid rather than the browser's.By default a column's funnel appears under the pointer, under the keyboard, and stays put whenever that column is filtering — six identical funnels in a row are noise.
filterTrigger="always"shows them all.type: 'custom'renders a widget of your own in the same popover — an async multiselect, a range slider — and it takes part inquery.filterslike the built-in ones:filter: { type: 'custom', render: ({ value, commit }) => ( <ClientPicker selected={value as string[]} onPick={(ids, names) => commit(ids, names)} /> ), describe: (value) => `${(value as string[]).length} selected`, }The value reaches the backend untouched;
commit(value, label)applies and closes,onChangeonly stages.actions: falsedrops the Apply/Reset footer for a widget that commits itself.Default widths — columns stretch to fill the container, so there is no dead space at the right edge. The maths runs off the declared
widthvalues (they act as proportions), re-runs when the container resizes and always produces the same result for the same width — resizing the window back and forth does not drift the layout. When the declared widths do not fit, the columns give way in proportion, each down to itsminWidth— or, without one, to what its header needs to show its caption in full — and horizontal scrolling starts only past that.autoFit="grow-only"keeps the declared widths when they are too wide and scrolls;autoFit={false}turns fitting off, andflex: falseexempts one column (handy for narrow icon or action columns).minWidthandmaxWidthare honoured and the surplus is redistributed across the rest.Mouse resize — spreadsheet style: the column follows the cursor one to one, its neighbours do not move, spare space stays at the right, and the scrollbar appears when there is none left. Double-clicking the handle fits the column to its content; arrows on the focused handle resize from the keyboard. During a drag the width is written to a CSS custom property rather than to state — not a single row re-render per pixel of travel. A column touched by hand is excluded from auto-fit, so the next container resize cannot take the width away again; the Columns list grows an "auto width" button on exactly those columns to hand one back (
unsize(id)on the hook). Before it, the only way back was Reset, which also threw away the order, the pins and everything hidden.Pinned columns left and right, a sticky header, and a hairline on the seam between the pinned and scrolling parts.
Row selection — Shift selects a range, the header checkbox takes the page, and the floating bar can escalate to "all N matching" (in that mode a bulk action must travel with the query, not with a list of ids).
A thousand rows —
virtualizedraws only the rows in view plus a margin, so both the browser's layout and React's re-render are bounded by the viewport instead of by the result set. It needs the scroller to have a height, assumes the row height the density gives ({ rowHeight, overscan }overrides it), and steps aside while a detail panel is open — an expanded row is a row of a height the arithmetic does not know. Rows are not memoised instead: a column'scellis a fresh closure on every render of the host, so a memoised row re-renders anyway; drawing fewer of them is the fix that works.Right to left — the pins, the seam, the resize handle and the alignment are written as inline start and end, so an Arabic or Hebrew table pins its first column against the reader's own first edge and a drag towards the left widens a column rather than shrinking it.
pinned: 'left'keeps its name and means "the start".Columns — visibility, order (drag and drop plus arrows for the keyboard) and pinning; all of it saved to
localStorageunderpersistKey, stamped with a schema version so a future release drops a payload it cannot read rather than half-understanding it (a layout saved before versioning is adopted as-is — its shape is the current one). The list is grouped the way the table paints — pinned left, loose, pinned right — and a move stays inside its group, so what you drag is where it lands. A column whose header is a node rather than text is listed by position: “#3”.columnManager={false}drops the button for a layout the host fixes or drives itself; the layout props keep working without it.Only what the user changed outlives a release: a width they never dragged follows the column's declared
width, so a new width in code reaches every saved layout, and a column they unpinned is stored aspinned: { id: false }— JSON keepsfalsewhere it dropsundefined— so a column declared pinned stays unpinned after a reload. A host that keepsonLayoutChangein its own store gets the same shape.Past eight columns the list grows a search box, and show-all / hide-all act on whatever the search has narrowed to. Dragging is off while the list is filtered — a drop lands beside the row above it in the table, which in a filtered list is not the row above it on screen — and the arrows stay, since they name the neighbour they move past. The grip is also the touch handle: touch never fires a
dragstart, so reordering used to be mouse-only on the device most likely to be reading a table sideways.Expandable rows — uncontrolled by default, or driven from outside with
expanded/onExpandedChange/defaultExpanded.expandOnRowClickopens a row from anywhere on it, and the header carries an expand-all control.Inline cell editing on double click, with optimistic saving and a rollback on failure.
editable.canEdit(row)is the per-row veto — a closed period, a record someone else holds — and a refused save is rendered in the cell under anaria-liveregion, in both the text and the select editor, with what you typed still there to correct.Clicks belong to what you clicked.
onRowClickdoes not fire for a click that started on a link, button, field or menu item inside a cell, so a delete button no longer also opens the record behind its own confirmation dialog.onRowDoubleClickandonRowContextMenufollow the same rule.A keyboard, at two depths. A clickable row is a tab stop and answers Enter — always, since it changes nothing else.
keyboardgoes further and makes the body a grid: one roving tab stop over the cells, arrows to move it,Home/Endfor the row and Ctrl with them for the table,PageUp/PageDownby ten rows, Space to tick a row, Enter orF2to open an editable cell and Escape to leave it — which puts the focus back in the cell it came from, rather than at the top of the page. Enter on a cell with no editor does what a click on it does. It is opt-in because it changes the table's role fromtabletogrid, and a table that is only read is not a grid. Controls inside cells stay tabbable either way: a host's action buttons keep answering Tab exactly as before.States — skeletons on the first load, a thin progress line when refetching over data already on screen, an empty result and an error with a retry.
Density
compact | normal | relaxed.Row and column styling —
rowClassNametints a row by record state (a soft-deleted row painted red);rowPropsaddsdata-*,titleor a handler of your own; a column takesclassNameandheaderClassName. The table's own attributes win, so none of them can break selection or expansion.sortDescFirststarts an amount or date column at the big end, where the ascending first click was a wasted one.Assistive tech —
aria-busywhile a refetch replaces the rows,aria-rowcountover the whole result set witharia-rowindexcounting from the top of it rather than from the top of the page,aria-sortonly on the columns that sort, and the selection count in a live region.Load more instead of paging — pass
onLoadMoreand the pager is replaced by a footer inside the table's own scroller, so an endless scroll works from the inside (a host cannot bolt a sentinel onto a scroller it does not own).hasMoredefaults todata.length < total,autoLoadMore={false}waits for a click, andpaginationbrings the pager back if you want both. The table asks once per batch of rows: a host that answers with nothing new is not asked again, and a new query starts that count over. The callback is handed the page to fetch —onLoadMore({ nextPage })— so a host does not keep a counter of its own; the table cannot bumpquery.pageitself, because the pager owns that field.The pager adapts —
pageSizeOptions={false}, or a single option, hides the rows-per-page select for a backend that fixes the page size. While there is only one page it keeps the count ("1–3 of 3") and drops the page counter and the four buttons;pagination="always"keeps them.
Helpers for your own UI: useTableQuery, useSavedViews, useColumnLayout,
useRowSelection, plus the pure functions toggleSort, setFilter,
setSearch, serializeSort / parseSort.
useTableQuery mirrors the query into the address bar without disturbing it:
it writes only what differs from initial, keeps the router's history.state
across its own writes, and takes serializeFilters / parseFilters for a
compact URL — worth it on any table whose links get shared, and required for a
custom filter whose value JSON.stringify cannot express.
Cells already truncate: .mz-dt__cell is overflow: hidden; text-overflow:
ellipsis; white-space: nowrap. Carrying a className="block truncate" from a
shadcn table onto cell content is redundant — and a block-level child that
reflows during a render is exactly what used to feed the scroll observer into a
render loop (see FIXES.md).
A table stays a table: on narrow screens it scrolls horizontally with the first column pinned, it does not reflow into cards.
Localisation
Component strings default to English. Install a language once, at the root, and every widget under it — the table, the calendar and the date fields, the combobox, the toaster, the sidebar, the close buttons — reads its strings and its locale tag from there:
import { MorzeLocaleProvider } from '@morze/ui'
import ru from '@morze/ui/locales/ru'
<MorzeLocaleProvider locale={ru} tag="ru-RU">
<App />
</MorzeLocaleProvider>That includes the strings nobody sees until something goes wrong — the
combobox's loading and failure lines, the clear button's accessible name, the
calendar's month navigation — which a per-widget override of the visible words
used to leave in English. tag is the BCP 47 tag Calendar, the date fields
and DataTable format with. A component's own labels / locale props still
win, key by key; a provider inside another overrides only what it names;
without one, everything stays English. useMorzeLocale() hands the bundle and
tag in force to a widget of your own, and the two the kit's own widgets use
are exported too: useLocaleLabels('common', defaults, labels) merges one
section the same way — defaults, then the provider, then the widget's own
labels — and useLocaleTag(locale) is the widget's locale prop, else the
provider's tag.
Every string can also be replaced per instance.
Dialog/Sheet/Toaster take closeLabel, Spinner takes label, Sidebar
takes mobileTitle / mobileDescription, SidebarTrigger takes label,
Breadcrumb and BreadcrumbEllipsis take label, TabsList takes overflowLabel,
NumberInput takes labels and CommandDialog takes title / description.
Calendar reads its month, weekday and day names from Intl — a locale tag
is enough — and takes a partial labels object for the five strings Intl
cannot supply (the nav buttons, the caption selects, the week-number column).
DataTable has more strings
