FloatingButton
Pre-alphaThe registry and the CLI are not published yet.Roadmap

FloatingButton

A button floating above the content, in thumb reach, for the main action of a screen.

Weekly reportNumbers are up 12%
IdeasOffline mode, share sheet
GroceriesMilk, eggs, coffee
Trip to PortoFlights on Friday, 9:40
Gift listBooks for Ada

New note

The button floats above the list, at the bottom of the screen and in thumb reach. It stays in place while the content scrolls under it.

Installation

npx axiom add floating-button
pnpm dlx axiom add floating-button
yarn dlx axiom add floating-button
bun x axiom add floating-button

Also copies: tappable, icon, text.

Installs: react-native-reanimated, react-native-safe-area-context.

Usage

Render it last in the screen container. It positions itself above the bottom safe area.

import { FloatingButton } from "@/components/ui/floating-button";

<View style={{ flex: 1 }}>
	<NotesList />
	<FloatingButton icon="edit" label="New note" onPress={createNote} />
</View>;

Variants

solid · tinted · md · sm

Extended

New note

Map

solid and tinted, in md (52pt) and sm (44pt), icon only or extended with a label.

Props

PropTypeDefaultDescription
iconIconNameRequired. An icon of your registry.
labelstringMakes the button extended: icon and text.
accessibilityLabelstringlabelRequired when there is no label.
variant'solid' | 'tinted''solid'solid for the main action, tinted for a quieter floating control.
size'sm' | 'md''md'44 or 52pt, from the control size tokens. An extended button grows with larger system text.
placement'bottom-end' | 'bottom-center' | 'bottom-start''bottom-end'Where it floats. The screen margin and the safe area are added for you.
offsetnumber0Extra distance from the bottom, for instance the height of a tab bar.
visiblebooleantrueShows or hides the button with a scale and fade. Hidden, it ignores touches and screen readers.
onPress() => voidCalled when the press ends on the button.
disabledbooleanfalseBlocks presses and uses the disabled tokens.
styleStyleProp<ViewStyle>Extra styles for the button.

Colors come from floatingButton.<variant>.{default,pressed,disabled}.{background,foreground,border} in the component tokens. Placement and the show / hide animation live in use-floating-button.ts, shared by every styling variant.

Use cases

Main action of a list

The extended button says what it creates. Keep the label to one or two words.

Weekly reportNumbers are up 12%
IdeasOffline mode, share sheet
GroceriesMilk, eggs, coffee

New note

<FloatingButton icon="edit" label="New note" onPress={createNote} />

Hide while scrolling down

Content under the button stays readable. Show it again as soon as the user scrolls up.

Weekly reportNumbers are up 12%
IdeasOffline mode, share sheet
GroceriesMilk, eggs, coffee
<FloatingButton
	icon="add"
	accessibilityLabel="New note"
	visible={!scrollingDown}
	onPress={createNote}
/>

Above a tab bar

offset keeps the button above the bar, never over it.

Weekly reportNumbers are up 12%
IdeasOffline mode, share sheet
HomeSearchActivityProfile
<FloatingButton
	icon="add"
	accessibilityLabel="New post"
	offset={tabBarHeight}
	onPress={compose}
/>

Guidelines

  • One floating button per screen, for the action the screen exists for.
  • Several related actions (note, checklist, photo) are a floating action menu.
  • Leave room at the bottom of scrolling content, so the last item isn’t hidden under the button.