24 lines
1.5 KiB
Markdown
24 lines
1.5 KiB
Markdown
# Contract: Button Semantics
|
|
|
|
Part of [controls-selection](../contract.md).
|
|
|
|
## Buttons
|
|
|
|
- Use a small stable button taxonomy: `primary`, `secondary`, `ghost`, `danger`, `disabled`.
|
|
- Destructive actions (`archive`, `delete`, `remove`) must use danger styling and explicit labels.
|
|
- Button text should describe the action outcome, not implementation detail.
|
|
- Inside a data-table row action column, buttons are icon-only. Each one must have a
|
|
deterministic `title` and `aria-label`; text labels belong in toolbars, forms and
|
|
confirmation dialogs, not repeated in every row.
|
|
- Outside the documented icon-only row/toolbar controls, buttons are text-first; primary and
|
|
destructive form/confirmation actions retain visible labels.
|
|
- Base examples must show both `disabled` and `loading` states.
|
|
- Any control that triggers a network or database call must show a visible busy state for the whole
|
|
duration of that call (spinner on the control, disabled control, or an equivalent indicator), and
|
|
must not be re-triggerable while busy. Without it, "slow" is indistinguishable from "broken".
|
|
- This applies to every call, not only to long-running background tasks. The server-side half of the
|
|
rule — a bounded timeout on the call itself — is owned by `go-api`.
|
|
- Do not use a hyperlink (`<a>`/link-styled text) to open a modal, drawer, detail view, or any
|
|
other in-page element. Use a `button` (or button-styled control) instead, unless the user
|
|
explicitly asks for a hyperlink. Hyperlinks are reserved for navigation to another URL/page.
|