Skip to content
astrostyle v0.6.2

Buttons

Native <button> (or <a>) with the ap-c-button class. Pill-shaped like the Design Guide; every look, size and shape is a modifier that only sets tokens.

Looks 01

Link button
<button class="ap-c-button ap-c-button--primary" type="button">Jump</button>

Sizes, shapes, icons 02

Icon-only buttons need an aria-label. Controls are never shorter than 40px.

States 03

aria-disabled link

Hover, press and focus them with the mouse or Tab: aria-pressed="true" turns a button into a toggle.

Button group 04

<div class="ap-c-button-group" role="group" aria-label="View">
  <button class="ap-c-button" type="button" aria-pressed="true">Map</button>
  <button class="ap-c-button" type="button" aria-pressed="false">Crew</button>
</div>
Tokens of button-group: set them on the element, on a parent or in a modifier.
TokenDefault
--ap-button-group-radiusvar(--ap-radius-pill)

Customize 05

.ap-c-button--warning {
  --ap-button-bg: var(--ap-warning);
  --ap-button-fg: var(--ap-palette-black);
}

/* or, in Sass */
@include ap.variant(button, warning, (bg: ap.token(warning), fg: ap.token(palette-black)));
Tokens of button: set them on the element, on a parent or in a modifier.
TokenDefault
--ap-button-bgtransparent
--ap-button-fgvar(--ap-text)
--ap-button-border-colorvar(--ap-border-strong)
--ap-button-hover-bgcolor-mix(in oklab, var(--ap-accent) 12%, transparent)
--ap-button-hover-fgvar(--ap-text)
--ap-button-hover-border-colorvar(--ap-accent)
--ap-button-pressed-bgcolor-mix(in oklab, var(--ap-accent) 22%, transparent)
--ap-button-heightvar(--ap-size-control)
--ap-button-padding-inlinevar(--ap-space-lg)
--ap-button-gapvar(--ap-space-sm)
--ap-button-radiusvar(--ap-radius-pill)
--ap-button-border-widthvar(--ap-border-width-hairline)