FloatingActionButton
Floating action buttons represent the primary action on a screen. This component implements the M3 Expressive FAB sizes and color styles; label content turns it into an extended FAB.
Action components convert title into the library tooltip. See Action Tooltips for the shared behavior and accessible-name fallback.
Anatomy
| Element | Part | Selector |
|---|---|---|
<component> | root | [data-scope="floating-action-button"][data-part="root"]LMBCopy |
<span> | iconconditional | [data-scope="floating-action-button"][data-part="icon"]LMBCopy |
<span> | labelconditional | [data-scope="floating-action-button"][data-part="label"]LMBCopy |
Props
| Name | Description | Default | Control |
|---|---|---|---|
colorOptional | The color style of the FAB. primary-containerprimarysecondarytertiarysecondary-containertertiary-container | "primary-container" | |
sizeOptional | The size of the FAB. largemediumregular | "regular" | |
hrefOptional | The href attribute. If provided, the FAB will be rendered as an anchor element. string | undefined | undefined | |
iconOptional | Name of the icon. string | undefined | undefined | |
disabledOptional | Whether the FAB is disabled. boolean | undefined | false |
Events0
No events documented.
Slots2
| Name | Parameters | Description |
|---|---|---|
icon | - | Slot for icon content. Will not be used if `icon` prop is set. |
default | - | Label content. When present, the FAB uses the extended layout. |
Styling23
| Token | Description |
|---|---|
--md-fab-container-colorColorFallback var(--md-sys-color-primary-container) | Controls container color. |
--md-fab-icon-colorColorFallback var(--md-sys-color-on-primary-container) | Controls icon color. |
--md-fab-label-text-colorColorFallback var(--md-sys-color-on-primary-container) | Controls label text color. |
--md-fab-state-layer-colorColorFallback var(--md-sys-color-on-primary-container) | Controls state layer color. |
--md-fab-container-elevationElevationFallback var(--md-sys-elevation-level3) | Controls container elevation. |
--md-fab-hovered-container-elevationElevationFallback var(--md-sys-elevation-level4) | Controls hovered container elevation. |
--md-fab-focused-container-elevationElevationFallback var(--md-sys-elevation-level3) | Controls focused container elevation. |
--md-fab-pressed-container-elevationElevationFallback var(--md-sys-elevation-level3) | Controls pressed container elevation. |
--md-fab-container-heightSizeFallback 56px, 80px, or 96px depending on size | Controls container height. |
--md-fab-container-widthSizeFallback 56px, 80px, or 96px depending on size | Controls icon-only container width. |
--md-fab-container-shapeShapeFallback var(--md-shape-fab-regular), var(--md-shape-fab-medium), or var(--md-shape-fab-large) depending on size | Controls container shape. |
--md-fab-icon-sizeSizeFallback 24px, 28px, or 36px depending on size | Controls icon size. |
--md-fab-leading-spaceSpacingFallback 16px, 26px, or 28px depending on size | Controls extended FAB leading space. |
--md-fab-icon-label-spaceSpacingFallback 8px, 12px, or 16px depending on size | Controls space between icon and label. |
--md-fab-trailing-spaceSpacingFallback 16px, 26px, or 28px depending on size | Controls extended FAB trailing space. |
--md-fab-focus-indicator-colorFocusFallback var(--md-sys-color-primary) | Controls focus indicator color. |
--md-fab-focus-indicator-thicknessFocusFallback var(--md-sys-state-focus-indicator-thickness) | Controls focus indicator thickness. |
--md-fab-focus-indicator-outline-offsetFocusFallback var(--md-sys-state-focus-indicator-outer-offset) | Controls focus indicator outline offset. |
--md-fab-disabled-container-colorDisabledFallback var(--md-sys-color-on-surface) | Controls disabled container color. |
--md-fab-disabled-container-opacityDisabledFallback 0.1 | Controls disabled container opacity. |
--md-fab-disabled-container-elevationDisabledFallback var(--md-sys-elevation-level0) | Controls disabled container elevation. |
--md-fab-disabled-content-colorDisabledFallback var(--md-sys-color-on-surface) | Controls disabled icon and label color. |
--md-fab-disabled-content-opacityDisabledFallback 0.38 | Controls disabled icon and label opacity. |
Examples
Default
Extended
Sizes
Colors
Disabled
Tooltip
title is converted into the library tooltip instead of rendering a native HTML tooltip. It is also used as the fallback aria-label when no explicit accessible name is provided.