FAB
ExpressiveA screen's single most important action, as an icon or an extended label.
import { Fab, ExtendedFab } from '@windmorph/react';Keyboard
| Key | Action | Where |
|---|---|---|
| Tab | Moves focus to the FAB, and on to the next element. | |
| Enter or Space | Runs the FAB's action. | |
| Enter | Follows a link FAB (href).With href | With href |
| Escape | Hides the label tooltip while it shows. |
Screen reader
- Role
button, orlinkwhen it hashref.- Accessible name
Fab:aria-labeloraria-labelledby, one of which is required, since it shows no text.ExtendedFab: its visible label, which stays its name while collapsed to the icon.- States announced
- None of its own: M3 FABs have no disabled or toggle state, so the types leave out
disabledandtoggle.
- The icon is hidden from assistive tech (
aria-hidden). - A
Fabshows itsaria-labelin a plain tooltip on hover, keyboard focus and a touch long press. The tooltip repeats the FAB's name, so it isn't linked as its description (noaria-describedby) and screen readers announce the name once. There is none withtooltip={false}or with onlyaria-labelledby. - An
ExtendedFabshows its label in a tooltip only while collapsed, not linked as a description either; expanded, the label is visible and there is no tooltip. Inside your ownTooltipTriggerit steps aside. - A hidden FAB (
visible={false}) isinert, so it leaves the Tab order and the accessibility tree.
Focus
- It is in the Tab order where it sits in the DOM, wherever it is drawn on screen.
- 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. - Collapsing or expanding an
ExtendedFabnever remounts it, so it keeps focus.
Touch target
Every FAB is 56px or larger in both directions (56, 80 or 96px), and an extended FAB is at least as wide as it is tall, so all meet the 48px minimum without an extra touch target.
Motion
- Under reduced motion, hiding and showing (
visible,appear) only fade, without the scale from the centre, and the press ripple appears at full size without growing. Colours and elevation still fade. - An
ExtendedFabcollapses and expands at once: its width changes without sliding and its label fades.
What you need to do
- Name a
Fabwith anaria-labelthat says the action ("Compose a new message"), not the icon. - Give an
ExtendedFabanaria-labelonly to add detail, and start it with the visible label's first word ("Create a new invite" for "Create"). It warns once in development when the first words differ. - Pass
tooltip={false}to aFabyou wrap in your ownTooltipTrigger: unlikeExtendedFab, it doesn't step aside on its own. - Hide the FAB (
visible={false}) when its action isn't available, rather than disabling it. - Place it in the DOM where it should come in the focus order, and keep it from covering another control and its focus ring.