FAB
Material 3 floating action button hierarchy, extended forms, expressive sizes, elevation, and web action semantics.
Floating action buttons highlight a high-priority action for a screen. Use a FAB when one action deserves persistent visual prominence; do not use it as a generic replacement for ordinary buttons or for several equal-priority actions.
import { FloatingActionButton } from '@m3-ui/ui';
<FloatingActionButton aria-label="Create" onPress={create}>
<AddIcon />
</FloatingActionButton>When to use
Use a FAB for the screen's most important creation or transformation action when Material guidance for that product context calls for persistent emphasis. Prefer a normal button for inline actions, dialogs, forms, and dense action sets.
Extended FABs add a text label when the action benefits from more explicit wording or when the layout can afford the additional width.
Basic and extended FABs
<FloatingActionButton aria-label="Create">
<AddIcon />
</FloatingActionButton>
<ExtendedFloatingActionButton icon={<AddIcon />}>
Create
</ExtendedFloatingActionButton>For icon-only FABs, provide an accessible name because icon content is presentation-only.
Size families
The public standard FAB family includes SmallFloatingActionButton, FloatingActionButton, MediumFloatingActionButton, and LargeFloatingActionButton. The extended family mirrors those Material size roles with small, baseline, medium, and large public components.
Choose the semantic component size rather than copying container or icon measurements into application CSS.
Extended collapse behavior
An extended FAB with an icon can set expanded={false} to collapse to its icon. A text-only extended FAB stays expanded because collapsing it would remove the visible action affordance.
<ExtendedFloatingActionButton
icon={<ComposeIcon />}
expanded={showLabel}
>
Compose
</ExtendedFloatingActionButton>Application state owns expanded; the FAB does not add a scroll listener or navigation policy to decide when the label should collapse.
Color and elevation
The Compose-aligned public color roles include the default primary-container family plus secondary- and tertiary-container variants. elevation accepts the component's audited standard/lowered behavior, with Material interaction state flowing through the shared elevation engine.
<FloatingActionButton
aria-label="Edit"
variant="secondaryContainer"
>
<EditIcon />
</FloatingActionButton>Avoid adding a second author box-shadow or copied Material color values around the FAB. Use the public customization hooks only when product design intentionally departs from the canonical defaults.
Behavior and states
React Aria Button owns action semantics, disabled state, keyboard and pointer activation, hover, and focus visibility. Material tokens and the shared ripple/elevation engines own container, content, state layers, shape, elevation, and motion.
Accessibility
Icon-only FABs need an explicit accessible name. Extended FAB text normally supplies that name; if the visible content is not plain text, provide a clear aria-label.
A FAB is a button action, not a navigation landmark. Place it in the application's logical focus order and avoid duplicating the same primary action in several simultaneous FABs.
API reference
FloatingActionButton
FloatingActionButton(props: FloatingActionButtonProps): JSX.ElementProps
| Name | Type | Default | Description | Origin |
|---|---|---|---|---|
children* | ReactNode | — | — | @m3-ui/ui |
containerColor | Property.BackgroundColor | undefined | — | — | @m3-ui/ui |
contentColor | Property.Color | undefined | — | — | @m3-ui/ui |
elevation | FabElevation | undefined | — | — | @m3-ui/ui |
shape | Property.BorderRadius<string | number> | undefined | — | — | @m3-ui/ui |
variant | FabVariant | undefined | — | Material FAB color family. Container-role variants preserve Compose token families; surface/solid variants preserve the pinned Material Web API. | @m3-ui/ui |
Inherited React / web props (110)
| Name | Type | Default | Description | Origin |
|---|---|---|---|---|
aria-controls | string | undefined | — | Identifies the element (or elements) whose contents or presence are controlled by the current element. | react-aria |
aria-current | boolean | "true" | "false" | "page" | "step" | "location" | "date" | "time" | undefined | — | Indicates whether this element represents the current item within a container or set of related elements. | react-aria |
aria-describedby | string | undefined | — | Identifies the element (or elements) that describes the object. | @react-types/shared |
aria-details | string | undefined | — | Identifies the element (or elements) that provide a detailed, extended description for the object. | @react-types/shared |
aria-disabled | boolean | "true" | "false" | undefined | — | Indicates whether the element is disabled to users of assistive technology. | react-aria |
aria-expanded | boolean | "true" | "false" | undefined | — | Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. | react-aria |
aria-haspopup | boolean | "true" | "false" | "dialog" | "grid" | "listbox" | "menu" | "tree" | undefined | — | Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. | react-aria |
aria-label | string | undefined | — | Defines a string value that labels the current element. | @react-types/shared |
aria-labelledby | string | undefined | — | Identifies the element (or elements) that labels the current element. | @react-types/shared |
aria-pressed | boolean | "true" | "false" | "mixed" | undefined | — | Indicates the current "pressed" state of toggle buttons. | react-aria |
autoFocus | boolean | undefined | — | Whether the element should receive focus on render. | @react-types/shared |
className | ClassNameOrFunction<ButtonRenderProps> | undefined | 'react-aria-Button' | The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state. | react-aria-components |
dir | string | undefined | — | — | @react-types/shared |
excludeFromTabOrder | boolean | undefined | — | Whether to exclude the element from the sequential tab order. If true, the element will not be focusable via the keyboard by tabbing. This should be avoided except in rare scenarios where an alternative means of accessing the element or its functionality via the keyboard is available. | @react-types/shared |
form | string | undefined | — | The `<form>` element to associate the button with. The value of this attribute must be the id of a `<form>` in the same document. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#form). | react-aria |
formAction | string | ((formData: FormData) => void | Promise<void>) | undefined | — | The URL that processes the information submitted by the button. Overrides the action attribute of the button's form owner. | react-aria |
formEncType | string | undefined | — | Indicates how to encode the form data that is submitted. | react-aria |
formMethod | string | undefined | — | Indicates the HTTP method used to submit the form. | react-aria |
formNoValidate | boolean | undefined | — | Indicates that the form is not to be validated when it is submitted. | react-aria |
formTarget | string | undefined | — | Overrides the target attribute of the button's form owner. | react-aria |
hidden | boolean | undefined | — | — | @react-types/shared |
id | string | undefined | — | The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). | @react-types/shared |
inert | boolean | undefined | — | — | @react-types/shared |
isPending | boolean | undefined | — | Whether the button is in a pending state. This disables press and hover events while retaining focusability, and announces the pending state to screen readers. | react-aria-components |
lang | string | undefined | — | — | @react-types/shared |
name | string | undefined | — | Submitted as a pair with the button's value as part of the form data. | react-aria |
onAnimationEnd | AnimationEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onAnimationEndCapture | AnimationEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onAnimationIteration | AnimationEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onAnimationIterationCapture | AnimationEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onAnimationStart | AnimationEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onAnimationStartCapture | AnimationEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onAuxClick | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onAuxClickCapture | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onBlur | ((e: FocusEvent<Element, Element>) => void) | undefined | — | Handler that is called when the element loses focus. | @react-types/shared |
onClick | ((e: MouseEvent<FocusableElement>) => void) | undefined | — | **Not recommended – use `onPress` instead.** `onClick` is an alias for `onPress` provided for compatibility with other libraries. `onPress` provides additional event details for non-mouse interactions. | @react-types/shared |
onClickCapture | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onContextMenu | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onContextMenuCapture | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onDoubleClick | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onDoubleClickCapture | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onFocus | ((e: FocusEvent<Element, Element>) => void) | undefined | — | Handler that is called when the element receives focus. | @react-types/shared |
onFocusChange | ((isFocused: boolean) => void) | undefined | — | Handler that is called when the element's focus status changes. | @react-types/shared |
onGotPointerCapture | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onGotPointerCaptureCapture | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onHoverChange | ((isHovering: boolean) => void) | undefined | — | Handler that is called when the hover state changes. | @react-types/shared |
onHoverEnd | ((e: HoverEvent) => void) | undefined | — | Handler that is called when a hover interaction ends. | @react-types/shared |
onHoverStart | ((e: HoverEvent) => void) | undefined | — | Handler that is called when a hover interaction starts. | @react-types/shared |
onKeyDown | ((e: KeyboardEvent) => void) | undefined | — | Handler that is called when a key is pressed. | @react-types/shared |
onKeyUp | ((e: KeyboardEvent) => void) | undefined | — | Handler that is called when a key is released. | @react-types/shared |
onLostPointerCapture | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onLostPointerCaptureCapture | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onMouseDown | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onMouseDownCapture | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onMouseEnter | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onMouseLeave | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onMouseMove | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onMouseMoveCapture | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onMouseOut | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onMouseOutCapture | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onMouseOver | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onMouseOverCapture | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onMouseUp | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onMouseUpCapture | MouseEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onPointerCancel | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onPointerCancelCapture | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onPointerDown | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onPointerDownCapture | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onPointerEnter | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onPointerLeave | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onPointerMove | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onPointerMoveCapture | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onPointerOut | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onPointerOutCapture | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onPointerOver | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onPointerOverCapture | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onPointerUp | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onPointerUpCapture | PointerEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onPress | ((e: PressEvent) => void) | undefined | — | Handler that is called when the press is released over the target. | @react-types/shared |
onPressChange | ((isPressed: boolean) => void) | undefined | — | Handler that is called when the press state changes. | @react-types/shared |
onPressEnd | ((e: PressEvent) => void) | undefined | — | Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target. | @react-types/shared |
onPressStart | ((e: PressEvent) => void) | undefined | — | Handler that is called when a press interaction starts. | @react-types/shared |
onPressUp | ((e: PressEvent) => void) | undefined | — | Handler that is called when a press is released over the target, regardless of whether it started on the target or not. | @react-types/shared |
onScroll | UIEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onScrollCapture | UIEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onTouchCancel | TouchEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onTouchCancelCapture | TouchEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onTouchEnd | TouchEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onTouchEndCapture | TouchEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onTouchMove | TouchEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onTouchMoveCapture | TouchEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onTouchStart | TouchEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onTouchStartCapture | TouchEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onTransitionCancel | TransitionEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onTransitionCancelCapture | TransitionEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onTransitionEnd | TransitionEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onTransitionEndCapture | TransitionEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onTransitionRun | TransitionEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onTransitionRunCapture | TransitionEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onTransitionStart | TransitionEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onTransitionStartCapture | TransitionEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onWheel | WheelEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
onWheelCapture | WheelEventHandler<HTMLButtonElement> | undefined | — | — | @react-types/shared |
preventFocusOnPress | boolean | undefined | — | Whether to prevent focus from moving to the button when pressing it. Caution, this can make the button inaccessible and should only be used when alternative keyboard interaction is provided, such as ComboBox's MenuTrigger or a NumberField's increment/decrement control. | react-aria |
render | DOMRenderFunction<"button", ButtonRenderProps> | undefined | — | Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an `<a>`). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate. | react-aria-components |
slot | string | null | undefined | — | A slot name for the component. Slots allow the component to receive props from a parent component. An explicit `null` value indicates that the local props completely override all props received from a parent. | react-aria-components |
style | StyleOrFunction<ButtonRenderProps> | undefined | — | The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the element. A function may be provided to compute the style based on component state. | react-aria-components |
translate | "yes" | "no" | undefined | — | — | @react-types/shared |
type | "button" | "submit" | "reset" | undefined | 'button' | The behavior of the button when used in an HTML form. | react-aria |
value | string | undefined | — | The value associated with the button's name when it's submitted with the form data. | react-aria |
Source: packages/ui/src/components/Fab/Fab.tsx:223
Material fidelity and adaptations
- Family
- FAB
- Provenance
- spec: Material 3 overview · web: Browser and React Aria semantics · adaptation: m3-ui web adaptation
- Compose mapping
- FloatingActionButton · ExtendedFloatingActionButton
- Visual fidelity
- partial: Legacy visual fidelity has not received an explicit reviewed disposition. Current implementation evidence: Implements small, baseline, medium, and large FAB families, matching extended FAB sizes, container-role variants, default/lowered elevation, interactive elevation motion, extended collapse behavior, and the pinned branded/material-web variants present in the audited source surface.
- Behavior fidelity
- adapted: React Aria Button owns action semantics and interaction state. Icon-only FAB content is presentation-only and therefore requires an accessible name; collapsed extended FABs derive one from string label content when possible. Branded and solid/surface variant vocabulary is preserved as an audited Material Web compatibility surface rather than presented as a Compose-only API.
- Semantics fidelity
- adapted: React Aria Button owns action semantics and interaction state. Icon-only FAB content is presentation-only and therefore requires an accessible name; collapsed extended FABs derive one from string label content when possible. Branded and solid/surface variant vocabulary is preserved as an audited Material Web compatibility surface rather than presented as a Compose-only API.
- Adaptations
- React Aria Button owns action semantics and interaction state. Icon-only FAB content is presentation-only and therefore requires an accessible name; collapsed extended FABs derive one from string label content when possible. Branded and solid/surface variant vocabulary is preserved as an audited Material Web compatibility surface rather than presented as a Compose-only API.
The public FabVariant also preserves surface, primary, secondary, and tertiary compatibility variants plus BrandedFloatingActionButton from audited Material Web evidence. Those are explicit cross-source compatibility surfaces, not Compose-only Material APIs.
Related components
- Button — ordinary labeled actions.
- Floating action button menu — a controlled group of related FAB actions.
- Bottom app bar — app-bar composition that may include a FAB.