StealThis .dev

Floating Action Button

A FAB that expands into a speed-dial of sub-actions on click. Supports icon rotation, backdrop, and individual sub-action labels. No libraries.

Open in Lab
css vanilla-js
Targets: JS HTML

Code

Floating Action Button

A Material Design-inspired FAB with an expand animation that reveals sub-action buttons in a speed-dial pattern. The main icon rotates 45° on open to form an × close indicator.

How it works

  1. Clicking the FAB toggles .open on the container
  2. Sub-action buttons stagger in from bottom to top using CSS transition-delay
  3. Each sub-action has an icon button and a label that fades in on the right
  4. A semi-transparent backdrop click closes the FAB

Variants

  • 4 sub-actions: New Post, Upload Photo, Create Story, Add Link
  • Easy to extend with more actions or reduce to 2–3

When to use it

  • Mobile-first dashboards with a primary create action
  • Social apps with multiple content creation types
  • Any app where a traditional toolbar takes too much space