In layouts/default.vue , add named slots
Nuxt 3 Layout Slots: Complete Guide 2026
Master Nuxt 3 layout slots in 2026 for dynamic, reusable components. These powerful features allow injecting content into predefined layout areas, streamlining complex UIs without props drilling.
Our step-by-step guide covers setup, usage, fallbacks, and advanced patterns for Vue 3-powered apps.
Step 1: Define Layout Slots
like <slot name="header" /> . This creates
In layouts/default.vue, add named slots like <slot name="header" />. This creates placeholders.
- Use
namefor specificity. - Fallback content with
<template #header>.
"nuxt 3 layout slots is most useful when readers can compare options quickly."
Step 2: Using Slots in Pages
In pages, fill slots: <NuxtLayout><template #header>Content</template></NuxtLayout>
.
In pages, fill slots: <NuxtLayout><template #header>Content</template></NuxtLayout>.
- 1. Wrap content in NuxtLayout.
- 2. Target slots by name.
- 3. Combine with head() for meta.
Step 3: Dynamic Slot Filling
Pass data via provide/inject or composables
for conditional content.
Pass data via provide/inject or composables for conditional content.
- Use useState() for reactivity.
- Handle multiple layouts.
Step 4: Nested Layouts
Extend with sub-layouts for dashboards or
apps.
Extend with sub-layouts for dashboards or apps.
- Define _type: 'nested'.
- Cascade slots down.
Advanced: Scoped Slots & Fallbacks
missing content gracefully.
Pass props to slots and manage missing content gracefully.
- <slot name="sidebar" :items="items">.
- Global fallbacks in layout.
Best Practices 2026
Optimize for SSR, use TypeScript, and
test with Vitest.
Optimize for SSR, use TypeScript, and test with Vitest.
- Avoid deep nesting.
- Leverage Nuxt UI modules.