Components / Inputs
SpeedDial
A Fab that opens a few related actions, each with a visible label.
import { SpeedDial } from "@stylhero/ui";
Example
Code
import { Box, SpeedDial, MailIcon, PlusIcon, SearchIcon } from "@stylhero/ui";
function SpeedDialExample() {
return (
<Box p={4} style={{ minHeight: 220, display: "flex", alignItems: "flex-end" }}>
<SpeedDial label="Quick actions" actions={[
{ label: "New build", icon: <PlusIcon />, onClick: () => {} },
{ label: "Search parts", icon: <SearchIcon />, onClick: () => {} },
{ label: "Email", icon: <MailIcon />, onClick: () => {} },
]} />
</Box>
);
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
actions required |
SpeedDialAction[] |
- | |
label required |
string |
- | Accessible name of the main button, e.g. "Quick actions". |
direction |
"up" | "left" |
"up" |
Which way the actions fan out. |
fixed |
boolean |
- | |
icon |
ReactNode |
- | Main button icon; defaults to a plus that turns into an X. |
Also takes every <div> attribute (id, style, data-*, aria-*, event handlers…), passed to that element.
Types
type SpeedDialAction = { label: string; icon: ReactNode; onClick: () => void };
Keyboard
| Key | Does |
|---|---|
| Enter / Space | Opens the actions |
| Tab | Moves through the actions |
| Esc | Closes them |
Accessibility
- The main button has
aria-expandedandaria-controls; each action is a labelled button.
Generated from src/components/Fab.tsx. Something wrong or missing? Open an issue.