Actionsduskmoonimplemented1 demos

Fab

Fab places a primary action or native popover speed dial near a viewport edge.

Import@duskmoon-dev/components/fab
6API sections
13documented props
2behavior scenarios
Key API
containedstartspeedDiallabelactionsextended

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

authored

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
FabPropsinterface extends Omit<ComponentProps<"div">, "ref">
PropTypeRequiredDescription
containedbooleanNocontained configures Fab.
startbooleanNostart configures Fab.
speedDialbooleanNospeedDial configures Fab.
labelstringNolabel configures Fab.
actionsReactNodeNoactions configures Fab.
extendedbooleanNoextended configures Fab.
buttonPropsOmit<NobuttonProps configures Fab.
FabActionPropsinterface extends FabSectionProps
PropTypeRequiredDescription
labelReactNodeNolabel configures Fab.
FabTriggerPropsinterface extends ButtonProps
PropTypeRequiredDescription
extendedbooleanNoextended configures Fab.
FabComponentinterface extends ForwardRefExoticComponent< FabProps & RefAttributes<HTMLDivElement> >
PropTypeRequiredDescription
TriggerForwardRefExoticComponent<YesTrigger configures Fab.
ActionsForwardRefExoticComponent<YesActions configures Fab.
ActionForwardRefExoticComponent<YesAction configures Fab.
LabelForwardRefExoticComponent<YesLabel configures Fab.
FabSectionPropstype
Type definition
Omit<ComponentProps<"div">, "ref">
FabLabelPropstype
Type definition
Omit<ComponentProps<"span">, "ref">