Fab

Floating action button anchored to a screen corner, with an optional speed-dial of secondary actions

Category: inputs · WCAG 2.2-AA · inputs, fab, floating-action-button, mobile, speed-dial

States

Props

PropTypeDefaultDescription
childrenReact.ReactNodeThe main icon
labelstringAccessible name for the button
onClick() => voidCalled when the element is clicked.
actionsFabAction[]Speed-dial actions; each has a label, icon, onSelect, and optional disabled
position'bottom-end' | 'bottom-start'bottom-endPosition of the component.
openbooleanWhether the component is open (controlled).
defaultOpenbooleanWhether the component is open on first render (uncontrolled).
onOpenChange(open: boolean) => voidCalled with the next open state when it changes.
classNamestringAdditional CSS class names merged onto the root element.

Design tokens

When to use

When not to use

How to build an accessible Fab in React →

Examples

Single action

<Fab label="Compose" onClick={compose}><PlusIcon /></Fab>

Speed dial

The main button toggles a menu of secondary actions.

<Fab
  label="Create"
  actions={[
    { label: 'New note', icon: <NoteIcon />, onSelect: newNote },
    { label: 'New folder', icon: <FolderIcon />, onSelect: newFolder },
  ]}
>
  <PlusIcon />
</Fab>

Start corner

<Fab label="Help" position="bottom-start" onClick={openHelp}><HelpIcon /></Fab>

Related components

← Back to docs