--- title: "" description: The component is required to display pages located in the pages/ directory. links: - label: Source icon: i-simple-icons-github to: https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/pages/runtime/page.ts size: xs --- `` is a built-in component that comes with Nuxt. It lets you display top-level or nested pages located in the [`pages/`](/docs/guide/directory-structure/pages) directory. ::callout `` is a wrapper around [``](https://router.vuejs.org/api/interfaces/RouterViewProps.html#interface-routerviewprops) component from Vue Router. :br It accepts same `name` and `route` props. :: ::callout{color="amber" icon="i-ph-warning-duotone"} `` should be used instead of `` as the former takes additional care on internal states. Otherwise, `useRoute()` may return incorrect paths. :: ## Props - `name`: tells `RouterView` to render the component with the corresponding name in the matched route record's components option. - type: `string` - `route`: route location that has all of its components resolved. - type: `RouteLocationNormalized` - `pageKey`: control when the `NuxtPage` component is re-rendered. - type: `string` or `function` - `transition`: define global transitions for all pages rendered with the `NuxtPage` component. - type: `boolean` or `TransitionProps` - `keepalive`: control state preservation of pages rendered with the `NuxtPage` component. - type: `boolean` or `KeepAliveProps` ::callout Nuxt automatically resolves the `name` and `route` by scanning and rendering all Vue component files found in the `/pages` directory. :: ## Example For example, passing `static` key, `NuxtPage` component is rendered only once when it is mounted. ```vue [app.vue] ``` You can also use a dynamic key based on the current route: ```html ``` ::callout{color="amber" icon="i-ph-warning-duotone"} Don't use `$route` object here as it can cause problems with how `` renders pages with ``. :: Alternatively, `pageKey` can be passed as a `key` value via [`definePageMeta`](/docs/api/utils/define-page-meta) from the ` ``` :link-example{to="/docs/examples/routing/pages"} ## Page's Ref To get the `ref` of a page component, access it through `ref.value.pageRef` ````vue [app.vue] ```` ## Custom Props In addition, `` also accepts custom props that you may need to pass further down the hierarchy. These custom props are accessible via `attrs` in the Nuxt app. ```html ``` For example, in the above example, the value of `foobar` will be available using `$attrs.foobar` in the template or `useAttrs().foobar` in `