React Native · Components
Fab
Floating action button (FAB) and speed dial; same API as Fab on web.
Live example
The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.
Preview
- Record 1Last edited: today
- Record 2Last edited: today
- Record 3Last edited: today
- Record 4Last edited: today
- Record 5Last edited: today
- Record 6Last edited: today
- Record 7Last edited: today
- Record 8Last edited: today
- Record 9Last edited: today
- Record 10Last edited: today
- Record 11Last edited: today
- Record 12Last edited: today
- Record 13Last edited: today
- Record 14Last edited: today
- Record 15Last edited: today
- Record 16Last edited: today
- Record 17Last edited: today
- Record 18Last edited: today
- Record 19Last edited: today
- Record 20Last edited: today
- Record 21Last edited: today
- Record 22Last edited: today
- Record 23Last edited: today
- Record 24Last edited: today
- Record 25Last edited: today
- Record 26Last edited: today
- Record 27Last edited: today
- Record 28Last edited: today
- Record 29Last edited: today
- Record 30Last edited: today
Code
Events
- Events appear here when you interact with the preview.
By area: stays in place in a scrolled list, shrinks when scrolling down
- Record 1Last edited: today
- Record 2Last edited: today
- Record 3Last edited: today
- Record 4Last edited: today
- Record 5Last edited: today
- Record 6Last edited: today
- Record 7Last edited: today
- Record 8Last edited: today
- Record 9Last edited: today
- Record 10Last edited: today
- Record 11Last edited: today
- Record 12Last edited: today
- Record 13Last edited: today
- Record 14Last edited: today
- Record 15Last edited: today
- Record 16Last edited: today
- Record 17Last edited: today
- Record 18Last edited: today
- Record 19Last edited: today
- Record 20Last edited: today
- Record 21Last edited: today
- Record 22Last edited: today
- Record 23Last edited: today
- Record 24Last edited: today
- Record 25Last edited: today
Narrow card: opens sideways if there's no room above, labels move to tooltips
Centered, with backdrop, surface appearance
Import
Fab
componentFloating action button (FAB) and speed dial; same API as Fab on web. It sits in the corner of the area you put it in or of the screen; when actions are given, pressing it springs open small action buttons one after another.
- Smart direction:
direction="auto"picks the direction the actions fit in. - Mobile: action names show as labels readable at thumb reach; tapping outside and the Android back button close the menu; touch areas are at least 44 dp. With
scroll+scrollBehaviorit hides or shrinks while the list scrolls (only the Fab re-renders). - Animations run on the native driver (
transform/opacity); they turn off with the "reduce motion" preference. Looks the same on iOS and Android.
Examples
FabPosition
typeCorner or edge center of the area Fab sits in (same as web).
FabDirection
typeDirection the actions open in. "auto" tries vertical first (a button at the bottom opens up, at the top opens down); sideways if there is not enough room.
FabScope
typeWhat the button is positioned against.
"container": the corner of the view you put the Fab in (put it next to the scrolling content as a sibling; it does not scroll with the content)."viewport": the corner of the screen; put the Fab in the screen's root view. Notch and home indicator insets (safe area) are added automatically.
FabActionLabels
typeHow action names are shown: "visible" a label next to each small button, "tooltip" a tooltip only on long press, "auto" labels when opening vertically, tooltips when opening sideways.
Behavior on scroll (relative to the list bound with scroll): "none" stays in place, "hide" shrinks and disappears while scrolling down, "shrink" an extended button shrinks to just the icon.
FabVariant
typeVariant: solid filled color, surface a colored icon on a light surface.
FabAction
interfaceOne of the small action buttons that appear when Fab opens (same fields as on web).
| Name | Type | Default | Description |
|---|---|---|---|
label | string | Name of the action; shown in the label or tooltip and read by screen readers. | |
icon | IconProp | Icon on the small button: a name or an element. | |
tone? | Tone | "neutral" | Icon color. |
disabled? | boolean | Cannot be selected. | |
tooltip? | TooltipProp | Extra tooltip. With actionLabels="tooltip", label is shown if omitted. | |
onSelect? | (event: { preventDefault: () => void; }) => void | Called when selected; then the menu closes. Call event.preventDefault() if you want it to stay open. | |
href? | string | When given, this address opens when selected (openLink). |
FabProps
interfaceProps of the Fab component.
| Name | Type | Default | Description |
|---|---|---|---|
label | string | Button name. Read by screen readers; written on the button if extended, otherwise a tooltip. | |
icon? | IconProp | Plus (+) | Button icon. |
openIcon? | IconProp | Icon that replaces the icon while the menu is open. The default plus rotates into a cross when opened; if you gave your own icon it swaps with a cross. | |
extended? | boolean | Also writes label next to the icon (an extended, pill-shaped FAB). | |
actions? | readonly FabAction[] | Small action buttons that spring open when pressed (speed dial). The first action is the one closest to the main button. If omitted the button is a single action. | |
onPress? | () => void | Called when pressed while there are no actions. | |
href? | string | When given and there are no actions, this address opens when pressed (openLink). | |
position? | FabPosition | "bottom-right" | Position in the area. |
direction? | FabDirection | "auto" | Direction the actions open in. |
scope? | FabScope | "container" | What it is positioned against. |
offset? | number | 16 | Distance from the edges (dp). Increase it by the tab bar height if there is one at the bottom. |
variant? | FabVariant | (string & {}) | "solid" | Variant: a built-in one or a name added with appearance.variants.fab. Defaults to appearance.defaults.fab.variant. |
effect? | EffectProp | Effect of the main button. Defaults to appearance.defaults.fab.effect, or "scale". | |
tone? | Tone | "primary" | Color. |
size? | Size | "md" | Size: sm 40, md 56, lg 64 dp. |
actionLabels? | FabActionLabels | "auto" | How action names are shown. |
scrim? | boolean | false | Draws a semi-transparent scrim over the area while the menu is open. |
scrollBehavior? | FabScrollBehavior | "none" | Behavior on scroll; needs scroll. |
scroll? | ScrollTracker | The tracked list (useScrollTracker); for scrollBehavior. | |
tooltip? | TooltipProp | Tooltip. Defaults to label on a button without text; turn off with false. | |
open? | boolean | Whether the menu is open in controlled use. | |
defaultOpen? | boolean | false | Open initially in uncontrolled use? |
onOpenChange? | (open: boolean) => void | Called with the new state when the menu opens or closes. | |
disabled? | boolean | Disabled. | |
style? | ViewStyle | Style of the main button. | |
testID? | string | Test id (main button). |