Skip to main content

FloatingActionButton

Floating action button (FAB) for primary screen actions.

Basic Usage

import { FloatingActionButton } from '@multinaire/ui';

<FloatingActionButton
icon="Plus"
title="Add"
onPress={() => {}}
/>

Props

PropTypeDefaultDescription
titlestringButton label text
iconIconNameIcon name displayed alongside the title
reversedbooleanfalseWhen true, the icon is placed after the title instead of before
position'left' | 'center' | 'right''right'Horizontal alignment of the FAB. Defaults to 'right'
widthnumberFixed width of the FAB
heightnumberFixed height of the FAB
marginSpacingPropsOuter margin
animatebooleanfalseWhen true, applies an entrance animation when the button mounts
isLoadingbooleanfalseShow a loading animation and disable the button
testIDstringtitleTest identifier for UI automation. Defaults to the title value
onPress() => voidPress handler. When omitted the button renders in a disabled (dimmed) state

Examples

Basic FAB

<FloatingActionButton
icon="Plus"
title="New"
onPress={() => createNew()}
/>

Icon Only FAB

<FloatingActionButton
icon="Plus"
title=""
width={56}
height={56}
onPress={() => {}}
/>

Different Positions

// Right aligned (default)
<FloatingActionButton
position="right"
icon="Plus"
title="Add"
onPress={() => {}}
/>

// Center aligned
<FloatingActionButton
position="center"
icon="Camera"
title="Capture"
onPress={() => {}}
/>

// Left aligned
<FloatingActionButton
position="left"
icon="Menu"
title="Menu"
onPress={() => {}}
/>

With Animation

<FloatingActionButton
animate
icon="Plus"
title="Create"
onPress={() => {}}
/>

In a Screen Layout

<Container flex={1}>
<ListContainer data={items} renderItem={...} />

<FloatingActionButton
icon="Plus"
title="Add Item"
onPress={() => navigation.navigate('AddItem')}
/>
</Container>