Button
Two variants, primary and secondary. There is no third, and a link is not a button.
When to use it
- For an action: follow, save, subscribe, submit.
- One primary button in a group. The primary says what the page wants you to do.
- Do not use a button for navigation. If it goes somewhere, it is a link.
- Do not add a third variant. If two are not enough, the page is asking for too much.
Primary and secondary
HTML
<button class="p234-btn" type="button">Follow this topic</button>
<button class="p234-btn p234-btn--secondary" type="button">Save</button>Primary
Brand green with on-brand text, checked at 4.5:1. One per group.
Secondary
Transparent with a rule-strong border, which meets the 3:1 non-text ratio so the control is visible to someone who cannot pick out a low-contrast outline.
Size and touch
Padding is set so the control clears a 44px touch target at the default type size. Most readers are on a phone; a control that needs a careful tap is a control that gets missed.
Focus
Buttons inherit the shared focus ring. Tab to the examples above to see it, and switch themes to see it in both. See Focus.
Motion
Background transitions on duration-fast, and the transition is removed entirely under prefers-reduced-motion.
Tokens this component reads
--p234-color-brand--p234-color-brand-hover--p234-color-on-brand--p234-color-ink--p234-color-rule-strong--p234-color-paper-sunk--p234-type-ui-*--p234-radius-md--p234-space-4--p234-space-5--p234-motion-duration-fast--p234-motion-easing-standard