Tessera UI

FAB

A pill-shaped floating action button with optional leading icon, label, and trailing icon

Installation

pnpm add @tessinaui/ui

Usage

import { Fab } from "@tessinaui/ui";
<Fab label="Create" leadingIcon={<Plus />} />

Playground

Configure every property of the FAB component interactively:

Preview
Loading...

Showcase

All variants, intents, sizes, tones, and states:

Preview
Loading...

API Reference

Props

PropTypeDefaultDescription
labelstringVisible label text
variant"primary" | "secondary" | "ghost" | "outline""primary"Visual style variant
intent"none" | "error" | "warning" | "success" | "info""none"Semantic color intent
tone"default" | "on-color""default"Surface context — use on-color when placing on a colored background
size"xs" | "sm" | "md" | "lg" | "xl""md"Size of the button
leadingIconReact.ReactNodeIcon rendered before the label; replaced by a spinner when loading
trailingIconReact.ReactNodeIcon rendered after the label; hidden when loading
loadingbooleanfalseShows a spinner in place of the leading icon and disables the button
disabledbooleanfalseDisables the button
dir"ltr" | "rtl""ltr"Text direction — RTL reverses icon/label order via CSS flex
aria-labelstringAccessible label (required when no visible label is provided)
onClickMouseEventHandlerClick handler

Supported Combinations

VariantIntents
primaryall
secondaryall
outlinenone, error
ghostnone

Sizes

SizeHeightUse case
xs32pxCompact toolbars
sm40pxSecondary actions
md48pxDefault, most use cases
lg56pxProminent actions
xl96pxHero / landing page CTAs

Tone

The tone prop controls how the button looks on different surfaces:

  • default — standard surfaces (white/gray background)
  • on-color — colored backgrounds (brand, error, etc.). Primary becomes a dark pill; secondary/outline become light pills.

Accessibility

The FAB component:

  • Requires aria-label when used without a visible label
  • focus-visible:ring-2 focus ring meets WCAG 2.1 AA
  • Touch targets ≥ 44×44px for md/lg/xl; xs/sm meet minimum via content padding
  • loading sets aria-busy="true" and disables the button
  • disabled sets pointer-events-none and disabled attribute
  • RTL fully supported via the dir prop

On this page