The Tabs layout is React Navigation's bottom tab navigator, bundled inside Expo Router since SDK 56. A production tab bar needs more than one button per file. It has icons that change with focus, a badge for unread items, and routes that live in the tab folder without a button. SDK 58 also changed which routes get a button, so a tabs layout written for an older SDK can lose tabs after the upgrade.
Key terms
- tabBarIcon: a
Tabs.Screenoption that takes a function receiving{ focused, color }and returns the element drawn in the tab bar. - tabBarBadge: an option that shows a number or a string in a badge on the tab icon.
- href: an option Expo Router adds to
Tabs.Screen, which accepts anHrefornull. - hidden: the tab option that removes a route's tab item, which Expo Router sets when
hrefisnull.
The expo-router/js-tabs entry point
Import the navigator from its own entry point:
tsximport { Tabs } from 'expo-router/js-tabs';
import { Tabs } from 'expo-router' still resolves, but the SDK 58 types mark that export @deprecated and point to expo-router/js-tabs. The JavaScript tabs guide still uses the old path in its layout examples, so code copied from it carries the deprecated import. If you are moving an app off React Navigation, @react-navigation/bottom-tabs maps to expo-router/js-tabs.
Options for every tab, options for one
screenOptions on Tabs applies options to every tab, and options on a Tabs.Screen applies them to one. Their type is React Navigation's BottomTabNavigationOptions plus Expo Router's href. These are the ones a tab bar needs first:
tabBarActiveTintColorcolors the icon and label of the active tab, andtabBarInactiveTintColorcolors those of the inactive tabs.tabBarIconreceivesfocusedandcolor, so one function can draw a filled icon for the focused tab and an outline for the others.titlesets the screen title.tabBarLabelsets the tab's label and falls back to the title when it is undefined, andtabBarShowLabel: falsehides the label (the default istrue).tabBarBadgetakes a number or a string.headerShowndefaults totrue, so every tab draws a header until you turn it off.
JavaScript tab screens are also lazy by default: a screen renders the first time the user opens it, unless you set lazy: false.
The habit tracker layout below has index, inbox and profile tabs. TabIcon and useUnreadCount stand for your own icon component and data hook, which are left out to keep the example on the navigator.
The tint colors live in screenOptions because every tab shares them. On index, tabBarIcon picks the icon name from focused, and inbox hands the unread count to tabBarBadge only when it is above zero. The last declaration, <Tabs.Screen name="scan" options={{ href: null }} />, depends on the SDK 58 rules for tab buttons.
Which routes get a tab button
In SDK 58, JavaScript tabs, native tabs, top tabs, drawer and headless tabs show only the screens declared in the layout. Every file in (tabs) is still registered in navigation state, but only a route that the layout declares and doesn't hide becomes a tab item. A screen counts as declared only when it comes from the layout, never when Expo Router infers it from the file system. Older SDKs added the files of the folder automatically, so a layout upgraded to SDK 58 loses every tab it never declared.
href: null removes the button of a declared route: Expo Router turns it into hidden: true on that screen, and a hidden screen has no tab item. Leaving the file undeclared gives the same result on screen, so declaring scan with href: null is a readability choice that keeps every route of the folder listed in one layout.
Hidden or undeclared, the route still has a URL. When a link or a deep link focuses it, the tabs navigator replaces it with the layout's initial route or, failing that, the first visible tab. The JavaScript tabs guide still describes href: null as keeping a route while removing its button, which reads as if the screen stayed reachable inside the tabs. A screen that must open from a link without having a tab button belongs in a navigator that can show it, such as the root Stack.
Other href and declaration rules
A Tabs layout with no Tabs.Screen children renders nothing, and in development it warns that only screens declared in the layout become visible. The index file is the tab selected when the app loads.
A non-null href turns the tab button into a link to that href. That lets a dynamic route such as [user] always open the same profile from its tab. Setting href and tabBarButton on the same Tabs.Screen throws an error ("Cannot use href and tabBarButton together."), so pick one way to control the button.
Code Examples
// src/app/(tabs)/_layout.tsx
import { Tabs } from 'expo-router/js-tabs';
// Your own icon component and data hook
import { TabIcon } from '@/components/TabIcon';
import { useUnreadCount } from '@/hooks/useUnreadCount';
export default function TabLayout() {
const unread = useUnreadCount();
return (
<Tabs
screenOptions={{
tabBarActiveTintColor: '#0a7ea4',
tabBarInactiveTintColor: '#8a8f98',
}}
>
<Tabs.Screen
name="index"
options={{
title: 'Today',
tabBarIcon: ({ focused, color }) => (
<TabIcon name={focused ? 'calendar-filled' : 'calendar'} color={color} />
),
}}
/>
<Tabs.Screen
name="inbox"
options={{
title: 'Inbox',
tabBarBadge: unread > 0 ? unread : undefined,
tabBarIcon: ({ color }) => <TabIcon name="inbox" color={color} />,
}}
/>
<Tabs.Screen
name="profile"
options={{
title: 'Profile',
tabBarIcon: ({ color }) => <TabIcon name="person" color={color} />,
}}
/>
{/* scan.tsx stays registered but gets no tab button */}
<Tabs.Screen name="scan" options={{ href: null }} />
</Tabs>
);
}