Design principles
The principles tsumikit is built to serve, one file each. They distil Nielsen's usability heuristics, Laws of UX, Refactoring UI, Practical Typography, the Vercel and Rauno Freiberg web interface guidelines, WCAG 2.2 and Dieter Rams. Each file states the principle in one line, why it holds (with the source), do and don't lists, what the kit provides for it, and a check you can run on a screen.
They ship in the package: node_modules/@dorsk/tsumikit/principles/. Point a design review, or a coding agent, at them.
Designing a screen: the checklist
Run through this before calling a screen done. Each line points at the principle with the full check.
- The first viewport answers "what is this, what state is it in, what can I do". (28, 21)
- Exactly one filled button; no action bar wraps at 40rem. (02)
- Three text levels at most; muted text passes 4.5:1. (03)
- Every label left on screen is one the value could not do without. (04)
- All greys tinted, layers told apart by shade, borders faint. (05, 06)
- Accent only on primary, active, focus, selection; status colours paired with a cue. (07, 29)
- Every gap and padding is a scale step; gaps between groups are larger than within. (08, 09)
- Bundled typeface, scale sizes only, mono only for code-like text, lines 45 to 75 characters. (10, 11, 12)
- Images fade into the page, text over them sits on a scrim, missing images get a placeholder. (13)
- Every click changes something within 100 ms; spinners appear after 200 ms and stay 500 ms. (01, 14)
- Destructive actions have undo, or a confirm that names the loss. (15, 20)
- Empty, filtered-empty and failed states each have copy and an action; errors say what to do next. (16, 17)
- Labels and messages read like a person talking; the same thing is named the same everywhere. (18, 19)
- Filters, tabs, sort and page are in the URL; navigation is real anchors. (23, 24)
- Tab through the screen: focus is visible everywhere; targets are 24px / 44px. (25, 26)
- No
transition: all; reduced motion, zoom and paste all respected. (27) - Help text sits beside the thing it explains; shortcuts are visible. (30, 22)
Visibility of system status
Why
Nielsen heuristic 1: users forgive slowness but not silence; a button that goes quiet after a click gets clicked again or abandoned. The Doherty threshold adds the budget: below about 400 ms people stay in flow, above it they need visible progress.
Sources: https://www.nngroup.com/articles/ten-usability-heuristics/ , https://lawsofux.com/doherty-threshold/
Do
- Change the control the moment it is pressed: keep its label, add a busy indicator next to it.
- State the result in words ("Saved. 3 fields updated."), and offer the way back when there is one.
- Show progress for anything that can take more than a second; show how much is done if you know.
- Mark long-running background work somewhere persistent (a status bar, a queue count).
Don't
- Disable the button and show nothing else.
- Swap the label for a spinner, so the user forgets what they pressed.
- Report success only by closing the dialog.
In tsumikit
Buttonwithloading(true while pending,'done'for the confirmation tick) and thepending()helper withloadingDelay/loadingMinfor flicker-free timing.Spinner,Progress,SegmentedProgress,Skeletonfor in-place state;StatusBarfor persistent status.Toasterwithtoasts.info()/toasts.error()for outcome messages; errors use the assertive live region.- Motion tokens
--dur-fast,--dur-basekeep the acknowledgement under the 100 ms threshold.
Check
Click every action on the screen with the network throttled to "slow 3G". Within 100 ms something must change on or next to the control, and after completion the screen must say what happened.
One primary action per view
Why
Hick's law: decision time grows with the number and complexity of choices. Two filled buttons cancel each other out, and an action bar that wraps is a bar with too many actions.
Sources: https://lawsofux.com/hicks-law/ , Refactoring UI (hierarchy of actions) https://www.refactoringui.com/
Do
- Filled accent for the primary action, outlined for secondary, plain text or icon-only for tertiary.
- Move rare or destructive actions into an overflow menu.
- Keep the primary action visible in the first viewport.
Don't
- Fill two buttons in the same toolbar.
- Let an action bar wrap onto a second line.
- Give the primary slot to "Cancel" or "Back".
In tsumikit
Buttonvariant="primary"for the one filled button;variant="default"for secondary,variant="ghost"orIconButtonfor tertiary.SplitButtonwhen a primary action has variants;Menufor the overflow.Toolbarlays actions out with the shared control height.- Lint rule
one-primaryflags more than one primary button in a view.
Check
Count filled buttons in each viewport-sized region of the screen. The answer is one. Then shrink the window to 40rem: no action bar may wrap.
Emphasise by de-emphasising
Quarterly report
Shared with 4 people Edited yesterdayQuarterly report
Shared with 4 people
Edited yesterday
Why
Refactoring UI: hierarchy is built with weight and colour first, size last. When every element shouts, nothing does. Three text levels are enough for most screens: a title, values, labels.
Source: https://www.refactoringui.com/
Do
- Title: large and bold. Value: normal weight, full contrast. Label: small, muted.
- Lower the contrast of supporting text instead of raising the size of primary text.
- Keep muted text at or above 4.5:1 contrast; faint text is for placeholders and disabled states only.
Don't
- Use size alone to signal importance.
- Use four or more text styles on one card.
- Push secondary text so faint that it fails contrast.
In tsumikit
- Text colour levels:
--textfor values,--text-mutedfor labels (>= 4.5:1),--text-faintfor placeholder and disabled text only (~3:1). Headingfor titles;Textwithtone="muted"for labels andvariant="caption"for small supporting copy.- Weight tokens
--fw-normal,--fw-semibold,--fw-bold(--fw-mediumis a deprecated alias of semibold); size tokens--fs-xsto--fs-2xl. KeyValue,Metric,StatTilealready encode the title / value / label structure.
Check
Squint at the screen (or blur a screenshot). You should see one title, a few strong values, and quiet labels. Run a contrast check on muted text: 4.5:1 or better.
Labels are a last resort
Why
Refactoring UI: "Year: 2023" makes the eye scan words, "2023" alone reads as a fact. Labels at the same weight as values double the text and halve the information density.
Source: https://www.refactoringui.com/
Do
- Drop labels where the format is self-evident: years, file sizes, durations, email addresses.
- Fold the label into the value where it reads naturally ("3 files", "Korean audio").
- When a label stays, set it small, muted, often uppercase and tracked, with the value in full contrast.
- Lay out label and value pairs as a strip or grid that reads in one glance.
Don't
- Write "Label: value" lists in the same weight and colour.
- Separate related facts with " · " in a single run of text where a strip would scan faster.
In tsumikit
KeyValuerenders muted label and strong value;MetricandStatTilefor numeric facts.Textvariant="eyebrow"for small uppercase labels;tone="muted"for the label colour--text-muted.--font-labeland--font-numeric(default to sans; opt into mono for data-dense views).
Check
Read each label on the screen and ask whether the value would be ambiguous without it. Remove the ones that would not. Remaining labels must be visibly quieter than their values.
Tint your greys
Why
Refactoring UI: pure greys read as "admin panel". Saturating them a little, cool or warm, makes the palette feel intentional. Material's tonal surfaces follow the same idea: surfaces are tinted shades of one hue.
Sources: https://www.refactoringui.com/ , https://m3.material.io/foundations
Do
- Pick one hue for the whole neutral ramp and tint backgrounds, borders and muted text with it.
- Keep lightness steps the same as a neutral ramp; only the hue changes.
- Let the accent colour and the grey tint come from nearby hues so they agree.
Don't
- Use
#2a2a2a-style neutral hexes. - Mix cool greys in one component with warm greys in another.
- Hard-code any grey in a component; read it from the theme.
In tsumikit
- Theme ramps
--c-bg,--c-bg-elev,--c-bg-elev-2,--c-surface,--c-border,--c-text-muted,--c-text-faintare tinted per theme; components read the semantic aliases--bg,--bg-elevated,--bg-elevated-2,--surface,--border,--text-muted. ThemePickerandchooseTheme()switch the whole ramp at once;Swatchpreviews it.- Lint rule
no-raw-colorrejects hex or rgb literals in app styles.
Check
Sample three greys from a screenshot (background, card, border). Each must have non-zero saturation in HSL and the same hue family.
Depth from shade, not outlines
Why
Refactoring UI and Apple's dark-mode guidance: in dark themes the base is near black and each level above it is a few percent lighter. When every panel has a strong border, the borders become the loudest thing on the page and the content loses.
Sources: https://www.refactoringui.com/ , https://developer.apple.com/design/human-interface-guidelines/
Do
- Stack
--bg<--bg-elevated<--bg-elevated-2<--surfaceas you go up. - Use a single light direction for shadows and keep them soft.
- Reserve visible borders for inputs and for cases where two equal-lightness areas must be separated.
Don't
- Put a 1px solid border on every card, table and panel.
- Combine a strong border with a shadow on the same element.
- Lighten text and darken background in the same step; adjust one at a time.
In tsumikit
- Elevation tokens
--bg,--bg-elevated,--bg-elevated-2,--surface;--borderfor faint lines,--border-strongonly where needed. - Shadow tokens
--shadow-sm,--shadow-md,--shadow-lg. Cardreads surface fill and edge from--surface-fill/--surface-edge; look tokens--raised-fill,--overlay-fillcover popovers and menus.
Check
Desaturate a screenshot and count the borders. Each one should be doing something spacing or shade could not. Layers must still read as layers with all borders hidden.
One accent, used sparingly
Why
Von Restorff effect: the one item that differs is the one noticed and remembered. An accent used everywhere signals nothing. Separating accent from green, amber and red keeps "here" distinct from "ok", "warning", "error".
Source: https://lawsofux.com/von-restorff-effect/
Do
- Accent only on: the primary button, the active nav or tab, the focus ring, a selected row.
- Green, amber, red, blue only for semantic state; pair them with an icon or text.
- Keep counts, badges and chips neutral unless they carry state.
Don't
- Colour every nav item or badge with the accent.
- Pick an accent that resembles one of the status colours.
- Use colour as the only carrier of meaning.
In tsumikit
--accent,--accent-dim,--text-on-accentfor the single accent; themes keep the accent distinct from the status hues.- Status tokens
--ok,--warn,--danger,--info;Badge,Dot,Callouttake atoneand always pair colour with an icon or label. canonicalTone()normalises tone names so there is one vocabulary.- Lint rule
no-raw-colorkeeps app styles on these tokens.
Check
List every element using the accent colour. Each must be one of: primary action, active item, focus, selection. Then check every green, amber or red element has a non-colour cue beside it.
A spacing scale, and more room than feels right
Why
Refactoring UI: cramped layouts feel cheap even when every pixel is correct, and arbitrary gaps make a page look accidental. A scale (4, 8, 12, 16, 24, 32, 48, 64) with no in-between values keeps rhythm consistent without thought.
Source: https://www.refactoringui.com/
Do
- Use scale steps for padding, gaps and margins; jump a step rather than nudging by 2px.
- Give cards and sections generous inner padding (16 or 24), and larger gaps between sections than inside them.
- Align every element to an edge, grid or baseline that other elements also use.
Don't
- Use 10px, 14px, 18px or other off-scale values.
- Use the same gap everywhere; it flattens grouping (see "Group with space").
- Reach for
margin-top: 3pxto fix alignment; fix the line height or the scale step.
In tsumikit
- Spacing tokens
--sp-1(4px) through--sp-12(48px), with--sp-0-5(2px) for hairline adjustments only.--sp-1-5(6px) and--sp-5(20px) are deprecated: they still resolve, but sit off the scale. - Layouts
Stack,Cluster,AutoGrid,Containertake gaps from the scale;--content-maxcaps reading width. - Lint rule
spacing-scaleflags raw pixel spacing in app styles.
Check
Inspect padding and gap values on the screen; every one must be a scale step. Then double the main gaps in dev tools; if it looks better, the original was too tight.
Group with space, not boxes
Why
Gestalt laws of proximity and common region: things close together, or inside one region, are read as a group. Space between groups must be clearly larger than space within them, or the grouping disappears.
Sources: https://lawsofux.com/law-of-proximity/ , https://lawsofux.com/law-of-common-region/
Do
- Within a group: one small step (4 or 8). Between groups: at least two steps larger (24 or 32).
- Use a shared background tint to group without a border.
- Put a label or heading closer to the content it describes than to the content above it.
Don't
- Space twelve items evenly and expect the reader to find the four groups.
- Draw a border around each group when a gap would do.
- Let a section heading float equidistant between two sections.
In tsumikit
Stackwith a per-group gap and a larger gap between stacks;Clusterfor inline groups.CardandFieldsetfor common region;Divideronly when space cannot separate.SectionHeaderattaches a heading to the block that follows.- Spacing tokens
--sp-2,--sp-6,--sp-8give the within / between contrast.
Check
Blur a screenshot until text is unreadable. The groups you intended must still be visible as clusters. If you see one even grid, the gaps are too uniform.
A real typeface, a fixed scale
Why
Practical Typography and Refactoring UI: typography carries most of an interface. System font fallback changes the design per machine; a flat scale (heading same size as body) removes hierarchy. A typeface such as Inter, Geist or IBM Plex Sans is built for UI sizes.
Sources: https://practicaltypography.com/summary-of-key-rules.html , https://www.refactoringui.com/
Do
- Bundle the font files with the app; do not depend on the user having the face installed.
- Use the kit's type scale and at most two body weights plus one bold for titles.
- Tighten letter-spacing slightly on large headings; never on body text.
- Use real typographic characters: an ellipsis, en dash, multiplication sign, curly quotes.
Don't
- Set
font-family: system-uiand hope. - Introduce ad-hoc font sizes outside the scale.
- Use more than three weights on a page.
In tsumikit
- Inter bundled via
styles/font.css;--font-sansis the default stack,--font-monofor code. - Type scale
--fs-xs(12),--fs-sm(13),--fs-base(15),--fs-lg(18),--fs-xl(22),--fs-2xl(28), scaled by--fs-scale(seeFontScalePicker) and rounded to whole pixels;--fs-2xs,--fs-mdand--fs-3xlare deprecated aliases of xs, base and 2xl. - Weights
--fw-normal(400) and--fw-semibold(600) for body and controls,--fw-bold(700) for titles;--fw-mediumis deprecated and resolves to 600; line heights--lh-heading,--lh-normal. HeadingandTextcover titles, body, labels, captions and eyebrows.- Lint rule
no-raw-fontflags font-family or font-size literals in app styles.
Check
Open dev tools on headings and body and list the font sizes in use. They must all be scale steps and the rendered family must be the bundled one, not a fallback. Count the weights: three at most.
Monospace only for code
Why
Practical Typography: monospace is slower to read and takes more width per character. Set as prose or labels it makes an interface feel like a terminal and wastes space; set on genuine code it signals "copy this exactly".
Source: https://practicaltypography.com/summary-of-key-rules.html
Do
- Mono for file paths, commit hashes, IDs, shell commands and code blocks.
- Sans for labels, nav, buttons, descriptions, timestamps and numbers in running text.
- Tabular numerals (
font-variant-numeric: tabular-nums) in tables and stats so columns line up without going mono.
Don't
- Set a whole sidebar or label system in mono.
- Use mono for numbers only to align them.
- Mix two mono faces.
In tsumikit
--font-monois only applied in code slots;--font-numericand--font-labeldefault to sans and can be switched to mono per app.Textvariant="code",CodeBlock,Kbd,WorkingDir,GitRefare the mono components.ProseandrenderMarkdown()set inline code in mono and prose in sans.
Check
Select all monospace text on the screen. For each run ask: would a user copy this character by character? If not, it should be sans.
Keep lines between 45 and 75 characters
Why
Practical Typography: lines shorter than about 45 characters break the rhythm; longer than about 75, the eye loses its place on the return sweep. Line length matters more than font size for reading comfort.
Source: https://practicaltypography.com/summary-of-key-rules.html
Do
- Cap reading columns with a max width in
chorrem, independent of the viewport. - Raise line height slightly as lines get longer.
- On wide screens, add columns or margins rather than stretching the text.
Don't
- Let descriptions, prose or form help text run the full width of a 1600px window.
- Shrink the font to make long lines fit.
In tsumikit
--measuresets the default reading width;--content-maxcaps page content.ProseandEmptyStatedescriptions are measure-limited;Containerconstrains layouts.- Line-height tokens
--lh-normal,--lh-snug.
Check
Count characters on a full line of body text at the widest supported viewport. Between 45 and 75.
Let imagery set the mood, keep the chrome quiet
Why
Aesthetic-usability effect: interfaces perceived as beautiful are perceived as easier to use and are forgiven more. A backdrop fading into the page does more than any amount of styled chrome. An empty grey box where an image should be breaks the spell instantly.
Sources: https://lawsofux.com/aesthetic-usability-effect/ , https://www.refactoringui.com/
Do
- Lead detail pages with a backdrop or hero image that fades into the page background.
- Place text over images only on a gradient scrim that guarantees contrast.
- Generate a placeholder from the item itself (initials, a hue derived from its name) when the image is missing or still loading.
- Give every meaningful image alt text; decorative images get an empty alt.
Don't
- Compete with the image using coloured chrome or heavy borders.
- Render white text directly on an unpredictable photo.
- Show an empty or broken-image box, even briefly.
In tsumikit
Backdroplayout for the hero-with-fade;Scrimfor readable text over images.Artworkshows a designed placeholder while loading or missing, viaartworkGradient(),artworkHue()andinitials();Avatardoes the same for people.Skeletonfor placeholders that are shapes rather than pictures.- Lint rule
img-altrequires alt text on images.
Check
Load the page with images blocked. Every image slot must still show an intentional placeholder. Then re-enable images and verify text over them passes 4.5:1 at its lightest point.
Feedback is instant and calm
Why
Doherty threshold: under about 400 ms people stay in flow. A spinner that flashes for 50 ms makes a fast response feel broken; one that never appears makes a slow response feel dead. Optimistic updates keep the interface at the user's pace, with rollback as the safety net.
Sources: https://lawsofux.com/doherty-threshold/ , https://vercel.com/design/guidelines
Do
- Wait about 200 ms before showing a loading indicator, then keep it for at least 500 ms.
- Apply likely-to-succeed changes immediately and roll back with a message on failure.
- Keep layout stable while loading: reserve space with skeletons, never shift content.
- Prefer in-place indicators over page-level overlays.
Don't
- Show a spinner on every click regardless of duration.
- Block the whole page for a single row's update.
- Animate the loading state so much that it draws more attention than the content.
In tsumikit
pending()helper andButtonloadingDelay/loadingMinimplement the 200 ms / 500 ms rule;loading="done"shows the confirmation tick.Skeleton,Spinner,Progress,LoadMorefor in-place loading.toasts.error()with an action for rollback messages;toasts.undo()for reversible changes.- Motion tokens
--dur-fast,--dur-base,--ease-outkeep transitions short.
Check
Throttle to a fast connection: no spinner should be visible at all. Throttle to slow 3G: a spinner appears once, stays at least half a second, and nothing on the page shifts when the data lands.
Prefer undo over confirmation
Archive this message?
Why
Nielsen heuristic 3, user control and freedom: people need a clearly marked emergency exit. Confirmation dialogs are read once and then clicked through by habit, so they stop protecting anyone; undo protects every time.
Sources: https://www.nngroup.com/articles/ten-usability-heuristics/ , https://vercel.com/design/guidelines
Do
- Perform the action, then show "Moved to trash. Undo" for a few seconds.
- Keep a confirm dialog only for truly irreversible or expensive actions (delete an account, send to many people), and name the consequence in the button ("Delete 12 files").
- Make Escape, Back and Cancel always available and always do what they say.
Don't
- Ask "Are you sure?" with generic OK / Cancel buttons.
- Trap the user in a flow with no way out.
- Make Undo appear only in a hidden menu.
In tsumikit
toasts.undo()for the reversible pattern;Toasterrenders the action and keeps it keyboard-reachable.ConfirmModalfor the remaining irreversible cases, with a labelled destructiveButtonvariant="danger".SwipeRowexposes undoable row actions on touch.
Check
Perform each destructive action on the screen. Either an undo appears for it, or a confirm names exactly what will be lost. "Are you sure?" with OK / Cancel is a failure.
Empty states are design too
No projects yet
Projects group your tasks and files. Create the first one to get started.
Why
Nielsen heuristic 6, recognition over recall, and heuristic 10, help where it is needed: the first screen a new user sees is usually empty, and a blank area makes them guess whether something is broken or missing. The empty state is the onboarding.
Source: https://www.nngroup.com/articles/ten-usability-heuristics/
Do
- Say what goes here in one sentence, in the user's words.
- Offer the one action that fills it as the primary button.
- Distinguish "nothing yet", "nothing matches your filter" and "failed to load"; each gets its own copy and action.
- Keep the layout stable: the empty state occupies the same region the content will.
Don't
- Render an empty table header with no rows and no message.
- Show "No data" with no action.
- Use the same empty state for a filtered-to-nothing result as for a fresh account.
In tsumikit
EmptyStatewithtitle,description,actionLabelandonAction(or anactionsnippet for several).Iconfor the illustration slot;Calloutfor the failed-to-load variant with a retry action.FilterInputandFilterSearchBargive a "clear filters" path for the filtered-empty case.
Check
Reach every list and table on the screen in three states: new account, filter with no match, load failure. Each must show a message and an action that makes sense for that state.
Errors say what happened and what to do next
We couldn't load your projects
The connection dropped before the list arrived. Your work is safe.
Why
Nielsen heuristic 9: help users recognise, diagnose and recover from errors. "Request failed with status code 500" tells the user nothing they can act on; "Couldn't reach the indexer. It timed out after 30 s. Check that it's running, then retry." tells them everything.
Source: https://www.nngroup.com/articles/ten-usability-heuristics/
Do
- Lead with what the user wanted and could not get ("Couldn't save the profile").
- Add the cause in one short clause when you know it.
- Offer a concrete recovery: retry, edit the field, open settings.
- Place field errors next to the field and mark the field itself.
Don't
- Surface raw exception text, status codes or stack traces.
- Blame the user ("Invalid input").
- Show the error in a place the user is no longer looking at.
In tsumikit
Callouttone="error"for inline errors with an action;toasts.error()with an action for transient ones (assertive live region).Fieldshows a field-level error next to its control and links it witharia-describedby.- Status colour
--dangeralways paired with the error icon and text.
Check
Trigger each failure path on the screen (offline, bad input, server error). Every message must be understandable by someone who does not know what HTTP is, and must contain a next step.
Speak the user's language
Why
Nielsen heuristic 2: match between the system and the real world. Users should not have to translate "entity", "node" or "sync job" into the things they actually own. Natural ordering (recent first, alphabetical) and familiar formats (relative time, local units) reduce effort.
Source: https://www.nngroup.com/articles/ten-usability-heuristics/
Do
- Name things what users call them (a "film", not a "media item"; "folder", not "root path").
- Format dates and durations the way people say them ("2 hours ago", "1 h 42 min").
- Order lists the way users scan them, and say what the order is.
- Use icons whose meaning is already established; add a label where it is not.
Don't
- Expose database field names, enum values or internal IDs as labels.
- Show ISO timestamps where a relative time would do.
- Invent a new icon for a familiar action.
In tsumikit
Timestamp,relativeTime()andformatTimestamp()for human time;TimeDisplay,formatMediaTime()for durations.formatCount()for counts with sensible rounding;Truncatekeeps long paths readable.Iconships a conventional icon set;Tooltipadds a label where meaning is not obvious.
Check
Read every label and message aloud as if to a friend who does not know the codebase. Any word you would have to explain is a label to change.
Consistency beats local cleverness
Why
Nielsen heuristic 4 and Jakob's law: users spend most of their time in other applications and bring those expectations with them. Every local deviation is something to learn, and every inconsistency is a moment of doubt.
Sources: https://www.nngroup.com/articles/ten-usability-heuristics/ , https://lawsofux.com/jakobs-law/
Do
- Reuse the kit component for a job rather than restyling a near copy.
- Keep one vocabulary: the same action has the same label and icon on every screen.
- Follow platform conventions for selection, navigation, keyboard shortcuts and dialogs.
- Put the same things in the same place on every page.
Don't
- Build a one-off button, input or table because the kit's was "almost right".
- Use "Remove" here and "Delete" there for the same action.
- Change the primary button's position between pages.
In tsumikit
- Atoms are the only place raw controls live; molecules compose them. Lint rule
no-raw-controlflags rawbutton,inputandselectin app code. - Theme and look tokens (
--r-control,--control-height,--btn-fill) make every control share shape and size. canonicalTone()and theTonevocabulary unify status naming across components.- Lint rule
breakpointskeeps media queries on the shared 40rem / 48rem / 64rem steps.
Check
Take screenshots of the same component type across three pages and lay them side by side. They must be indistinguishable in shape, size and behaviour.
Prevent errors before reporting them
Why
Nielsen heuristic 5: a careful design that prevents a problem is better than a good error message. Slips (wrong button) and mistakes (wrong mental model) have different cures: constraints and defaults for slips, previews and plain language for mistakes.
Source: https://www.nngroup.com/articles/ten-usability-heuristics/
Do
- Use the control that only allows valid values: a select, a slider, a date picker, a segmented choice.
- Validate as the user leaves a field, not after they submit the form.
- Separate destructive actions from frequent ones in space and style.
- Default to the safe choice; show the effect of a setting next to it.
Don't
- Accept free text where the set of valid answers is known.
- Place "Delete" next to "Save" in the same style.
- Validate everything only on submit and then scroll the user to the top.
In tsumikit
Select,RichSelect,Combobox,Slider,SegmentedControl,RadioGroup,Switchconstrain input.Fieldattaches help text and inline validation;Fieldsetgroups related choices.Buttonvariant="danger"plus distance in aToolbarkeeps destructive actions apart;ConfirmModalfor the truly irreversible.
Check
For each input on the screen, try to enter something invalid. The control should refuse or flag it before submit. For each destructive action, check it cannot be hit by a slip from a neighbouring frequent action.
Recognition over recall
Why
Nielsen heuristic 6 and Miller's law: working memory is small. Visible choices, remembered recent inputs and persistent context (where am I, what is selected) reduce the load; anything a user must remember from a previous screen is a defect.
Sources: https://www.nngroup.com/articles/ten-usability-heuristics/ , https://lawsofux.com/millers-law/
Do
- Show where the user is: breadcrumbs, active nav, page title.
- Offer suggestions and recent values in inputs instead of requiring exact syntax.
- Keep the selection visible while acting on it (toolbar shows "3 selected").
- Reveal keyboard shortcuts next to the actions they trigger.
Don't
- Require typed identifiers the user saw on another page.
- Hide the current filter behind a closed panel with no summary.
- Show a modal that covers the data it asks about.
In tsumikit
Breadcrumb,NavBar,TabBarandTabsshow current location;SectionHeadernames the block.Combobox,FilterInputandsuggest()surface valid values while typing.KbdandTooltipshow shortcuts in place;PopoverandDrawerreveal detail without hiding context.
Check
Open any page cold. Can you tell where you are, what is selected and what filters apply without clicking anything? Then try each input without reading docs: valid values must be discoverable from the control itself.
Shortcuts for the experienced, defaults for the rest
Why
Nielsen heuristic 7, flexibility and efficiency of use: the same interface serves first-time and expert users. Experts want fewer steps; novices want fewer choices. Shortcuts layered on top of a simple default serve both.
Source: https://www.nngroup.com/articles/ten-usability-heuristics/
Do
- Add keyboard shortcuts for the top actions and show them in tooltips and menus.
- Allow bulk selection and bulk actions on lists.
- Let filters, sort and views be saved or shared via the URL.
- Support paste, drag and drop and type-ahead wherever they make sense.
Don't
- Make shortcuts the only way to do something.
- Override browser or OS shortcuts.
- Hide bulk actions until a user discovers multi-select by accident.
In tsumikit
Kbdto display shortcuts;Menuitems show them inline;Tooltipfor hover hints.FilterInputwith thefiltersquery grammar for saved, shareable filters;urlState()keeps them in the URL.Dropzone,FileButtonandComposerfor drag, drop and paste;SortableListfor keyboard-reorderable lists.
Check
Do the three most frequent tasks on the screen without a mouse. Each should take fewer keystrokes than clicks. The shortcuts must be visible somewhere on the screen.
The URL is state
Why
Vercel and Rauno Freiberg interface guidelines: a view a user cannot link to or return to is lost work. Back must restore both the view and its scroll position; a pasted link must open the same thing the sender saw.
Sources: https://vercel.com/design/guidelines , https://interfaces.rauno.me/
Do
- Encode the active tab, filter query, sort column and page in the query string or path.
- Restore scroll position on Back and Forward.
- Make the active state of tabs and segments come from the URL, not from component memory.
- Use
replaceStatefor typed-ahead changes andpushStatefor navigational ones.
Don't
- Keep tab or filter state only in a store that resets on refresh.
- Reset to page 1 and clear filters when the user presses Back.
- Encode state that is not shareable (a hover, an open menu).
In tsumikit
urlState()binds a value to a query parameter.Tabs,SegmentedControlandPaginationaccepthrefper item so the active state is a real link.FilterInputwithserialize()andparse()round-trips filter queries through the URL.
Check
Set a filter, switch a tab, go to page 3, then refresh and press Back twice. Every step must restore exactly what was on screen, and the URL at each step must open the same view in a new window.
Links are links, buttons are buttons
Why
Vercel and Rauno Freiberg interface guidelines, and Nielsen heuristic 4: users expect anything that navigates to behave like a link. A div with an onclick breaks the context menu, accessibility and the ability to open several things at once.
Sources: https://vercel.com/design/guidelines , https://interfaces.rauno.me/
Do
<a href>for anything that changes the URL;<button>for anything that does not.- Style a link as a button when needed, but keep the anchor element.
- Make whole cards clickable with a single anchor, not a click handler on the container.
- Mark external links and give them accessible names.
Don't
- Attach
onclicknavigation to adiv,spanor card. - Use a button for "View details" that only navigates.
- Nest interactive elements inside the link.
In tsumikit
Linkfor text links and button-styled links;Cardrenders an anchor when givenhref.NavItem,TabBar,Breadcrumb,Pagination,Tabs,SegmentedControltakehrefand render real anchors.AnchorAttributestype carries the anchor props through.
Check
Middle-click every navigational element on the screen. Each must open in a new tab. Right-click them: "Copy link address" must be present.
Every control shows a visible focus ring
Why
WCAG 2.2 (2.4.7 focus visible, 2.4.11 focus not obscured) and the Vercel interface guidelines: keyboard users navigate by watching focus. Removing the outline without a replacement strands them. :focus-visible shows the ring only for keyboard focus, so pointer users are not bothered.
Sources: https://www.w3.org/WAI/WCAG22/quickref/ , https://vercel.com/design/guidelines
Do
- Use
:focus-visiblewith an accent ring at least 2px wide and an offset. - Keep focus order the same as visual order.
- Move focus into dialogs on open and back to the trigger on close.
- Make the ring visible on dark and light surfaces and inside scroll containers.
Don't
- Write
outline: nonewithout a replacement. - Rely on a colour change alone to show focus.
- Let focus disappear behind a sticky header or an overlay.
In tsumikit
--focus-ring,--focus-ring-width,--focus-ring-offset,--focus-ring-offset-insettokens; every atom applies them under:focus-visible.Modal,Drawer,Menu,Popovermanage focus trapping and return.- Roving focus for
Toolbar,RadioGroup,Tabs,Menu. - Dev-audit warnings flag unlabelled controls (
warnUnlabelled()).
Check
Tab through the entire screen from the address bar. At every stop you must see where focus is, in the order you expected, and nothing must be skipped or trapped.
Generous targets
Why
Fitts's law: time to hit a target depends on its size and distance; frequent targets should be big and close. WCAG 2.2 (2.5.8) sets the 24px minimum, mobile platform guidance sets 44px. Gaps between adjacent targets prevent mis-taps.
Sources: https://lawsofux.com/fittss-law/ , https://www.w3.org/WAI/WCAG22/quickref/
Do
- Make the whole row or card the target, not just the text inside it.
- Pad icon buttons to the touch size even when the icon is small.
- Put frequent actions near where the pointer or thumb already is.
- Leave at least 8px between adjacent targets.
Don't
- Ship 16px icon buttons with no padding.
- Make the hit area smaller than the visible shape.
- Place a destructive action within thumb reach of a frequent one on mobile.
In tsumikit
--touch-target(44px) and--touch-target-compact(40px, 44px on coarse pointers); on coarse pointers md controls and boxes are 44px;--control-heightvariants for desktop density.--hit-target(24px,--touch-targeton coarse pointers) and--hit-slab: small controls (inline IconButton, link Button, bare Popover/Menu triggers, Badge action, Switch, Toggle, Checkbox) grow an invisible slab up to it without moving layout;hitArea="compact"opts out.IconButtonandButtonpad to the target size;TabBarandSwipeRoware built for thumbs.AppShellplaces primary navigation at the bottom on narrow screens.
Check
Overlay 44px squares on a phone screenshot and 24px on a desktop one. Every interactive element must contain one. Tap between two neighbouring targets: one of them must respond, never neither.
Cheap motion, respected preferences
Why
Vercel and Rauno Freiberg interface guidelines: transform and opacity run on the compositor; animating layout properties janks. transition: all animates things you did not intend. Users who set reduced motion, zoom text or paste passwords are telling you something; blocking them is hostile.
Sources: https://vercel.com/design/guidelines , https://interfaces.rauno.me/ , https://www.w3.org/WAI/WCAG22/quickref/
Do
- Transition
transformandopacity; keep enter around 180 ms and exit shorter. - Wrap decorative motion in
prefers-reduced-motion: no-preference, or reduce to a fade. - Allow pinch and text zoom; never set
user-scalable=no. - Allow paste in every input, including password and code fields.
Don't
- Write
transition: all. - Animate
height,width,topormargin. - Run looping animations the user cannot stop.
- Disable autocomplete or paste "for security".
In tsumikit
- Duration tokens
--dur-fast,--dur-base,--dur-slow,--dur-exit; easing--ease-out,--ease-spring; press and shift scales--press-scale,--shift-sm. - The reset collapses motion under
prefers-reduced-motion: reduce;MotionSettingslets users choose in-app. - Lint rule
motionflagstransition: alland layout-property animations.
Check
Enable "reduce motion" in the OS and reload: nothing should move except opacity. Record a performance profile while opening a menu: no layout thrash. Zoom to 200%: everything still usable.
Less, but better
Why
Dieter Rams's tenth principle, "good design is as little design as possible", and Nielsen heuristic 8, aesthetic and minimalist design: every extra element competes with the ones that matter. Restraint is what makes the remaining elements legible.
Sources: https://www.vitsoe.com/us/about/good-design , https://www.nngroup.com/articles/ten-usability-heuristics/
Do
- Remove decoration that carries no information: borders, icons next to every label, redundant titles.
- Say things once; a page title does not need to be repeated in a breadcrumb and a heading.
- Prefer the plain version of a component until the richer one is justified.
- Review each screen by deleting elements one at a time and asking what was lost.
Don't
- Add an icon to every button and a badge to every row.
- Show every field the backend has.
- Keep a feature on screen because it was expensive to build.
In tsumikit
- Components default to the quiet form (
Buttonvariant="default",Cardwithout border,Textbody) and take opt-in props for emphasis. - Looks and micro-interactions are opt-in via
parseLook()andLookPicker, not applied by default. - Dev-audit warnings surface redundancy such as duplicate primaries and unlabelled controls.
Check
For each element on the screen, hide it in dev tools. If the screen still answers "what is this, what state is it in, what can I do", the element was decoration.
Colour is never the only cue
Why
WCAG 1.4.1 (use of colour): about one in twelve men cannot reliably distinguish red from green. A dot that is green or red is a dot. Pairing colour with text or an icon also helps everyone in bad light or on a poor display.
Source: https://www.w3.org/WAI/WCAG22/quickref/
Do
- Pair every status colour with a word or an icon ("Failed", a cross).
- Use shape or position as well as colour in charts and legends.
- Underline or otherwise mark links in running text.
- Test with a colour-blind-safe theme or a simulator.
Don't
- Show a bare coloured dot as the only indicator of health.
- Distinguish chart series by hue alone.
- Mark required fields by colour only.
In tsumikit
Badge,Dot,Callout,Gauge,Metertake atoneand render an icon or label alongside the colour.CapBarandSegmentedProgresscarry a legend;Swatchlabels colours.- A verified colour-blind-safe theme (Okabe-Ito) is available through
ThemePicker.
Check
Switch to the colour-blind-safe theme or apply a greyscale filter to a screenshot. Every state that was visible before must still be identifiable.
Help where it is needed
Why
Nielsen heuristic 10: the best interface needs no documentation, but when help is needed it should be in context, searchable, focused on the task and concise. A manual nobody opens is not help.
Source: https://www.nngroup.com/articles/ten-usability-heuristics/
Do
- Put one line of help text under the field it concerns.
- Use tooltips for icon-only controls and for the meaning of a term.
- Explain a setting's effect next to the setting, in the user's words.
- Link to deeper documentation from the place where the question arises.
Don't
- Replace clear labels with a help icon.
- Write paragraphs where a sentence will do.
- Hide the only explanation in a separate help section.
In tsumikit
Fieldrenders help and error text under its control and links it witharia-describedby.Tooltipfor terse in-place help;PopoverandDisclosurefor a little more.Callouttone="info"for a short contextual note;Prosefor longer documentation rendered from markdown.
Check
Find every setting, field and icon-only control on the screen. For each, can a new user learn what it does without leaving the screen? If not, add one line of help there.