FloatingActionButton

The primary floating action of a screen.

  • Composed
  • Liquid Glass on iOS 26
  • New in 0.1
import { FloatingActionButton, floatingActionButtonPrimitive } from "nitro-ui-sdk/floating-action-button";
HeroUI Native
FAB (Pro)
Expo UI
FloatingActionButton
  • FloatingActionButton example screen, light appearance
    Light
  • FloatingActionButton example screen, dark appearance
    Dark
  • FloatingActionButton example screen, liquid glass appearance
    Liquid Glass
On this page

The screen’s primary action, floating above the content: compose, add, scan. It is a circle, or a capsule with its label when extended, and draws accent-tinted Liquid Glass by default with a solid accent fallback. It presses with a medium impact. You place it, usually absolute in a bottom corner above the tab bar. Use one per screen at most; use Button for actions that belong to the content.

Anatomy

import { FloatingActionButton } from "nitro-ui-sdk/floating-action-button";

export function Anatomy() {
  return (
    <FloatingActionButton.Root label="New note" icon="plus" extended onPress={() => {}}>
      <FloatingActionButton.Icon />
      <FloatingActionButton.Label />
    </FloatingActionButton.Root>
  );
}
Part Description
FloatingActionButton.Root The native pressable host: name, press, haptic, surface, shadow and feedback.
FloatingActionButton.Icon The decorative glyph in a fixed box. While busy the spinner covers it.
FloatingActionButton.Label The visible text, shown by default only when extended.

Usage

import { View } from "nitro-ui-renderer";
import { FloatingActionButton } from "nitro-ui-sdk/floating-action-button";

export function Inbox({ compose }: { compose: () => void }) {
  return (
    <View layout={{ flex: 1 }}>
      {/* the screen's content */}
      <FloatingActionButton.Root
        label="New message"
        icon="square.and.pencil"
        layout={{ position: "absolute", right: 20, bottom: 24 }}
        onPress={compose}
      />
    </View>
  );
}

Variants and sizes

Variant Look
glass-prominent (default) Accent-tinted Liquid Glass; falls back to a solid accent circle with the overlay shadow.
glass Clear Liquid Glass; falls back to the overlay fill with a border hairline.
primary Solid accent with the overlay shadow.
secondary accentSoft fill.
Size Diameter Glyph
sm 48 20
md (default) 56 24
lg 64 28

extended turns the circle into a capsule of the same height with the label after the glyph.

States

  • Disabled: dims and refuses every press.
  • Busy: an async onPress or busy shows the spinner over the glyph; the shape and the name do not change, and busyLabel is spoken.
  • Pressed: solid variants scale; live glass reacts by itself; Reduce Motion dims instantly.

Liquid Glass

The glass variants draw an interactive MaterialView when the theme has glass on, the OS supports Liquid Glass (iOS 26) and Reduce Transparency is off. The glass carries its own depth, so the shadow is only drawn on the opaque fallback.

import { FloatingActionButton } from "nitro-ui-sdk/floating-action-button";

export function ScanButton({ scan }: { scan: () => void }) {
  return <FloatingActionButton.Root label="Scan" icon="qrcode.viewfinder" variant="glass" size="lg" onPress={scan} />;
}

Props

FloatingActionButton.Root

Prop Type Default Description
label string required The spoken name; the visible text when extended.
icon IconButtonGlyph required SF Symbol name, element or ({ color, size }) => ReactNode.
onPress (details) => void | PromiseLike<unknown> required A returned promise shows the busy state.
extended boolean false Shows the label in a capsule.
variant FloatingActionButtonVariant "glass-prominent" See Variants.
size "sm" | "md" | "lg" "md" See Sizes.
iconFallback ImageLoader — Image for Android and missing symbols.
disabled boolean false Refuses every press.
busy boolean false Shows the pending state.
busyLabel string — Spoken while busy.
hint string — Accessibility hint.
haptic "light" | "medium" | "heavy" | "none" "medium" Impact on a touch press.
api Controller<FloatingActionButtonActions> — From floatingActionButtonPrimitive.createApi().
agentId string — Stable agent identity.
confirm { message, approveLabel, cancelLabel } — Asks before an agent presses.
styles FloatingActionButtonStyles — Per-part style resolvers.
layout LayoutProps — Position it here.
children ReactNode — Custom anatomy.

FloatingActionButton.Icon

Prop Type Default Description
children IconButtonGlyph root’s icon Decorative symbol or rendered glyph.
part FloatingActionButtonPart "icon" Selects the style resolver.

FloatingActionButton.Label

Prop Type Default Description
children string root’s label Visible title.
part FloatingActionButtonPart "label" Selects the style resolver.

Controller API

import { useState } from "react";
import { FloatingActionButton, floatingActionButtonPrimitive } from "nitro-ui-sdk/floating-action-button";

export function Compose({ compose }: { compose: () => void }) {
  const [api] = useState(floatingActionButtonPrimitive.createApi);
  return <FloatingActionButton.Root label="Compose" icon="plus" api={api} onPress={compose} />;
}
Action Signature Result
press (source?: ActionSource) => ActionStatus accepted, disabled (disabled or busy) or refused.

Styles

import { FloatingActionButton, type FloatingActionButtonStyles } from "nitro-ui-sdk/floating-action-button";

const styles: FloatingActionButtonStyles = {
  root: ({ tokens, state }) => ({ style: { cornerRadius: state.extended ? tokens.radius.lg : 999 } }),
};

export function SoftCorners() {
  return <FloatingActionButton.Root label="New list" icon="plus" extended variant="primary" styles={styles} onPress={() => {}} />;
}

Parts: root, icon, label, busyIndicator. The resolver receives { tokens, variant, size, state } with state: { disabled: boolean; busy: boolean; extended: boolean }.

Accessibility

  • One button element named by label, also when the label is not visible.
  • Disabled and busy add notEnabled; busyLabel is the value while busy.
  • Every size is larger than the 44 pt minimum.
  • It floats over content: leave room at the end of scrolling content so the last item can scroll clear of it.

Agent API

Action Arguments Notes
press none Same controller as touch; confirm asks first. Hidden while disabled or busy.

The entry has component: "FloatingActionButton" and role: "button".

Platform notes

iOS Android
Host KitPressable, shared with Button. PressableGroup.
Glass Liquid Glass on iOS 26; solid fallback with shadow.overlay otherwise. Solid fallback with the shadow.
Haptics Medium UIImpactFeedbackGenerator. HapticFeedbackConstants.
Verification Unit, type and iOS harness tests. Kotlin implementation is unbuilt here (no Android NDK).