Speed Dial

A floating button that opens a set of related actions.

Installation

Import the class, and @use the entry point in your global styles: without it the component renders unstyled.

import { Component } from '@angular/core';
import { WrSpeedDial } from 'ngwr/speed-dial';

@Component({ imports: [WrSpeedDial] })
export class MyComponent {}

Basic usage

(pick) emits the action the user clicks.

<wr-speed-dial [actions]="actions" (pick)="onPick($event)" />

Direction

direction is up (default), down, left or right: point it away from the nearest edge.

<wr-speed-dial [actions]="actions" direction="down" />

API

NameDescriptionTypeDefault
actionsThe buttons that fan out when the dial opens, in order from the trigger outwards. Each needs a label: it is the accessible name as well as the tooltip.readonly WrSpeedDialAction[][]
triggerLabelAccessible name of the trigger. Falls back to speedDial.label, then 'Actions' — the trigger is icon-only, so without this it has no name at all.string | nullnull
directionDirection the actions fan out.WrSpeedDialDirection'up'
openTwo-way bindable open state.booleanfalse
iconIcon for the main trigger button.WrIconName'add'
disabledDisable interaction.booleanfalse
safeAreaPad the host toward the dial direction with env(safe-area-inset-*). Only matters when the consumer pins the dial to that edge of the viewport; otherwise it has no effect.booleanfalse
(pick)Fires when the user picks one of the actions.WrSpeedDialAction—

Types

interface WrSpeedDialAction {
  readonly id: string;
  readonly label: string;
  readonly icon?: WrIconName;
}

type WrSpeedDialDirection = 'up' | 'down' | 'left' | 'right';
NameDescriptionTypeDefault
WrSpeedDialActionPer-button action shown when the dial expands.interface—
idrequiredStable identifier for the action.string—
labelrequiredTooltip / accessible label.string—
iconButton icon.WrIconName—
WrSpeedDialDirectionWhich way the fan opens.'up' | 'down' | 'left' | 'right'—

CSS variables

Set these on the component's selector or a wrapper, not on :root: the defaults are declared on ngwr/speed-dial's own element.

VariableDefaultDeclared on
--wr-speed-dial-action-bordervar(--wr-border-base).wr-speed-dial
--wr-speed-dial-action-size2.5rem.wr-speed-dial
--wr-speed-dial-font-familyvar(--wr-font-family-base).wr-speed-dial
--wr-speed-dial-gapvar(--wr-space-md).wr-speed-dial
--wr-speed-dial-size3.25rem.wr-speed-dial

Dependencies

Built onIcon

See also