FloatingButton
Since 0.1.0-alpha.22A 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
@* 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:
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
@* 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
| Feature | Static | Interactive |
|---|---|---|
| Stays in its corner as the page scrolls, above a sticky footer | Yes | Yes |
| Follows a link, posts a form or runs C# | Yes | Yes |
| OnClick runs C# | No | Yes |
Static: static server-side rendering, with no circuit and no WebAssembly. Interactive: Server, WebAssembly or Auto.
Accessibility
Parameters
| Prop | Type | Default |
|---|---|---|
IconThe icon, such as Lucide.Plus. | IconData | Required |
LabelWhat it does, such as "New invoice": its accessible name, and its text with ShowLabel. | string | Required |
ShowLabelShows Label beside the icon, for a main action an icon alone wouldn't name. | bool | false |
PlacementWhere it sits. | FloatPlacement | FloatPlacement.BottomEnd |
RoundMakes it round (a pill with ShowLabel). | bool | false |
AccentIts color. | Accent | Accent.Primary |
SizeIts size. | ControlSize | ControlSize.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. | bool | false |
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. | bool | false |
OnClickRuns on click on interactive pages (a link still navigates). | EventCallback<MouseEventArgs> |
Plus 4 common props.
Full APISee also
- Button: submits or resets a form, follows a link or runs C#.
- IconButton: shows a square icon button with a required label.