docs(web-visual-baseline): icon-only buttons, one icon per action, centring and fill reset

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
mchusandClaude Sonnet 5.5 committed 2026-11-04 10:37:30 +03:00
1 parent 6facd0c366
commit c3154e97d6
2 files changed
+33 -1

No files matched your search

@@ -27,3 +27,15 @@ Render the symbol through the shared icon template, for example:
The icon template emits an SVG with a local `use href="#i-scroll"` reference. The icon template emits an SVG with a local `use href="#i-scroll"` reference.
The sprite, template and CSS ship inside the binary. The browser never fetches The sprite, template and CSS ship inside the binary. The browser never fetches
Lucide or another asset host. Adding an icon does not add a runtime dependency. Lucide or another asset host. Adding an icon does not add a runtime dependency.
### Icon-only buttons in table rows
```css
/* a layout rule that changes display must keep the icon centred */
.row-actions > .icon-btn { display: inline-flex; justify-content: center; align-items: center; }
/* every container that renders an icon resets fill, otherwise it is solid black */
.header-primary .icon { fill: none; stroke: currentColor; stroke-width: 2; }
/* fixed action slots keep icons in the same column on every row */
.task-actions { display: grid; grid-template-columns: repeat(3, 32px); gap: 4px; justify-content: end; }
.icon-slot { display: block; width: 32px; height: 32px; }
```
+21 -1
View File
@@ -1,6 +1,6 @@
# Contract: Web Visual Baseline # Contract: Web Visual Baseline
Version: 1.2 Version: 1.3
## Scope ## Scope
@@ -74,6 +74,26 @@ Copy `assets/view.css` as the starting stylesheet and adapt tokens; do not rewri
round line caps and joins. Size and color come from shared icon/button CSS. round line caps and joins. Size and color come from shared icon/button CSS.
- An icon-only action needs both `title` and `aria-label`. Decorative SVGs have - An icon-only action needs both `title` and `aria-label`. Decorative SVGs have
`aria-hidden="true"` and must not receive keyboard focus. `aria-hidden="true"` and must not receive keyboard focus.
- A button that has an icon shows only the icon. The action name lives in
`title` and `aria-label`; do not put a text label next to the icon. Items of
a popup menu (`role="menuitem"`) keep their text, because the menu has no
other way to tell them apart.
- One icon means one action across the whole interface. Restore, refresh,
restart, connection test and similar actions each get their own distinct icon;
never reuse one icon for a different action. Keep the action-to-icon table in
the project documentation.
- The stroke-only rule applies in every container, not only in `.icon-btn`: any
other place that renders an icon (header button, status cell, badge) must set
`fill: none` and `stroke: currentColor` as well. An SVG without them renders as
a filled black blob.
- Centre the icon in its button on both axes. Where a layout rule changes a
button's `display` (for example to `inline-flex` inside a table cell), it must
also set `justify-content: center` and `align-items: center`; otherwise the
icon sticks to the left edge. An action column holds a fixed number of equal
slots (an empty slot where an action does not apply), so icons do not shift
from row to row.
- An icon that depends on data (a status, a kind) is chosen on the server by one
mapping function; the page and live refresh only print its name.
- Embed all UI assets in the application binary: templates, scripts, styles, - Embed all UI assets in the application binary: templates, scripts, styles,
icons, fonts and any third-party UI code. Go applications use `go:embed` and icons, fonts and any third-party UI code. Go applications use `go:embed` and
serve these assets themselves. System fonts are allowed without downloads. serve these assets themselves. System fonts are allowed without downloads.