Button
ExpressiveFive variants and five sizes for text actions, with a toggle form and a press morph.
import { Button } from '@windmorph/react';Keyboard
| Key | Action | Where |
|---|---|---|
| Tab | Moves focus to the button, and on to the next element. | |
| Enter or Space | Activates the button, or switches a toggle on or off. | |
| Enter | Follows a link button (href). Space scrolls the page, as it does on any link, rather than following it.With href | With href |
Screen reader
- Role
button, orlinkwhen it hashref.- Accessible name
- Its visible label (
children). - States announced
- Disabled, and pressed or not pressed for a toggle (
aria-pressed). A link has no toggle form. Whilependingit is unavailable (aria-disabled="true") but still focusable.
- While
pending, the name gains "Loading" (labels.pending): "Save, Loading". A button that turns pending while it has focus says its new name once, politely; nothing is announced when it ends, so the app announces the result. - The loading indicator itself is hidden from assistive tech: the name carries the state from the first frame, before the indicator appears.
- The leading icon is decorative and hidden from assistive tech (
aria-hidden). M3 allows one icon, before the label, so there is no trailing icon.
Focus
- It is in the Tab order where it sits in the page. A disabled button can't be focused.
- A pending button keeps focus through the whole wait and stays in the Tab order: it is not natively disabled, only its presses are blocked.
- Keyboard focus shows M3's focus indicator: a 3px
secondaryoutline 2px outside the container, drawn as anoutline, so a clipping parent never hides it. Pointer presses show no ring.
Touch target
- Medium, large and extra-large buttons (56, 96 and 136px tall) are taller than 48px.
- Extra-small and small buttons (32 and 40px tall) get an invisible 48 × 48px touch target inside the button; their layout height stays 32 or 40px.
Motion
- Under reduced motion the press and selection morphs snap to their new corners, and the press ripple appears at full size without growing. Colours and elevation still fade.
- The pending swap is a crossfade, delayed 200ms so a quick action never flashes; it stays under reduced motion, where the loading indicator only rotates.
What you need to do
- Give every button a visible text label. For an icon-only action use
IconButton, which requires anaria-label. - For a toggle, keep the label true in both states (Star / Starred), or keep one label and let
aria-pressedcarry the state. - Use
hreffor navigation andonPressfor actions, so the element and its keys match what it does. - Set
pendingonly while the action runs, and don't also setdisabled, which drops focus to the page. Announce the result yourself (a snackbar, an error message, the next page).