StealThis .dev

FAB Speed Dial

Floating action button that expands into a speed dial with labeled sub-actions on click, with backdrop and close-on-outside-click.

Open in Lab
css vanilla-js
Targets: JS HTML

Code

FAB Speed Dial

A Material Design-inspired Floating Action Button (FAB) that expands into a speed dial menu on click. Sub-actions fan upward with staggered animation, each with a label tooltip. A semi-transparent backdrop closes the menu when clicked outside.

How it works

  1. Clicking the FAB toggles an .is-open class on the container
  2. Sub-action buttons stagger in using CSS custom property --i for delay offsets
  3. The backdrop element captures outside clicks to dismiss the menu
  4. The FAB icon rotates 45° to signal the open state (× shape)
  5. aria-expanded and aria-label update dynamically for screen readers

Actions

  • Share — forward/share icon
  • Edit — pencil icon
  • Bookmark — bookmark icon
  • Delete — trash icon

Keyboard & Accessibility

  • FAB is a <button> with aria-expanded and aria-controls
  • Each sub-action has a descriptive aria-label
  • Focus is trapped within open dial; Escape closes it

When to use it

  • Mobile-first interfaces needing a compact action hub
  • Dashboard pages with contextual quick-actions
  • Content management UIs (create, share, organize)