Actionsduskmoonimplemented1 demos
Fab
Fab places a primary action or native popover speed dial near a viewport edge.
Import
@duskmoon-dev/components/fab6API sections
13documented props
2behavior scenarios
Usage
When to use
- Use it when users need to move between sections, pages, steps, or contextual actions.
- Expose current and disabled state so navigation remains clear to keyboard and screen-reader users.
Implementation notes
StylesheetImport @duskmoon-dev/components/styles.css once in the app or docs shell.
StateStart with default props for static examples, then switch to controlled props when state must be shared.
ThemeThe preview inherits the active DuskMoon data-theme value from the docs layout.
Features
Wayfinding
Covers the route, section, step, or action-list patterns that help users move through an interface.
Current state
Shows selected, active, open, or current props where the component exposes them.
Primary API surface
Fab is most often configured through `contained`, `start`, `speedDial`, `label`.
Covered behavior
Links a native trigger to its speed-dial popover
Feature Demos
Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.
Preview
New message
New note
Selected action: None
Interactive usage
Open the browser-managed action panel and choose a real action.
Source
import { useState } from "react";
import "@duskmoon-dev/components/styles.css";
import { Fab, Button } from "@duskmoon-dev/components";
export function FabDemo() {
const [action, setAction] = useState("None");
return <div style={{ position: "relative", minHeight: 220 }}>
<Fab contained speedDial>
<Fab.Trigger aria-label="Create" shape="square">+</Fab.Trigger>
<Fab.Actions>
<Fab.Action><Fab.Label>New message</Fab.Label>
<Button type="button" aria-label="New message" onClick={() => setAction("Message")}>✉</Button>
</Fab.Action>
<Fab.Action><Fab.Label>New note</Fab.Label>
<Button type="button" aria-label="New note" onClick={() => setAction("Note")}>✎</Button>
</Fab.Action>
</Fab.Actions>
</Fab>
<p>Selected action: {action}</p>
</div>;
}API
The API reference below lists every parsed exported type or interface for Fab. Start with `contained`, `start`, `speedDial`, `label` for common usage.
Types:
packages/components/src/components/fab/Fab.types.tsScenarios: packages/components/src/components/fab/Fab.test.tsx| Prop | Type | Required | Description |
|---|---|---|---|
contained | boolean | No | contained configures Fab. |
start | boolean | No | start configures Fab. |
speedDial | boolean | No | speedDial configures Fab. |
label | string | No | label configures Fab. |
actions | ReactNode | No | actions configures Fab. |
extended | boolean | No | extended configures Fab. |
buttonProps | Omit< | No | buttonProps configures Fab. |
| Prop | Type | Required | Description |
|---|---|---|---|
label | ReactNode | No | label configures Fab. |
| Prop | Type | Required | Description |
|---|---|---|---|
extended | boolean | No | extended configures Fab. |
| Prop | Type | Required | Description |
|---|---|---|---|
Trigger | ForwardRefExoticComponent< | Yes | Trigger configures Fab. |
Actions | ForwardRefExoticComponent< | Yes | Actions configures Fab. |
Action | ForwardRefExoticComponent< | Yes | Action configures Fab. |
Label | ForwardRefExoticComponent< | Yes | Label configures Fab. |
Type definition
Omit<ComponentProps<"div">, "ref">Type definition
Omit<ComponentProps<"span">, "ref">