Skip to content
SENVENLI UI

Floating action button

Keeps one task reachable over scrolling content, as a button or a link, collapsing to its icon on phones.
A task kept in reach
import { Fab } from "@senvenli/react/action";

Examples

Icon only

`iconOnly`: a round button at every width; `label` stays its accessible name.

Guidelines

When to use it

  • One main task must stay reachable while people scroll: contact, new item.

Use something else when

  • The action fits in the page header or a toolbar and need not float. Button
  • People switch between top destinations rather than start a task. Bottom navigation

Do and avoid

  • At most one per screen; never over a dialog or sheet.

Accessibility

Built in

  • Keeps its label as the accessible name when collapsed to an icon.
  • Links that open a new tab say so.

You provide

  • A verb label for the task.

API reference

Fab

childrenRequired
string

The task, as a verb ("Contact us", "New order"), as Button's label; also the name when icon-only.

iconBeforeRequired
IconName

Lucide icon name before the label ("message-circle", "calendar-plus"), as Button's iconBefore.

onPress
(event: PressEvent) => void
href
string

A link (a chat or contact URL) instead of an action; it opens in a new tab unless target says otherwise.

target
HTMLAttributeAnchorTargetDefault "_blank"

Where href opens. _blank (default) follows Link's external convention: noopener noreferrer and the new-tab words for screen readers. _self keeps an in-app link in the page, through the host router.

placement
"inline" | "fixed"Default "fixed"

fixed (default): bottom-end above the safe area. inline: in the flow (previews, docs).

collapseOnScroll
booleanDefault true

Collapse to icon-only on phones after the first scroll (default true).

iconOnly
booleanDefault false

Icon-only at every width, as Button's iconOnly: a round button; label stays its accessible name.