Component

Speed dial

A floating action button that fans out a set of actions. Drive it from a model, choose the fan shape and direction, tune radius, gap, and stagger, add a backdrop, rotate the trigger icon, and template each action.

Linear actions

Clicked: —

import { ChangeDetectionStrategy, Component, signal } from '@angular/core';

import { HbSpeedDialImports, type HbSpeedDialItem } from '@herbst/ui';
import { provideIcons } from '@ng-icons/core';
import {
  phosphorDownloadSimple,
  phosphorEnvelope,
  phosphorTag,
  phosphorTrash,
} from '@ng-icons/phosphor-icons/regular';

@Component({
  selector: 'hb-demo-speed-dial-basic',
  imports: [HbSpeedDialImports],
  viewProviders: [
    provideIcons({ phosphorTag, phosphorEnvelope, phosphorDownloadSimple, phosphorTrash }),
  ],
  template: `
    <div class="flex h-64 w-full items-end justify-center pb-2">
      <hb-speed-dial
        [hbModel]="items"
        hbRotateIcon
        hbAriaLabel="Actions"
        (hbItemClick)="log.set($any($event).label)"
      />
    </div>
    <p class="text-center font-mono text-[12px] text-muted-foreground">Clicked: {{ log() }}</p>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HbDemoSpeedDialBasicComponent {
  protected readonly log = signal('—');
  protected readonly items: HbSpeedDialItem[] = [
    { icon: 'phosphorTag', label: 'Tag' },
    { icon: 'phosphorEnvelope', label: 'Share' },
    { icon: 'phosphorDownloadSimple', label: 'Download' },
    { icon: 'phosphorTrash', label: 'Delete', disabled: true },
  ];
}

Circle & mask

Quarter-circle & custom item

API reference

hb-speed-dial — model

PropertyDescriptionTypeDefault
[hbModel] The actions. Each item: { icon?, label?, tooltip?, disabled?, command?, ariaLabel?, styleClass?, data? }. HbSpeedDialItem[] []
[(hbVisible)] The open state, two-way bound. boolean false
(hbItemClick) / (hbShow) / (hbHide) Emit the clicked item, and when the dial opens and closes. Each item can also carry its own command(). HbSpeedDialItem / void
ng-template[hbSpeedDialItem] Custom content for each action button. Context: $implicit = item, index. template

hb-speed-dial — layout

PropertyDescriptionTypeDefault
[hbType] The fan shape. 'linear' | 'circle' | 'semi-circle' | 'quarter-circle' 'linear'
[hbDirection] Which way the actions fan out. 'up' | 'down' | 'left' | 'right' | 'up-left' | 'up-right' | 'down-left' | 'down-right' 'up'
[hbRadius] / [hbGap] / [hbItemSize] Circle radius, spacing between linear items, and item size — all in pixels. number 120 / 12 / 36
[hbTransitionDelay] Per-item stagger in milliseconds as the actions appear. number 30

hb-speed-dial — behaviour

PropertyDescriptionTypeDefault
[hbMask] / [hbHideOnClickOutside] Dim the page behind the dial while open, and close it on an outside click. boolean false / true
[hbRotateIcon] Rotate the trigger icon 45° when open (turning a + into an ×). boolean false
[hbIcon] / [hbCloseIcon] / [hbButtonType] The trigger icon names for closed/open, and the button colour for the trigger and items. string / HbButtonType 'phosphorPlus' / 'phosphorX' / 'default'
[hbTooltip] / [hbAriaLabel] Show a tooltip (from item.tooltip or item.label) on each action, and the trigger’s accessible label. boolean / string true / 'Actions'