Interface
Native HTML and CSS for menus, layout, text, colour and motion. Use what the browser already does instead of JavaScript widgets and fixed layouts.
- Recommended 7
- Optional 4
Recommended
Build menus with popover
RecommendedBuild menus, tooltips and simple overlays with the built-in
popoverattribute, instead of JavaScript modal code.Build modal dialogs with dialog
RecommendedBuild modal dialogs with the
<dialog>element andshowModal(), never with a styleddivand your own focus code.Pin menus to their button with CSS
RecommendedAttach popovers and menus to the element they belong to with CSS anchor positioning. Keep a plain fallback where browsers lack it.
Let parts fit the space they get
RecommendedLet components adapt to the space they are given with container queries, not only to the width of the screen.
Let the browser balance line breaks
RecommendedUse
text-wrap: balanceon headings andtext-wrap: prettyon paragraphs, instead of manual line breaks.Keep room for the scrollbar
RecommendedKeep space for the scrollbar with
scrollbar-gutter: stable, so the page doesn't shift when scrolling is locked or unlocked.Size full-height panels for phones
RecommendedSize full-height phone layouts with
dvh,svhorlvhinstead ofvh, so they fit when the address bar moves.
Optional
Wire buttons without click handlers
OptionalConnect buttons to popovers and dialogs in HTML with
commandforandcommand. Keep a fallback for older browsers.Define every colour once
OptionalDefine every colour once as a
light-dark()custom property, and switch themes withcolor-scheme, never with duplicate rules.Animate on scroll with CSS
OptionalDrive scroll effects with CSS
animation-timelineinstead of scroll event listeners in JavaScript.Skip page fades unless they help
OptionalUse View Transitions only where the animation helps people follow a change, and check that it doesn't slow down clicks.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers website playbook: https://agentwranglers.se/playbook/website/interface.