Skip to main content

BottomAppBar

Bottom app bars show up to four actions and a floating action button at the bottom of a mobile screen. The component follows the Material Design 3 Bottom app bar specification.

The bar is 80dp tall on a surfaceContainer background at elevation level 2. The actions sit at the start, and the FAB sits 16dp from the end.

BottomAppBar is a toolbar, not a navigator

BottomAppBar holds actions for the current screen. For top-level destinations, use NavigationBar.

MD3 now recommends the docked toolbar

MD3 Expressive recommends the docked toolbar in place of the bottom app bar. BottomAppBar stays in the library, with no change.

Usage​

Pass the icon actions as actions, and the FAB as fab. Each action needs an accessibilityLabel. The FAB needs one too, unless it has a label.

import { BottomAppBar } from '@rootnative/components'
import { mdiResolver } from '@rootnative/components/mdi'
import { ThemeProvider } from '@rootnative/core'
import { SafeAreaProvider } from 'react-native-safe-area-context'
import { Text, View } from 'react-native'

export default function App() {
return (
<SafeAreaProvider>
<ThemeProvider iconResolver={mdiResolver}>
<View style={{ flex: 1 }}>
<View style={{ flex: 1, padding: 24 }}>
<Text>Inbox</Text>
</View>
<BottomAppBar
actions={[
{ icon: 'magnify', accessibilityLabel: 'Search', onPress: () => {} },
{ icon: 'archive-outline', accessibilityLabel: 'Archive', onPress: () => {} },
{ icon: 'delete-outline', accessibilityLabel: 'Delete', onPress: () => {} },
]}
fab={{ icon: 'plus', accessibilityLabel: 'Compose', onPress: () => {} }}
insetBottom
/>
</View>
</ThemeProvider>
</SafeAreaProvider>
)
}

MD3 recommends up to four actions. A disabled action takes the MD3 disabled treatment and does not respond.

The FAB​

The bar renders a flat FAB: no shadow, and no lift on hover, with elevated={false}. Its variant is secondary by default. Set variant on the fab object for another color, and label for an extended FAB.

<BottomAppBar
fab={{ icon: 'pencil-outline', label: 'Compose', variant: 'tertiary', onPress: compose }}
/>

Leave fab off for a bar of actions only.

Custom leading content​

leading replaces actions for content that actions cannot build, such as a Menu anchor or a Tooltip. The two props fill the same slot, so the type rejects them together.

<BottomAppBar
leading={
<Menu anchor={<IconButton icon="dots-vertical" accessibilityLabel="More" />}>
<Menu.Item label="Settings" onPress={openSettings} />
</Menu>
}
fab={{ icon: 'plus', accessibilityLabel: 'Add', onPress: add }}
/>

A standard IconButton in the slot takes the action color. Other content reads it with useAppBarContentColor().

Safe area​

A bottom-anchored bar must clear the home indicator. Pass insetBottom to wrap the row in a SafeAreaView that adds the bottom inset below the 80dp of the bar. Leave it off (the default) when an ancestor already applies the bottom edge. Otherwise the inset applies twice.

The side insets are on by default (insetSides). The bar pads its row by the left and right insets, and inside a Layout that pads the sides it pulls its background back through that padding, so in landscape the bar stays full-bleed and the actions stay clear of the notch. Pass insetSides={false} for a bar nested inside content, where the pulled-out background would show beyond its container.

Hide on scroll​

Pass the scroll offset of the content as scrollOffset, and the bar follows the MD3 hide-on-scroll behavior: it moves down by its own height while the content scrolls down, and comes back while the content scrolls up. The bar moves with the scroll, one point for one point. It is always in place at the top of the content.

useScroll from @rootnative/inertia gives the offset and the scroll handler:

import { BottomAppBar } from '@rootnative/components'
import { Motion, useScroll } from '@rootnative/inertia'
import { StyleSheet, View } from 'react-native'
import { useSafeAreaInsets } from 'react-native-safe-area-context'

function Inbox() {
const { scrollY, onScroll } = useScroll()
const insets = useSafeAreaInsets()
const contentStyle = { paddingBottom: 80 + insets.bottom }

return (
<View style={styles.screen}>
<Motion.ScrollView
onScroll={onScroll}
scrollEventThrottle={16}
contentContainerStyle={contentStyle}
>
{messages}
</Motion.ScrollView>
<BottomAppBar
actions={actions}
fab={{ icon: 'plus', accessibilityLabel: 'Compose', onPress: compose }}
insetBottom
scrollOffset={scrollY}
style={styles.bar}
/>
</View>
)
}

const styles = StyleSheet.create({
screen: { flex: 1 },
bar: { position: 'absolute', start: 0, end: 0, bottom: 0 },
})
Place the bar over the content

The bar moves, and the content does not grow into the space. A bar below a flex: 1 content view leaves an empty strip when it hides. Position the bar over the content, as above, and pad the end of the content by the bar height, so the last item can scroll clear of the bar.

The bar moves by its measured height, so the bottom inset of insetBottom moves with it.

iOS automatic content insets

Pad the content as above, and keep contentInsetAdjustmentBehavior at its default, 'never'. With 'automatic', iOS adds the bottom safe-area inset to the scroll view by itself, and the scroll event does not include it. The bar then reads the end of the content about 34 pt too early: movement in that last stretch does not count, so from the very end the bar comes back about 34 pt late.

Overrides​

PropTarget
containerColorThe bar background
contentColorThe action icons, and a standard IconButton in leading
styleThe bar container

The FAB keeps the colors of its variant. Set variant on the fab object to change them.

Tokens​

TokenValue
ContainersurfaceContainer, elevation level 2
Height80dp (+ bottom inset with insetBottom)
Action48dp frame, 24dp icon, onSurfaceVariant; the first icon 16dp from the start
FAB56dp secondaryContainer, flat, 16dp from the end

Source: Compose BottomAppBarTokens and BottomAppBar.kt.

Accessibility​

  • The bar reports role="toolbar". Pass role to replace it.
  • Each action is a button named by its accessibilityLabel.
  • The FAB is a button named by accessibilityLabel, or by label on an extended FAB.
  • A disabled action or FAB exposes accessibilityState.disabled.
  • With scrollOffset, the bar stays in place while a screen reader is on (iOS and Android), so the reader never moves to a control off screen.
  • On the web, focus on a control in a hidden bar brings the bar back, so Tab never reaches a control off screen.

Props​

PropTypeDefaultRequiredDescription
fabBottomAppBarFab-NoThe FAB at the end of the bar. Leave it off for a bar of actions only.
insetBottombooleanNoWhen `true`, wraps the row in a SafeAreaView that adds the bottom inset below the bar's 80dp, so it clears the home indicator. Leave it off when an ancestor (e.g. `Layout` with a `bottom` edge) already handles it.
insetSidesbooleanNoWhen `true`, pads the row by the left and right safe-area insets, and inside a `Layout` that pads the sides pulls the background back through that padding. In landscape the bar stays full-bleed and the actions stay clear of the notch; in portrait both insets are 0. Set it to `false` for a bar nested inside content, where the pulled-out background would show beyond its container.
scrollOffsetSharedValue<number>-NoVertical scroll offset (in px) of the content behind the bar, as a Reanimated shared value. Pass `scrollY` from `@rootnative/inertia`'s `useScroll()` and give the matching `onScroll` to your scroll view: ```tsx import { Motion, useScroll } from '@rootnative/inertia' const { scrollY, onScroll } = useScroll() <Motion.ScrollView onScroll={onScroll} scrollEventThrottle={16}> <BottomAppBar actions={actions} scrollOffset={scrollY} /> ``` Drives the MD3 hide-on-scroll behavior: the bar moves down by its own height while the content scrolls down, and comes back while the content scrolls up. The bar moves and the content does not, so place the bar over the content and pad the end of the content by the bar height. On iOS, keep `contentInsetAdjustmentBehavior` at `'never'` and pad the content instead: with `'automatic'`, the scroll event leaves out the bottom safe-area inset, and the last stretch of the content (about 34 pt) does not move the bar. While a screen reader is on (iOS and Android), the bar stays in place. On web, focus on a control in the bar brings the bar back.
containerColorstringsurfaceContainerNoOverride the bar background.
contentColorstringonSurfaceVariantNoOverride the icon color of the actions. It reaches each standard `IconButton` in `leading` too. The FAB keeps the colors of its variant.
styleStyleProp<ViewStyle>-NoStyle applied to the bar container.
actionsBottomAppBarAction[]-NoIcon actions rendered at the start of the bar. MD3 recommends up to four.
leadingReactNode-NoCustom start content. Use this instead of `actions` when the slot needs a component `actions` cannot build, such as a `Menu` anchor or a `Tooltip`. A standard `IconButton` in the slot takes the action color; other content reads it with `useAppBarContentColor()`.