Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

FloatingButton

Since 0.1.0-alpha.22
Floats the page's main action in a corner of the window.

A floating action button: fixed to a bottom corner of the window, raised and large, where it stays as the page scrolls. For the page's main action, such as adding an item; one per page. An icon alone by default, named by Label; ShowLabel shows the label beside it. In an AppShell it sits above a sticky footer.

A floating action button

A floating button stays in the window's bottom corner, raised and large, for the page's main action. Set Icon, and set Label to name it; the label is required.

Static

Preview

Code

Usage.razor
@* A floating action button: fixed to the window's bottom corner, raised, where it stays as the
   list scrolls. *@
<Stack Gap="4" Padding="4">
    <Heading Level="1" Size="TextSize.Xl">Invoices</Heading>
    <Stack Gap="2">
        @foreach (var i in Enumerable.Range(1, 12))
        {
            <Card Padding="3">Invoice @(1040 + i)</Card>
        }
    </Stack>
</Stack>
<FloatingButton Icon="Lucide.Plus" Label="New invoice" />

Add this example to a page with the izzy CLI:

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

Keep one per page. To make it round, set Round.

With its label

For a main action an icon alone wouldn't name, set ShowLabel to show the label beside the icon. Placement puts this one at the bottom center. For several actions from one button, use a SpeedDial.

Static

Preview

Code

WithLabel.razor
@* A floating button with its label beside the icon (ShowLabel), centered at the bottom with Position. *@
<Stack Gap="4" Padding="4">
    <Heading Level="1" Size="TextSize.Xl">Inbox</Heading>
    <Stack Gap="2">
        @foreach (var i in Enumerable.Range(1, 12))
        {
            <Card Padding="3">Message @i</Card>
        }
    </Stack>
</Stack>
<FloatingButton Icon="Lucide.Pencil" Label="Compose" ShowLabel Placement="FloatPlacement.BottomCenter" />

Mode support

What works in each mode, FloatingButton
FeatureStaticInteractive
Stays in its corner as the page scrolls, above a sticky footerYesYes
Follows a link, posts a form or runs C#YesYes
OnClick runs C#NoYes

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

Accessibility

  • It renders a native button, or an a with Href, named by Label; with only the icon showing, the label is its aria-label and, with script, its tooltip.
  • It comes after the page's content in the tab order, where it's written: put it at the end of the page's markup.

Parameters

FloatingButton parameters
PropTypeDefault
IconThe icon, such as Lucide.Plus.IconDataRequired
LabelWhat it does, such as "New invoice": its accessible name, and its text with ShowLabel.stringRequired
ShowLabelShows Label beside the icon, for a main action an icon alone wouldn't name.boolfalse
PlacementWhere it sits.FloatPlacementFloatPlacement.BottomEnd
RoundMakes it round (a pill with ShowLabel).boolfalse
AccentIts color.AccentAccent.Primary
SizeIts size.ControlSizeControlSize.Lg
HrefMakes it a link to this address.string?
SubmitMakes it a submit button for the form around it, or the one named by Form.boolfalse
NameThe name a submit button posts with its Value.string?
ValueThe value a submit button posts under its Name.string?
FormActionAn address a submit button posts to in place of its form's.string?
FormThe id of the form a submit button belongs to, when it's outside it.string?
DisabledTurns it off.boolfalse
OnClickRuns on click on interactive pages (a link still navigates).EventCallback<MouseEventArgs>

See also

  • Button: submits or resets a form, follows a link or runs C#.
  • IconButton: shows a square icon button with a required label.

Connection lost

Rejoining the server…