tapcn
Components

SpeedDial

An expandable floating action button that reveals a set of actions.

SpeedDial

An expandable FAB that fans out a list of secondary actions when pressed. Includes an animated overlay, staggered spring entrance for action items, and a rotating icon on the main button.

Installation

npx @tapcn/cli add speed-dial

Or using shadcn directly:

npx shadcn@latest add https://tapcn.vercel.app/r/speed-dial.json

Usage

import { SpeedDial } from '~/components/ui/speed-dial';
import { Icon } from '~/components/ui/icon';
import { Plus, Camera, Image, FileText } from 'lucide-react-native';

export function SpeedDialExample() {
  return (
    <SpeedDial
      icon={<Icon as={Plus} className="text-primary-foreground" />}
      actions={[
        {
          icon: <Icon as={Camera} className="text-foreground" />,
          label: 'Camera',
          onPress: () => console.log('Camera'),
        },
        {
          icon: <Icon as={Image} className="text-foreground" />,
          label: 'Gallery',
          onPress: () => console.log('Gallery'),
        },
        {
          icon: <Icon as={FileText} className="text-foreground" />,
          label: 'Document',
          onPress: () => console.log('Document'),
        },
      ]}
    />
  );
}

With a custom open icon

<SpeedDial
  icon={<Icon as={Plus} className="text-primary-foreground" />}
  openIcon={<Icon as={X} className="text-primary-foreground" />}
  actions={actions}
/>

Props

SpeedDial

PropTypeDefaultDescription
iconReact.ReactNoderequiredThe icon shown on the main FAB when closed.
openIconReact.ReactNode-Optional icon shown when the dial is open. When omitted, the default icon rotates 45 degrees.
actionsSpeedDialAction[]requiredThe list of action items to display.
position'bottom-right' | 'bottom-left''bottom-right'The absolute position of the speed dial on screen.
classNamestring-Additional NativeWind classes for the container.

SpeedDialAction

PropTypeDefaultDescription
iconReact.ReactNoderequiredThe icon displayed in the mini FAB.
labelstring-Optional text label shown beside the action.
onPress() => voidrequiredCallback fired when the action is pressed.

Dependencies

  • react-native-reanimated -- for enter/exit animations and rotation

On this page