SpeedDial
SpeedDial provides an expanding floating action group that fans out into secondary action pills with staggered spring animations, optional backdrop dimming, and full tactile haptic support.
Usage
import { useState } from 'react';import { SpeedDial } from '@masumdev/rn-ui';import { FileText, QrCode, Upload } from 'lucide-react-native';
export function SpeedDialExample() { const [open, setOpen] = useState(false);
return ( <SpeedDial open={open} onOpenChange={setOpen} tone="primary" placement="bottom-end" offset={20} actions={[ { id: 'doc', label: 'Create Document', icon: ({ color, size }) => <FileText color={color} size={size} />, onPress: () => console.log('Create Doc'), }, { id: 'qr', label: 'Scan QR Code', icon: ({ color, size }) => <QrCode color={color} size={size} />, tone: 'accent', onPress: () => console.log('Scan QR'), }, { id: 'upload', label: 'Upload File', icon: ({ color, size }) => <Upload color={color} size={size} />, tone: 'success', onPress: () => console.log('Upload File'), }, ]} /> );}Props API
| Prop | Type | Default | Description |
|---|---|---|---|
actions* | SpeedDialActionItem[] | — | List of secondary action items revealed on expansion. |
open | boolean | — | Controlled expanded open state. |
defaultOpen | boolean | false | Uncontrolled initial open state. |
onOpenChange | (open: boolean) => void | — | Callback fired when expanded state changes. |
icon | RenderIcon | — | Custom main icon (defaults to plus icon rotated by 45deg on open). |
activeIcon | RenderIcon | — | Icon displayed when expanded (bypasses default 45deg rotation). |
placement | "bottom-end" | "bottom-start" | "top-end" | "top-start" | "bottom-end" | Screen anchor placement. |
offset | number | 20 | Offset distance in points from screen edges. |
tone | ComponentTone | "primary" | Color tone for the main floating action button. |
size | "sm" | "md" | "lg" | "md" | Dimension scale for main and secondary action buttons. |
overlay | boolean | true | Render semi-transparent backdrop behind expanded actions. |
overlayColor | string | — | Custom backdrop overlay background color. |
haptic | boolean | true | Enable tactile feedback on expand and action selection. |
glass | boolean | false | Enable translucent glassmorphism label styling. |
SpeedDialActionItem
| Prop | Type | Default | Description |
|---|---|---|---|
id* | string | — | Unique identifier for the action item. |
icon* | RenderIcon | — | Action icon element or render function. |
label | string | — | Text label badge displayed next to the action button. |
tone | ComponentTone | — | Color tone override for this specific action button. |
disabled | boolean | false | Whether this action button is disabled. |
onPress* | () => void | — | Callback fired when action button is pressed. |