Opinions we hold
Each of these is a choice between valid options, not a standard.
- Our choice: logical properties
(
margin-block,inline-size), so right-to-left and vertical writing modes work unchanged. - Our choice: keep link underlines, because color alone is not enough to spot a link (WCAG 1.4.1).
- Our choice: system font stacks from Modern Font Stacks,
because they cost no network requests and match the platform.
css/domestic.cssmakes no font request. For a consistent face across platforms (and pinned screenshots), the optionalcss/fonts/inter.cssdeclares a self-hosted Inter 4 variable font (Latin and Latin Extended subsets split byunicode-range,font-display: swap, an optical size axis thatfont-optical-sizinguses automatically, SIL OFL 1.1). Opt in by linking it and setting--dui-font-body: Inter, system-ui, sans-serif. The docs site does. - Our choice: a productive and an expressive type scale (as Carbon
splits them, for comparison): steps up to
--dui-step-2are fixed, and--dui-step-3to-5are fluid withclamp()inrem, so display text grows with the viewport and everything respects the user's font size (1.4.4 Resize Text). - Our choice: interface text (buttons, fields, nav, menus, tabs, badges, tooltips, table cells) is 14px
(
--dui-font-size-ui), as in Primer, Fluent 2, Radix Themes and shadcn/ui, for comparison. Prose stays 16px. An app page title (--dui-font-size-page-title) is step 4, 38px at most, one step above h2. Step 5 is for docs and marketing heroes. - Our choice: text fields, selects and text areas use
--dui-font-size-field: the UI size on a fine pointer and at least 16px under a coarse one (pointer,max()), because iOS Safari zooms the page into a focused field with smaller text. The 44px coarse-pointer field height already fits it. The viewport meta never limits zoom (1.4.4 Resize Text). - Our choice: a 60ch measure for prose, near the commonly cited 45 to 75 characters per line (WCAG 1.4.8 Visual Presentation asks for 80 or fewer).
- Our choice: rhythm from the "lobotomized owl" selector (
* + *) inside flow containers (Heydon Pickering), wrapped in:where()so it has zero specificity. - Our choice:
type="submit"buttons get the primary fill and other buttons stay neutral, so the primary action is marked by its native type, with no class. - Our choice: checkboxes, radios and range keep native rendering tinted with
accent-color, because native controls keep their platform accessibility. - Our choice: each atom has one
data-<atom>attribute whose value is a space-separated list (data-button="primary small"), matched with~=, instead of modifier classes. The other atom choices (button variants, focus rings, switch, field errors, badge tints) are listed with their reasons in the atoms index. - Our choice: molecules follow the same rule (
data-card="link",data-dialog="drawer end"), or use the native element or ARIA role when that already says everything (<search>,role="toolbar"). The molecule choices are listed with their reasons in the molecules index. The main ones:- Our choice: tabs select on focus (automatic activation), as the
APG recommends
when panels show at once.
activation="manual"is available. - Our choice: the drawer is a
<dialog>variant, so the browser handles modality, focus and Esc (explainer). - Our choice: a clickable card links its heading and stretches that link over the card, so the accessible name stays the heading (explainer).
- Our choice: toasts never dismiss themselves and never take focus (explainer).
- Our choice: the typeahead (
<dui-combobox>) upgrades a native<input list>+<datalist>, not a<select>, because the value is free text and the upgrade reuses the same input and options. It follows the APG Combobox list autocomplete variant, filters by "contains" like the native<datalist>popups in Chromium and Firefox, and positions its listbox under the input rather than in the top layer, so it is never wider than the field (explainer).
- Our choice: tabs select on focus (automatic activation), as the
APG recommends
when panels show at once.
- Our choice: organisms (page header, filter bar, form sections, data table) follow the same one-attribute rule
(
data-page-header,data-filter-bar,data-form-sections,data-table) and take the rest of their layout from their children's native elements. Their choices are listed in the organisms index. The main ones:- Our choice: the filter bar is a
<form method="get">in<search>with an Apply button and arole="status"result count present from page load, so filters live in the URL, work without JavaScript and are announced (4.1.3 Status Messages). - Our choice: form sections are headed
<section>elements with a<header>and one body of fields, not fieldsets, because a<legend>cannot be placed in a grid column. Related controls still go in a<fieldset>inside the body. - Our choice: the data table (
data-tableon a native<table>) has sortable headers that are plain text in the markup.<dui-table>turns them into buttons and follows the APG Sortable Table example (aria-sorton the sorted header only, a visually hidden caption hint, nothing else announced), so with JavaScript off there are no buttons that do nothing. A selected row shows a checked checkbox, a bar on its leading edge and a tint, never color alone. The count is arole="status"element present from load. - Our choice: a sticky table header sticks to the nearest scroll container, so a sticky table goes in
data-scroll="block inline"(at most--dui-size-panetall) or in none. Numeric columns are marked per cell with the same attribute (data-table-cell="number"), because words on the table cannot target a column.
- Our choice: the filter bar is a
- Our choice: layout primitives come from Every Layout's
Stack, Cluster and Grid. Their custom properties are registered with
@propertyas non-inheriting, so a nested primitive keeps its own default.
Links: visited state
:visited tells a reader which
destinations they have already seen. WCAG does not require it.
Understanding 1.4.1 says conveying a
link's visited status "is not an author responsibility". The visited color still meets 4.5:1.
- Our choice: only content links take
--dui-color-link-visited. Navigational links keep their unvisited color, because a reader picks a destination again on every page and "seen before" is noise there. Navigational means: inside a<nav>orrole="navigation",menu,menubar,tablistortoolbar; arole="tab"ormenuitem*link; a link withdata-button; or a same-page#fragmentlink (skip links, tables of contents). - The base rule does this with
a:visited:not(:where(…)), so it stays at the specificity ofa:visitedand needs no per-component resets. In forced colors, navigational links showLinkTextand content links showVisitedText. - Either way: mark a navigational link outside a
<nav>withdata-link="nav"(combines withquiet) to drop the visited color. For the rare content link inside a<nav>, setcolor: var(--dui-color-link-visited)on its:visitedstate in your own CSS, which beats the layers.
Icons
- Our choice: Lucide is the icon set, because its SVGs already use our 24px grid and a round
currentColorstroke and need no build. We draw the stroke at--dui-icon-stroke-width(1.75 units), not Lucide's 2. Credit: Lucide is under the ISC license. The icons it took from Feather are under the MIT license. Tabler and Heroicons were the alternatives considered. - Our choice: icons are inline SVG, copied from the official set into the markup. The repository ships no icon
files, sprite, font or package. The recipe: copy the icon from lucide.dev, replace its
classwithdata-icon, addaria-hidden="true" focusable="false", keep everything else (viewBox,fill="none",stroke="currentColor",widthandheight) as Lucide ships it, and note the icon's name in a comment.data-iconsizes it to--dui-size-iconand keeps it from shrinking. The stroke follows the text color throughcurrentColor, so it follows themes and forced colors with no extra CSS.examples/atoms/icon.htmlshows the recipe in every context. - Decorative or meaningful. An icon beside a visible label is decoration:
aria-hidden="true", so the label is the name and is not announced twice (1.1.1 Non-text Content). A standalone icon that carries meaning, outside a control, isrole="img"with a<title>(andaria-labelledbypointing at it). In a control, the name goes on the control, never on the SVG (4.1.2 Name, Role, Value, APG: names and descriptions). - Contrast. An icon that is the only sign of a control or a state meets 3:1 (1.4.11 Non-text Contrast). A selected state changes the drawing (filled or outlined), not only its color.
- Our choice: icon plus a visible label is the default. Label only is always fine, and better when no icon comes to mind at once. If the label is visible, the accessible name contains it (2.5.3 Label in Name).
- Our choice: icon only (
data-button="icon") is allowed only for these widely recognized actions: search, close, open or close navigation (menu), show or hide a sidebar or panel, play, pause, stop, skip, expand and collapse, back, forward, edit, more (overflow), settings in an app bar, and add item in a dense toolbar. A product-specific metaphor is never icon only. The button- is named for the action ("Search", "Close"), never the picture ("Magnifying glass", "X"), with visually hidden text inside it;
- shows a visible tooltip with the same words on hover and keyboard focus, which Esc hides and the
pointer can move onto (1.4.13 Content on Hover or Focus).
The tooltip is
<dui-tooltip>with apopover="hint". No browser can show a popover on hover and focus without script except Chromium, throughinterestfor, which Firefox and Safari do not support yet; - is a square of
--dui-size-control(36px comfortable, 32px compact, 44px under a coarse pointer), never smaller than 24 by 24 pixels (2.5.8 Target Size (Minimum)).
- Our choice: no icon-only destructive actions. Delete, remove, empty and reset always show their word. A trash icon may sit beside it. For that reason delete is not on the list above, even in a toolbar.
- Our choice: navigation keeps visible text. Icons in nav links and app bar buttons are decoration.
- Our choice: in right-to-left text, flip only icons whose meaning has a direction, with
data-icon="mirror"(flipped under:dir(rtl), which follows the nearestdirattribute): arrows, chevrons, back and forward, undo and redo, indent and outdent, text alignment to the start or end. Never flip search, close, play, check, clocks or logos. - Icon fonts are rejected. A ligature or private-use glyph is text. User text spacing (1.4.12 Text Spacing) can break the ligature into words, a font that fails to load shows letters or empty boxes, and screen readers may read the ligature name.