πŸš€ SpeedDial Component

A floating action button (FAB) with an expandable action menu. Supports multiple layout types including linear, circle, semi-circle, and quarter-circle arrangements. Features staggered animations, tooltips, and full keyboard accessibility.

Linear Layout

Default

Items arranged in a straight line. Choose from four directions: up, down, left, or right. Perfect for edge-of-screen positioning.

Direction: Up

Direction: Down

Direction: Left

Direction: Right

View Code Example
<script>
  import SpeedDial from '$lib/components/SpeedDial.svelte';

  const actions = [
    { id: 'add', label: 'Add', icon: 'βž•', onclick: () => console.log('Add') },
    { id: 'edit', label: 'Edit', icon: '✏️', onclick: () => console.log('Edit') },
    { id: 'delete', label: 'Delete', icon: 'πŸ—‘οΈ', onclick: () => console.log('Delete') }
  ];
</script>

<SpeedDial {actions} direction="up" />
<SpeedDial {actions} direction="down" />
<SpeedDial {actions} direction="left" />
<SpeedDial {actions} direction="right" />

Circle Layout

360Β°

Items arranged in a full circle around the button. Great for center-of-screen positioning or when you need many actions accessible from all directions.

View Code Example
<SpeedDial
  actions={actions}
  type="circle"
  direction="up"
  radius={90}
/>

Semi-Circle Layout

180Β°

Items arranged in a half-circle. Ideal for edge positioning where the button is near a screen boundary.

Direction: Up

Direction: Down

Direction: Left

Direction: Right

View Code Example
<SpeedDial
  actions={actions}
  type="semi-circle"
  direction="up"
  radius={80}
/>

Quarter-Circle Layout

90Β°

Items arranged in a quarter-circle arc. Perfect for corner positioning where the button sits at the corner of the screen.

Top-Left Corner
Top-Right Corner
Bottom-Left Corner
Bottom-Right Corner
View Code Example
<!-- Bottom-right corner positioning -->
<div class="fixed bottom-4 right-4">
  <SpeedDial
    actions={actions}
    type="quarter-circle"
    direction="up"
    radius={70}
  />
</div>

With Modal Mask

Add a semi-transparent backdrop when the menu is open. Useful for focusing user attention and providing a clear dismiss target.

View Code Example
<SpeedDial
  actions={actions}
  direction="up"
  mask={true}
/>

Social Sharing

SVG Icons

Use custom SVG icons for a polished look. The icon prop accepts emoji, HTML strings, or SVG markup.

View Code Example
const socialActions = [
  {
    id: 'facebook',
    label: 'Facebook',
    icon: '<svg>...</svg>',
    onclick: () => shareToFacebook()
  },
  // ...more actions
];

<SpeedDial
  actions={socialActions}
  type="semi-circle"
  direction="up"
  radius={80}
  buttonLabel="Share"
/>

Custom Button Icon

Replace the default plus icon with your own. Use the buttonIcon prop to set a custom icon.

Emoji Icon

SVG Icon

View Code Example
<!-- Emoji button icon -->
<SpeedDial
  actions={actions}
  buttonIcon="☰"
  buttonLabel="Menu"
/>

<!-- SVG button icon -->
<SpeedDial
  actions={actions}
  buttonIcon={menuIcon}
  buttonLabel="Navigation"
/>

Animation Timing

Control the stagger delay between item animations with the transitionDelay prop. Higher values create more dramatic cascading effects.

No Delay (0ms)

Default (30ms)

Slow (100ms)

View Code Example
<SpeedDial actions={actions} transitionDelay={0} />   <!-- Simultaneous -->
<SpeedDial actions={actions} transitionDelay={30} />  <!-- Default cascade -->
<SpeedDial actions={actions} transitionDelay={100} /> <!-- Dramatic cascade -->

Tooltip Positions

Tooltips auto-position based on direction, or set explicitly with tooltipPosition. Disable tooltips entirely with showTooltip={false}.

Top Tooltips

Bottom Tooltips

No Tooltips

View Code Example
<SpeedDial actions={actions} tooltipPosition="top" />
<SpeedDial actions={actions} tooltipPosition="bottom" />
<SpeedDial actions={actions} showTooltip={false} />

Component Features

🎯

Multiple Layouts

Linear, circle, semi-circle, and quarter-circle arrangements for any use case.

🎬

Smooth Animations

Staggered entrance/exit with configurable timing and GPU-accelerated transforms.

πŸ’¬

Smart Tooltips

Auto-positioning tooltips with manual override options and smooth transitions.

🎭

Modal Mask

Optional backdrop overlay for focused interactions and easy dismissal.

⌨️

Keyboard Accessible

Full keyboard navigation with Tab, Enter, and Escape support.

🎨

Customisable

Custom icons, colours, and styling. Works with emoji, SVG, or HTML icons.

πŸŒ™

Dark Mode

Automatic dark mode support via CSS media queries.

πŸš€

Zero Dependencies

Pure Svelte 5 with no external libraries. Copy-paste ready.

Props Reference

PropTypeDefaultDescription
actionsSpeedDialAction[][]Array of action items to display
direction'up' | 'down' | 'left' | 'right''up'Direction for linear layouts / start angle for circular
type'linear' | 'circle' | 'semi-circle' | 'quarter-circle''linear'Layout arrangement of action items
radiusnumber80Distance from center for circular layouts (px)
transitionDelaynumber30Stagger delay between item animations (ms)
showTooltipbooleantrueShow tooltip labels on hover
tooltipPosition'auto' | 'left' | 'right' | 'top' | 'bottom''auto'Position of tooltips relative to items
maskbooleanfalseShow modal backdrop when open
disabledbooleanfalseDisable the SpeedDial
buttonIconstring'+' SVGCustom icon for main button (emoji, HTML, or SVG)
buttonLabelstring'Open menu'Accessible label for main button
isOpenbooleanfalseBindable state for open/closed

SpeedDialAction Interface

PropertyTypeRequiredDescription
idstringYesUnique identifier for the action
labelstringYesAccessible label (shown in tooltip)
iconstringYesEmoji, HTML, or SVG string for icon
onclick() => voidNoCallback when action is clicked
disabledbooleanNoDisable this action
classstringNoAdditional CSS classes

Quick Start Guide

1

Copy the Component

Copy SpeedDial.svelte from src/lib/components/ and the type definitions from src/lib/types.ts to your project.

2

Define Your Actions

Create an array of SpeedDialAction objects with id, label, icon, and onclick handler for each action.

3

Choose Layout & Position

Select the layout type and direction that fits your UI. Position the SpeedDial using CSS (e.g., fixed bottom-4 right-4).