# Buttons

**Last updated:** 2026-11-27T01:30:24-03:00 (UTC-3)

Buttons start actions; links go places. A view has at most one primary button, and destructive actions say what they destroy. Part of the [design system](/docs/design/overview/).

## Kinds

| Kind | Console class | Look | Use |
|---|---|---|---|
| Primary | `.primary`, `.identity-button.primary` | A pill filled with a gradient from `--color-primary-fill-from` to `--color-primary-fill-to`, a lit top lip and a soft cyan drop (`--shadow-button-primary`), and a `--color-on-primary` label: dark ink, never white | The one main action: Save, Create key, Apply filters. |
| Secondary | `.secondary`, `.identity-button` | A clear glass pill: `--color-glass-tint-clear` fill, the inner light of `--shadow-glass`, a 1px `--color-line-strong` ring and a `--color-text` label | Every other action in a toolbar or form: Refresh, Export, Reset, Cancel. |
| Icon | `.icon-button`, the theme switch | A round, transparent button with a `--color-text-soft` icon | Close, collapse, switch theme. |
| Quiet | `.identity-link`, `.text-button` | No fill, an underlined `--color-primary` label | Inline actions in a row or sentence: Focus this group, Show details, Manage. |
| Destructive | `.identity-link.danger` | No fill, `--color-danger` label | Revoke, delete, remove; always followed by a confirmation. |
| Emergency | `.panic-button` | A transparent pill with a `--color-danger` label and border, in the mono face | `!panic` in the top bar only. |

The primary gradient and its label are the same in both themes, so the main action looks the same in dark and in light. A secondary button sits on a panel, so it carries the glass tint and edge but does not blur what is behind it.

On the site, Starlight's link buttons (the home page's hero actions) follow the same two kinds: the primary one is the gradient pill with the `--color-on-primary` label, the secondary one the clear glass pill; the minimal ones are plain `--color-text`.

## Anatomy

- Label in sentence case, verb first ("Create key", not "Key creation"). One or two words where possible; a longer label may wrap rather than push the layout.
- An optional 16px icon before the label (see [Iconography and brand](/docs/design/iconography-and-brand/#interface-icons)). An icon-only button needs an `aria-label` and a `title`.
- Radius `--radius-pill`, at least `--size-tap-target` (44px) tall at every width, 14px text: weight `--font-weight-semibold` on the primary button, `--font-weight-medium` on the secondary.

## States

| State | What changes |
|---|---|
| Hover | The primary button brightens slightly (`filter: brightness(1.05)`); secondary and icon buttons take the `--color-fill-on` fill. |
| Focus (keyboard) | A 2px `--color-primary` outline, offset 2px, on every button; inside clipped containers (tabs, navigation, menus) the outline is drawn inside. |
| Reduced transparency | Secondary buttons trade their inner light for a plain 1px `--color-line-strong` edge. |
| Disabled or busy | `opacity: 0.65` and a `wait` cursor; the label stays readable. A busy button keeps its label and may swap its icon for a spinner. |
| Selected segment | In a row of tabs (`.page-tabs`, `.analysis-tabs`) the selected option takes the `--color-fill-on` fill with a hairline ring (`--shadow-hairline`) and `--color-text`. |

Contrast of every label is part of the checked pairs on the [Color](/docs/design/color/#contrast) page: `on-primary` on both ends of the primary gradient, `text` on clear glass and on `fill-on`, `primary` and `danger` on the page.

## Menus that hold buttons

Two small menus keep a row or a bar from filling with buttons. Both open under their button on `--color-surface` with `--shadow-menu` and radius `--radius-field`, list their choices at tap-target height, close on Escape (focus returns to the button), on tabbing out and on a click outside.

- **Manage** (`RowMenu` in `web/src/RowMenu.tsx`): one quiet "Manage" button per table row that folds the row's non-destructive actions. The destructive actions stay beside it in the semantic red: on a virtual key, Revoke and Delete. A row with nothing to manage shows no menu. The menu is drawn in a layer on the page, not inside the table, so a scrolling table never clips it: it sits under its button with the right edges aligned, above the button when there is no room below, always inside the window, and follows the button when the page scrolls. On opening, the first action takes focus; Up and Down move between actions; Escape or Tab closes the menu and returns focus to Manage, and so does choosing an action.
- **Theme switch** (`ThemeSwitch` in `web/src/ThemeSwitch.tsx`): the half-disc icon button in the top bar and on the sign-in screens, with three choices in words (System, Light, Dark). See [Color](/docs/design/color/#themes).

## Example

```html
<div class="form-actions">
  <button class="secondary" type="button">Cancel</button>
  <button class="identity-button primary" type="submit">Create key</button>
</div>
```

```css
/* A new button kind reads the tokens, never hex values. */
.release-action {
  min-height: var(--size-tap-target);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-glass-tint-clear);
  box-shadow:
    var(--shadow-glass),
    inset 0 0 0 1px var(--color-line-strong);
  color: var(--color-text);
  font: var(--font-weight-medium) 14px / 1 var(--font-body);
  transition: background var(--motion-duration-fast) var(--motion-ease-standard);
}
.release-action:hover {
  background: var(--color-fill-on);
}
```

## Rules

- One primary button per view or dialog. Two equally important actions are a sign the view does two jobs.
- The label on the primary fill is `--color-on-primary`, never white.
- Destructive actions use the semantic red and a confirmation that names the object ("Revoke key Production assistant?"). They are never hidden inside a menu of ordinary actions.
- Do not disable a button to explain a rule; keep it enabled and say why on click, or show the reason next to it.
