Button
Alignment target:@astryxdesign/core v0.7.1 · Button
Color contrast
Measure the foreground and background as they appear together on screen. The ratios below are the WCAG 2.2 AA checks for this component.
| Check | Ratio | Applies to | Guidance |
|---|---|---|---|
| Text label | 4.5:1 | Rest, Hover, Pointer down | Button text must have at least 4.5:1 contrast with the button background in every state. For Hover and Pointer down, measure the final background after the overlay is applied. 1.4.3 Contrast (Minimum) |
| Essential icon or spinner arc | 3:1 | Icon only, Loading | An icon used instead of text must have at least 3:1 contrast with the button background. The moving spinner arc must also meet 3:1. An icon beside a visible label does not need its own check. 1.4.11 Non-text Contrast |
| Badge text | 4.5:1 | Rest, Hover, Pointer down | Badge text inside a button must have at least 4.5:1 contrast with the Badge background. Check all 14 built-in Badge colors in Rest, Hover, and Pointer down on page and surface backgrounds. This covers 336 pairs per mode. Check custom end content separately. 1.4.3 Contrast (Minimum) |
| Visible control boundary | 3:1 if needed | Rest | The button edge needs 3:1 contrast only when users need it to see the control. A text-only button can rely on its label. 1.4.11 Non-text Contrast |
| Keyboard focus indicator | 3:1 | Focus visible | The focus outline needs at least 3:1 contrast with the area around the button. Check every style. Destructive buttons use a red outline. 1.4.11 Non-text Contrast |
| Disabled appearance | Not required | Disabled | Disabled controls do not need to meet these contrast ratios. 1.4.3 and 1.4.11 exceptions |