Layouts let you share a consistent page shell — navigation, sidebars, footers — across many routes without duplicating markup. Nuxe discovers everyDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/dvlkit/nuxe/llms.txt
Use this file to discover all available pages before exploring further.
.vue file in app/layouts/ at startup, registers each one by its lowercase filename, and automatically wraps each rendered page in the right layout. You never need to import or register a layout component yourself.
The default layout
layouts/default.vue is the fallback. Any page that does not declare a meta.layout in definePage is automatically wrapped with it. The layout receives the current page as its default slot.
app/layouts/default.vue
Assigning a layout to a page
CalldefinePage inside <script setup> and pass the layout name as meta.layout. The name must match the filename of a file in app/layouts/ (without the .vue extension). definePage is auto-imported — no import statement needed.
app/pages/admin.vue
route.meta.layout, lower-cases the value, and looks it up in the registered layout map — so 'admin' resolves to app/layouts/admin.vue.
Creating layouts
layouts/default.vue
The default layout used for all pages that do not specify one:
app/layouts/default.vue
layouts/admin.vue
A custom layout for admin pages:
app/layouts/admin.vue
Layout name resolution is case-insensitive
Layout names are normalised to lowercase before the lookup. The values'admin', 'Admin', and 'ADMIN' all resolve to app/layouts/admin.vue. This makes it safe to pass layout names from dynamic sources or CMS content without worrying about casing.
Adding a new layout
To introduce a new layout, just create the file — no framework config change needed:Create the layout file
Add
app/layouts/blog.vue with a <slot /> where the page content should appear.app/layouts/blog.vue
app/layouts/ whenever it starts (both in dev and build), so the new layout is picked up automatically.
Manual layout control with <NuxeLayout>
In most cases app/app.vue is the only place you need to reference the layout system — import NuxeLayout from @dvlkit/nuxe/components/nuxe-layout and use it to render the active layout around <RouterView />:
app/app.vue
<NuxeLayout> accepts props:
| Prop | Type | Description |
|---|---|---|
name | string | false | null | Force a specific layout name (overrides route.meta.layout). Pass false to render with no layout. |
fallback | string | null | Layout name to use when the resolved name is not found in the registry. |
transition | boolean | object | Wrap the layout in a <Transition>. Pass true for the default fade transition name, or an object of transition props. |
app/app.vue
Client-only layout content with <ClientOnly>
ClientOnly is auto-imported. It renders a comment node placeholder during SSR and mounts the real content after hydration on the client. Use it inside layouts to wrap anything that depends on browser-only APIs or third-party widgets.
app/layouts/default.vue
<ClientOnly> supports a #fallback slot (or a #placeholder slot — both are equivalent) whose content is rendered on the server and swapped out after hydration.