Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

SpeedDial

Since 0.1.0-alpha.22
Gathers a page's create actions behind one button in a corner.

A floating button that opens a line of actions, such as the things a page can create: a speed dial (Material's name; a FAB menu in other libraries). The button sits in a corner of the window like FloatingButton and turns into a close button while the actions show.

Things to create

Set Label to name the button, and give each SpeedDialAction an Icon and a Label, shown beside it. An action is a link (Href), a form post (Submit) or C# (OnClick). The button spins into a close button while the actions show; SpinIcon="false" swaps the icons without turning.

Static

Preview

Code

Usage.razor
@inject NavigationManager Navigation

@* The things an invoices page can create, from one button in the corner. Each action is a link,
   so it works on static pages too; here it stays on this page. *@
<Stack Gap="4" Padding="4">
    <Heading Level="1" Size="TextSize.Xl">Invoices</Heading>
    @if (Created is not null)
    {
        <Alert Status="Status.Info">New @Created.</Alert>
    }
    <Stack Gap="2">
        @foreach (var i in Enumerable.Range(1, 12))
        {
            <Card Padding="3">Invoice @(1040 + i)</Card>
        }
    </Stack>
</Stack>
<SpeedDial Label="Create">
    <SpeedDialAction Icon="Lucide.FileText" Label="Invoice" Href="@To("invoice")" />
    <SpeedDialAction Icon="Lucide.UserPlus" Label="Customer" Href="@To("customer")" />
    <SpeedDialAction Icon="Lucide.Package" Label="Product" Href="@To("product")" />
</SpeedDial>

@code {
    [SupplyParameterFromQuery(Name = "create")] private string? Created { get; set; }

    private string To(string what) => Navigation.GetUriWithQueryParameter("create", what);
}

Add this example to a page with the izzy CLI:

bash
izzy add component SpeedDial --at <file>:<line>

Icons that open on hover

To show only the icons, with the labels as tooltips, set ShowLabels="false". To open as the pointer comes over the button, set OpenOn="SpeedDialTrigger.Hover"; a click or tap still opens it. Direction opens the actions down, or toward the start or end, Icon and OpenIcon change the button's icons, and Round makes it round, as here.

Static

Preview

Code

Hover.razor
@inject NavigationManager Navigation

@* A document's tools as icons that open as the pointer comes over the button; each label is its
   tooltip. A click or tap opens them too. *@
<Stack Gap="4" Padding="4">
    <Heading Level="1" Size="TextSize.Xl">Q3 report</Heading>
    @if (Done is not null)
    {
        <Alert Status="Status.Info">@Done.</Alert>
    }
    <TextBlock Color="Color.Muted">Revenue grew 12% over the quarter, led by the new annual plans.</TextBlock>
</Stack>
<SpeedDial Label="Document tools" Icon="Lucide.Ellipsis" OpenOn="SpeedDialTrigger.Hover" ShowLabels="false" Round>
    <SpeedDialAction Icon="Lucide.Share2" Label="Share" Href="@To("Shared")" />
    <SpeedDialAction Icon="Lucide.Printer" Label="Print" Href="@To("Printed")" />
    <SpeedDialAction Icon="Lucide.Copy" Label="Duplicate" Href="@To("Duplicated")" />
</SpeedDial>

@code {
    [SupplyParameterFromQuery(Name = "done")] private string? Done { get; set; }

    private string To(string what) => Navigation.GetUriWithQueryParameter("done", what);
}

Details

It's built on the Popover API, as Menu is: the button opens the actions with no script, and Escape or a click outside closes them. The labels show beside the actions (ShowLabels); with ShowLabels="false", or opening toward the start or end, the actions are icons and the labels their tooltips. OpenOn="Hover" opens it as the pointer comes over the button, with script.

Parts

Written inside SpeedDial. The API page lists their parameters.

  • SpeedDialAction: one action of a SpeedDial: a round icon with its label beside it, or as its tooltip.

Mode support

What works in each mode, SpeedDial
FeatureStaticInteractive
Opens and closes with JavaScript offYesYes
Actions are links, form posts or C#YesYes
Opens on hover (OpenOn)YesYes
Arrow keys between the actionsYesYes

Static: static server-side rendering, with no circuit and no WebAssembly. Interactive: Server, WebAssembly or Auto.

Without JavaScript

Every page starts as plain HTML: before IzzyBlazor's script loads on a static page, while an interactive page prerenders, and with JavaScript off. With JavaScript off, the button opens and closes the actions, but arrow keys don't move between them, and OpenOn="Hover" opens on click.

Accessibility

  • The button is named by Label, and says whether the actions show (aria-expanded).
  • With script, the actions are a menu of menuitems named by the button; with JavaScript off, they're plain links and buttons.
  • Each action is named by its Label, shown or as its tooltip.
  • Opening it focuses the first action, nearest the button; Escape or a choice brings focus back.

Keyboard navigation

On the button

SpeedDial keys, On the button
Press this keyTo do this
Enter or SpaceOpen the actions at the first
UpOpen the actions at the nearest (Down, Left or Right when they open that way)

In the actions

SpeedDial keys, In the actions
Press this keyTo do this
Up or DownMove away from the button and back toward it, wrapping (Left and Right when they open toward the start or end)
Home or EndGo to the first or last
LettersJump to the next action starting with them
Enter or SpaceChoose one
EscapeClose and go back to the button
TabClose the actions and move on

Parameters

SpeedDial parameters
PropTypeDefault
LabelThe button's name, such as "Create": what the actions have in common.stringRequired
IconThe button's icon.IconData?computed
OpenIconThe button's icon while the actions show.IconData?computed
PlacementWhere the button sits.FloatPlacementFloatPlacement.BottomEnd
AccentThe button's color.AccentAccent.Primary
RoundMakes the button round.boolfalse
SpinIconSpins the button's icon into OpenIcon as the actions open, and back (the default).booltrue
DirectionWhich way the actions open from the button.SpeedDialDirectionSpeedDialDirection.Up
OpenOnWhat opens it: a click (the default), or the pointer coming over the button.SpeedDialTriggerSpeedDialTrigger.Click
ShowLabelsShows each action's label beside it (the default), clear on touch screens and with JavaScript off.booltrue
PanelWidthThe width of the menu panel, such as Length.Rem(16) for a column of long labels.Length?computed
ChildContentThe MenuItems, MenuGroups and MenuDividers.RenderFragment?
@bind-OpenWhether it is open.boolfalse
IdThe element id.string?

See also

  • FloatingButton: floats the page's main action in a corner of the window.
  • Menu: opens a popover menu of links, form posts and actions.

Connection lost

Rejoining the server…