This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 54).
Expo Router Toolbar
An Expo Router submodule that provides native toolbar components.
Toolbar is currently in alpha and available in canary releases ofexpo-router. Using the toolbar together with tabs is not supported at the moment.
expo-router/unstable-toolbar is a submodule of expo-router and exports components to add a native toolbar to your app.
See the Expo Router reference for more information about the file-based routing library for native and web app.
Installation
To use expo-router/unstable-toolbar in your project, you need to install expo-router in your project. Follow the instructions from Expo Router's installation guide:
Learn how to install Expo Router in your project.
API
import { Toolbar } from 'expo-router/unstable-toolbar';
Components
Type: React.Element<ToolbarProps>
A component that provides a bottom toolbar.
Example
import { Toolbar } from "expo-router"; export default function MyScreen() { return ( <> <YourScreenContent /> <Toolbar> <Toolbar.Spacer /> <Toolbar.Button icon="magnifyingglass" tintColor={Color.ios.placeholderText} /> <Toolbar.View style={{ width: 200 }}> <TextInput placeholder="Search" /> </Toolbar.View> <Toolbar.Menu icon="ellipsis"> <Toolbar.MenuAction icon="mail" title="Send email" onPress={() => {}} /> <Toolbar.MenuAction icon="trash" title="Delete" destructive onPress={() => {}} /> </Toolbar.Menu> <Toolbar.Spacer /> </Toolbar> </> ); }
ReactNodeType: React.Element<ToolbarButtonProps>
A button component for use in the toolbar.
It should only be used as a child of Toolbar.
Example
<Toolbar> <Toolbar.Button icon="magnifyingglass" tintColor={Color.ios.placeholderText} /> <Toolbar.Button>Text Button</Toolbar.Button> <Toolbar.Button hidden={!isSearchFocused} icon="xmark" onPress={handleClear} /> </Toolbar>
stringThe text label for the button.
Note: When icon is used, the label will not be shown and will be used for accessibility purposes only.
Example
import { Toolbar } from 'expo-router/unstable-toolbar'; ... <Toolbar.Button>This is button label</Toolbar.Button>
booleanWhether to hide the shared background.
See: Official Apple documentation for more information.
SFSymbols6_0The name of the SF Symbol to display as the button icon. For a list of available symbols, see SF Symbols.
booleanWhether the button is in a selected state
See: Official Apple documentation for more information.
boolean • Default: falseWhether to separate the background of this item from other header items.
Note: Text buttons cannot share the background.
This prop reverses the native behavior of sharesBackground.
See: Official Apple documentation for more information.
string • Default: 'plain'See: Official Apple documentation for more information.
Acceptable values are: 'done' | 'plain' | 'prominent'
Type: React.ReactNode<LinkMenuProps>
Adds a context menu for to a toolbar.
For available props, see LinkMenuProps.
Example
<Toolbar> <Toolbar.Menu title="Options"> <Toolbar.MenuAction title="Action 1" onPress={() => {}} /> <Toolbar.MenuAction title="Action 2" onPress={() => {}} /> </Toolbar.Menu> </Toolbar>
For available props, see LinkMenuProps.
booleanWhether to hide the shared background when sharesBackground is enabled.
Only available for root level menus.
See: Official Apple documentation for more information.
boolean • Default: trueWhether the button shares the background with adjacent toolbar items.
Note: Text buttons cannot share the background.
Only available for root level menus.
See: Official Apple documentation for more information.
Type: React.Element<LinkMenuActionProps>
A single action item within a toolbar menu.
For available props, see LinkMenuActionProps.
Example
<Toolbar> <Toolbar.Menu title="Options"> <Toolbar.MenuAction title="Action 1" onPress={() => {}} /> <Toolbar.MenuAction title="Action 2" onPress={() => {}} /> </Toolbar.Menu> </Toolbar>
Type: React.Element<ToolbarSpacerProps>
A spacer component for the toolbar.
Without a width, it creates a flexible spacer that expands to fill available space.
With a width, it creates a fixed-width spacer.
It should only be used as a child of Toolbar.
Example
<Toolbar> <Toolbar.Spacer /> <Toolbar.Button icon="magnifyingglass" /> <Toolbar.Spacer width={20} /> <Toolbar.Button icon="mic" /> <Toolbar.Spacer /> </Toolbar>
booleanWhether to hide the shared background when sharesBackground is enabled.
See: Official Apple documentation for more information.
boolean • Default: falseWhether the spacer shares the background with adjacent toolbar items.
See: Official Apple documentation for more information.
numberBy default, the spacer is flexible and expands to fill available space. If a width is provided, it creates a fixed-width spacer.
Type: React.Element<ToolbarViewProps>
A custom view component for the toolbar that can contain any React elements.
Useful for embedding custom components.
It should only be used as a child of Toolbar.
The items within the view will be absolutely positioned, so flexbox styles will not work as expected.
Example
<Toolbar> <Toolbar.Spacer /> <Toolbar.View style={{ width: 200 }}> <TextInput placeholder="Search" placeholderTextColor={Color.ios.placeholderText} /> </Toolbar.View> <Toolbar.View separateBackground style={{ width: 32, height: 32 }}> <Pressable onPress={handlePress}> <SymbolView name="plus" size={22} /> </Pressable> </Toolbar.View> </Toolbar>
ReactNode