Design principles
Sections 1 to 13 cover engineering choices. This one names the design principles behind the look and the behavior, and where each is applied. The principles are borrowed and linked. Only the "how we apply it" lines are ours.
Composition
- Hierarchy and scale. One page title, then a small, fixed type scale, so size alone tells you what matters.
Applied by the heading and UI text tokens (
--dui-font-size-page-title,--dui-font-size-ui) in Semantic tokens. - Contrast. Text, controls and focus rings meet the WCAG contrast minimums in light, dark and forced colors; the primary fill is the strongest mark on a page. See § 3 and Color.
- Proximity and negative space. Related things sit closer than unrelated ones, using the
--dui-space-*scale and the layout primitives (stack, cluster, grid), never one-off margins. - Alignment. Every item sits on one of a container's named lines. See § 13 Edges and alignment.
- Repetition and consistency. One element, one look, everywhere: a
<button>is styled once in button and reused, and the same control keeps the same name across pages (WCAG 3.2.4). - Balance. Surfaces are quiet and neutral so content and the one primary action carry the weight. Elevation separates layers rather than decorating them. See § 7 Elevation.
Dieter Rams' principles for good design
Named from Vitsœ's page on Dieter Rams' ten principles. How domestic-ui applies nine of them:
- Useful: every component exists because a real view needs it. Nothing ships as a showcase.
- Aesthetic: the default theme looks finished with zero CSS written by the consumer (§ 5).
- Understandable: the markup is the API. A native element looks and behaves like itself (§ 1).
- Unobtrusive: paper surfaces, brown ink and one accent leave room for the product's own content.
- Honest: a control never looks like something it is not. Links stay underlined, buttons look pressable (§ 8).
- Long-lasting: we build on web standards, so the system ages with the platform rather than a framework.
- Thorough down to the last detail: focus, forced colors, reduced motion, right-to-left and 320px widths are part of every component, not follow-ups (§ 3).
- Environmentally friendly. Our choice: read as lightweight pages: system fonts by default, zero-build CSS and no runtime dependencies, so a page costs few bytes and no extra requests.
- As little design as possible: a few semantic tokens and no per-component knobs.
We leave out Innovative, because domestic-ui packages the platform and claims no originality.
Laws of UX
From Laws of UX:
- Jakob's Law: people expect a site to work like the ones they already know. Native elements keep the platform's own behavior (§ 1).
- Hick's Law: more choices take longer to decide. One primary action per view; everything else is secondary or quiet (button).
- Fitts's Law: bigger, closer targets are faster to hit. Controls are 36px,
44px under a coarse pointer, above WCAG 2.5.8's
24px minimum (
--dui-size-target). - Miller's Law: people hold only a few items in mind at once. Long forms are grouped into fieldsets and sections (large forms), and navigation into groups (nav).
- Aesthetic-Usability Effect: people find good-looking interfaces easier to use. We polish the default look, but never at the cost of an accessibility requirement (§ 3).
Rules of thumb
- Reduce cognitive load. Show one task at a time. Progressive disclosure with
<details>and dialogs keeps secondary options out of the way (disclosure). - One primary action per view.
type="submit"gets the primary fill. A second primary on the same view points to a problem. - Intentional spacing. Every gap comes from
--dui-space-*. A value off the scale means the layout is wrong (§ 13). - Compose before you create. Most of what a design system calls a component is native elements put together
well. Before adding a component class or a web component, try a canonical example: a snippet in
examples/that combines existing elements (a card of a heading, text and actions; a settings form of fieldsets) and looks finished as written. Add a new component only when composition can't express it. The decision ladder says what comes next. - Familiarity over novelty. Use the pattern people already know, the native element or the APG pattern, before inventing one.