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
<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
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>
| Token | Default |
|---|---|
--ap-button-group-radius | var(--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)));
| Token | Default |
|---|---|
--ap-button-bg | transparent |
--ap-button-fg | var(--ap-text) |
--ap-button-border-color | var(--ap-border-strong) |
--ap-button-hover-bg | color-mix(in oklab, var(--ap-accent) 12%, transparent) |
--ap-button-hover-fg | var(--ap-text) |
--ap-button-hover-border-color | var(--ap-accent) |
--ap-button-pressed-bg | color-mix(in oklab, var(--ap-accent) 22%, transparent) |
--ap-button-height | var(--ap-size-control) |
--ap-button-padding-inline | var(--ap-space-lg) |
--ap-button-gap | var(--ap-space-sm) |
--ap-button-radius | var(--ap-radius-pill) |
--ap-button-border-width | var(--ap-border-width-hairline) |