axi-designv1.50.0

Primitives

Pill

A filter toggle. Pressed, it fills with the colour of the thing it filters to, so the control reads as that thing rather than as a generic "selected".

.axi-pill .axi-pill--sm .axi-pill--xs

A pill says which of several filters you chose; a switch says what state one thing is in. State lives in aria-pressed, not in a modifier class, so the accessibility tree and the appearance cannot disagree. --axi-pill-fill is read through a fallback and never declared on the component, which is what lets a consumer set it on the pill or on any ancestor. A pressed pill already rests on a block, so hovering it deepens that block rather than sliding it - the pressed-and-hovered case is spelled out in the stylesheet because without it source order decided the answer.

It stands on the button's scale, with the button's two named steps and the same numbers in them. The only thing a pill has that a button does not is a state, so two of them carrying the same label have no business being different shapes - and they were, the pill's sides measuring less than half the button's. Anything holding a row of both wants them interchangeable.

A row of severity filters

Pressed state is aria-pressed; the fill comes in per instance
<div class="axi-row">
  <button class="axi-pill" aria-pressed="false" type="button">Unpressed</button>
  <button class="axi-pill" aria-pressed="true" type="button">Pressed</button>
  <button class="axi-pill" aria-pressed="true" type="button" style="--axi-pill-fill: var(--axi-ok)">Low</button>
  <button class="axi-pill" aria-pressed="true" type="button" style="--axi-pill-fill: var(--axi-warn)">Elevated</button>
  <button class="axi-pill" aria-pressed="true" type="button" style="--axi-pill-fill: var(--axi-danger)">High</button>
</div>

The two steps, beside the button they share a scale with

A pill and a button at the same step are the same shape; only the state differs
<div class="axi-row" style="--axi-row-gap: 8px">
  <button class="axi-btn">Button</button>
  <button class="axi-pill" aria-pressed="true" type="button">Pill</button>
</div>
<div class="axi-row" style="--axi-row-gap: 8px">
  <button class="axi-btn axi-btn--sm">Button sm</button>
  <button class="axi-pill axi-pill--sm" aria-pressed="true" type="button">Pill sm</button>
</div>
<div class="axi-row" style="--axi-row-gap: 8px">
  <button class="axi-btn axi-btn--xs">Button xs</button>
  <button class="axi-pill axi-pill--xs" aria-pressed="true" type="button">Pill xs</button>
</div>

Knobs

PropertySetsFallback
--axi-pill-fillthe fill a pressed .axi-pill takesvar(--axi-accent)
--axi-pill-padthe padding inside an .axi-pill. The same scale and the same two named steps as the button, because a pill is a button that holds a state12px 20px
--axi-pill-sizean .axi-pill's text size, which travels with its padding13px

Rules this answers