--- title: Stack description: Learn how to use the Stack Layout in Expo Router. --- import { FileTree } from '~/ui/components/FileTree'; import { BoxLink } from '~/ui/components/BoxLink'; import { BookOpen02Icon } from '@expo/styleguide-icons'; The `Stack` Layout in Expo Router wraps the [Native Stack Navigator](https://reactnavigation.org/docs/native-stack-navigator) from React Navigation, not to be confused with the legacy [JS Stack Navigator](https://reactnavigation.org/docs/stack-navigator). To create a `Stack` layout with two screens as shown in the file structure above: ```js app/_layout.js import { Stack } from 'expo-router/stack'; export default function Layout() { return ; } ``` ## Configure header bar Use the `screenOptions` prop to configure the header bar. ```jsx app/_layout.js import { Stack } from 'expo-router'; export default function Layout() { return ( ); } ``` You can use a layout's Screen component to configure the header bar dynamically from within the route. This is good for interactions that change the UI. ```jsx app/home.js import { Link, Stack } from 'expo-router'; import { Image, Text, View } from 'react-native'; function LogoTitle() { return ( ); } export default function Home() { return ( , }} /> Home Screen Go to Details ); } ``` You can use the imperative API `router.setParams()` function to configure the route dynamically. ```jsx app/details.js import { View, Text } from 'react-native'; import { Stack, useLocalSearchParams, useRouter } from 'expo-router'; export default function Details() { const router = useRouter(); const params = useLocalSearchParams(); return ( { router.setParams({ name: 'Updated' }); }}> Update the title ); } ``` ## Header buttons With the following file structure: You can use the `` component in the layout component route to statically configure screen options. This is useful for tab bars or drawers which need to have an icon defined ahead of time. ```jsx app/_layout.js import { Stack } from 'expo-router'; export default function Layout() { return ( /* @end */ {/* Optionally configure static options outside the route. */} /* @info */ /* @end */ ); } ``` Use the `` component in the child route to dynamically configure options. ```jsx app/home.js import { Button, Text, Image } from 'react-native'; /* @info */ import { Stack } from 'expo-router'; /* @end */ function LogoTitle() { return ( ); } export default function Home() { const [count, setCount] = React.useState(0); return ( <> /* @info */ , headerRight: () =>