Labeling
- Text buttons are labeled by their visible content.
- Icon-only buttons need an explicit
aria-label. - When
asChildis used, the final child element must still expose a valid accessible name.
Keyboard Behavior
AnnouncementFocus the demo and press a key from the table.
| Key | Action |
|---|---|
| EnterSpace | Activates the focused button. It is a native <button>; with asChild the child element keeps its own keys, so a link reacts to Enter only. |
Focus Behavior
ButtonBaserenders a visible:focus-visibleoutline using--focus-color.disabledremoves interaction.- If the action should stay focusable while visually blocked, use a different interaction model instead of forcing disabled styling.
Screen Reader Semantics
- Default semantics are those of a native
button. - With
asChild, semantics come from the slotted element. - Do not turn navigation links into pseudo-buttons unless the product interaction is actually navigation.
Accessibility Risks
- Using icon-only content without a label.
- Using
asChildwith a non-interactive child. - Forgetting that
buttonandahave different keyboard and screen-reader expectations.