Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

Components / Inputs

Fab

Floating action button: the one main action on a screen, e.g. "Add customer".

import { Fab } from "@stylhero/ui";

Example

Code
import { Fab, Stack, PlusIcon, SearchIcon } from "@stylhero/ui";

function FabExample() {
  return (
    <Stack direction="row" gap={3} align="center">
      <Fab label="Add"><PlusIcon /></Fab>
      <Fab label="New build" extended tone="accent"><PlusIcon /></Fab>
      <Fab label="Search" size="sm" tone="surface"><SearchIcon /></Fab>
    </Stack>
  );
}

Props

PropTypeDefaultDescription
label required string - Required for the round icon-only version; becomes the aria-label.
extended boolean - Shows the label next to the icon (MUI's variant="extended").
fixed boolean - Pins it to the bottom-right corner of the screen.
size "sm" | "md" "md"
tone "primary" | "accent" | "surface" "primary"

Also takes every <button> attribute (id, style, data-*, aria-*, event handlers…), passed to that element. Takes a ref.

Keyboard

KeyDoes
Enter / SpaceActivates it

Accessibility

  • label is required: it's the accessible name, and the visible text when extended.

Generated from src/components/Fab.tsx. Something wrong or missing? Open an issue.