FloatingActionButton
The main action of a screen: a raised button (square like the rest of the library, or round with shape="circle") holding an icon (give it an aria-label), or an icon plus a label when extended. size is sm, md or lg; variant and tooltip work as on Button; color takes a variant name or any CSS color (#2563eb), with the text switching to black or white so it stays readable.
Pass position (for example bottom-right) to fix it to a corner of the viewport; without it the button sits where you put it.
Props
childrenReactNodeThe icon. An icon-only button needs an
aria-label.labelReactNodeText after the icon; makes the button extended.
size'sm' | 'md' | 'lg'Default:'md'Button size (40 / 56 / 64 px for icon-only).
shape'square' | 'circle'Default:'square'Square corners, or a round button (a pill when extended).
variant'default' | 'secondary' | 'flat' | 'success' | 'danger' | 'warning'Default:'default'Visual style (same as Button).
position'bottom-right' | 'bottom-left' | 'bottom-center' | 'top-right' | 'top-left' | 'top-center'Fix the button to a corner of the viewport.
color'default' | 'secondary' | 'flat' | 'success' | 'danger' | 'warning' | stringA variant name, or any CSS color (
#e11d48,royalblue); overridesvariant. Text switches to black or white for contrast.tooltipstringShows a styled Tooltip (same as Button).
styleCSSPropertiesInline styles, merged over those
colorsets.classNamestringDefault:''Extra classes for the root element.
...restAny other props are passed to the underlying element.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | – | The icon. An icon-only button needs an aria-label. |
label | ReactNode | – | Text after the icon; makes the button extended. |
size | 'sm' | 'md' | 'lg' | 'md' | Button size (40 / 56 / 64 px for icon-only). |
shape | 'square' | 'circle' | 'square' | Square corners, or a round button (a pill when extended). |
variant | 'default' | 'secondary' | 'flat' | 'success' | 'danger' | 'warning' | 'default' | Visual style (same as Button). |
position | 'bottom-right' | 'bottom-left' | 'bottom-center' | 'top-right' | 'top-left' | 'top-center' | – | Fix the button to a corner of the viewport. |
color | 'default' | 'secondary' | 'flat' | 'success' | 'danger' | 'warning' | string | – | A variant name, or any CSS color (#e11d48, royalblue); overrides variant. Text switches to black or white for contrast. |
tooltip | string | – | Shows a styled Tooltip (same as Button). |
style | CSSProperties | – | Inline styles, merged over those color sets. |
className | string | '' | Extra classes for the root element. |
...rest | – | Any other props are passed to the underlying element. |