Back to elements
ElementMiscFree

Speed Dial React component

A floating action button that opens into a short menu of actions: the plus turns into a close cross while actions spring out one after another in a line or a quarter-circle fan, each with a label, with an optional dimmed backdrop and full keyboard control.

When to use the Speed Dial component

Use Speed Dial on mobile-first screens and canvases where one floating button should lead to a few related actions: create note / photo / file, share options, quick tools.

Keep it to three to six actions; for more, open a menu or a sheet instead.

Installation

Add the Speed Dial component to your project with the shadcn CLI. It lands in components/speed-dial.tsx as plain React + Tailwind CSS source you own and can edit.

Install
Copied!
npx shadcn@latest add https://reactframe.com/r/speed-dial.json

Or copy the source by hand and install its dependencies:

Install
Copied!
npm install motion clsx tailwind-merge

Props

<SpeedDial /> accepts 9 props, all optional.

  • actions
    { label: string; icon: SpeedDialIcon | React.ReactNode; onClick?: () => void }[]
    Default: DEFAULT_ACTIONS
  • direction

    Which way the actions open. radial fans them over a quarter circle.

    "up" | "down" | "left" | "right" | "radial"
    Default: "up"
  • openOnHover

    Open on hover as well as on click.

    boolean
    Default: false
  • backdrop

    Dim everything behind while open.

    boolean
    Default: false
  • corner

    Corner of the positioned parent (or the screen) to sit in.

    "bottom-right" | "bottom-left" | "top-right" | "top-left"
    Default: "bottom-right"
  • contained

    Place it inside the nearest positioned ancestor instead of fixed on the screen.

    boolean
    Default: false
  • label
    string
    Default: "Quick actions"
  • theme
    "dark" | "light"
    Default: "dark"
  • className
    string

FAQ

Which direction should it open?
Up for a bottom corner, left or right along an edge, and the fan when there's room diagonally. Labels automatically sit on the side facing into the screen.
Can it be used with a keyboard?
Yes. It's a menu button: arrow keys move from the main button into the actions and between them, Enter runs one, and Escape closes and returns focus.
Does it cover the page?
Only if you set backdrop, which dims everything behind and closes on click. Without it the page stays usable around the open menu.

More Misc components

Animate on Scroll
Free
Payment Button
Free
Focus Trap
Free
Scroll Progress Bar
Free
Icon Swap Toggle
Free
Social Links
Free