@nuxt/docs 3.20.2 → 3.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/1.getting-started/01.introduction.md +4 -4
  2. package/1.getting-started/02.installation.md +4 -7
  3. package/1.getting-started/03.configuration.md +29 -29
  4. package/1.getting-started/04.views.md +6 -4
  5. package/1.getting-started/05.assets.md +2 -2
  6. package/1.getting-started/06.styling.md +22 -16
  7. package/1.getting-started/07.routing.md +6 -6
  8. package/1.getting-started/08.seo-meta.md +8 -4
  9. package/1.getting-started/09.transitions.md +6 -6
  10. package/1.getting-started/10.data-fetching.md +18 -18
  11. package/1.getting-started/11.state-management.md +5 -5
  12. package/1.getting-started/12.error-handling.md +25 -19
  13. package/1.getting-started/13.server.md +9 -9
  14. package/1.getting-started/14.layers.md +49 -15
  15. package/1.getting-started/15.prerendering.md +10 -4
  16. package/1.getting-started/16.deployment.md +2 -1
  17. package/1.getting-started/17.testing.md +17 -7
  18. package/1.getting-started/18.upgrade.md +111 -60
  19. package/2.directory-structure/0.output.md +1 -1
  20. package/2.directory-structure/1.assets.md +1 -1
  21. package/2.directory-structure/1.components.md +12 -8
  22. package/2.directory-structure/1.composables.md +2 -2
  23. package/2.directory-structure/1.content.md +1 -1
  24. package/2.directory-structure/1.layers.md +87 -0
  25. package/2.directory-structure/1.layouts.md +35 -3
  26. package/2.directory-structure/1.middleware.md +7 -7
  27. package/2.directory-structure/1.modules.md +8 -2
  28. package/2.directory-structure/1.node_modules.md +1 -1
  29. package/2.directory-structure/1.pages.md +39 -18
  30. package/2.directory-structure/1.plugins.md +4 -1
  31. package/2.directory-structure/1.public.md +1 -1
  32. package/2.directory-structure/1.server.md +28 -8
  33. package/2.directory-structure/1.shared.md +3 -3
  34. package/2.directory-structure/1.utils.md +2 -2
  35. package/2.directory-structure/2.env.md +3 -3
  36. package/2.directory-structure/2.nuxtignore.md +1 -0
  37. package/2.directory-structure/2.nuxtrc.md +5 -2
  38. package/2.directory-structure/3.app-config.md +2 -2
  39. package/2.directory-structure/3.app.md +3 -3
  40. package/2.directory-structure/3.error.md +9 -5
  41. package/2.directory-structure/3.nuxt-config.md +1 -1
  42. package/2.directory-structure/3.package.md +1 -1
  43. package/2.directory-structure/3.tsconfig.md +3 -2
  44. package/2.directory-structure/index.md +12 -8
  45. package/3.guide/0.index.md +8 -2
  46. package/3.guide/1.concepts/{3.rendering.md → 1.rendering.md} +7 -32
  47. package/3.guide/1.concepts/{2.vuejs-development.md → 10.vuejs-development.md} +9 -8
  48. package/3.guide/1.concepts/{10.nuxt-lifecycle.md → 2.nuxt-lifecycle.md} +31 -24
  49. package/3.guide/1.concepts/{1.auto-imports.md → 3.auto-imports.md} +6 -6
  50. package/3.guide/1.concepts/4.server-engine.md +2 -2
  51. package/3.guide/1.concepts/5.modules.md +14 -1
  52. package/3.guide/1.concepts/7.esm.md +5 -4
  53. package/3.guide/1.concepts/8.typescript.md +9 -15
  54. package/3.guide/1.concepts/9.code-style.md +1 -1
  55. package/3.guide/2.best-practices/hydration.md +1 -1
  56. package/3.guide/2.best-practices/performance.md +5 -5
  57. package/3.guide/3.ai/.navigation.yml +3 -0
  58. package/3.guide/3.ai/1.mcp.md +277 -0
  59. package/3.guide/3.ai/2.llms-txt.md +65 -0
  60. package/3.guide/4.modules/.navigation.yml +3 -0
  61. package/3.guide/4.modules/1.getting-started.md +103 -0
  62. package/3.guide/4.modules/2.module-anatomy.md +138 -0
  63. package/3.guide/4.modules/3.recipes-basics.md +330 -0
  64. package/3.guide/4.modules/4.recipes-advanced.md +243 -0
  65. package/3.guide/4.modules/5.testing.md +76 -0
  66. package/3.guide/4.modules/6.best-practices.md +104 -0
  67. package/3.guide/4.modules/7.ecosystem.md +32 -0
  68. package/3.guide/4.modules/index.md +36 -0
  69. package/3.guide/{3.recipes → 5.recipes}/1.custom-routing.md +3 -3
  70. package/3.guide/{3.recipes → 5.recipes}/2.vite-plugin.md +4 -0
  71. package/3.guide/{3.recipes → 5.recipes}/3.custom-usefetch.md +2 -2
  72. package/3.guide/{3.recipes → 5.recipes}/4.sessions-and-authentication.md +2 -2
  73. package/3.guide/{4.going-further → 6.going-further}/1.events.md +3 -4
  74. package/3.guide/{4.going-further → 6.going-further}/1.experimental-features.md +211 -86
  75. package/3.guide/6.going-further/1.features.md +108 -0
  76. package/3.guide/{4.going-further → 6.going-further}/1.internals.md +4 -3
  77. package/3.guide/{4.going-further → 6.going-further}/10.runtime-config.md +2 -2
  78. package/3.guide/{4.going-further → 6.going-further}/11.nightly-release-channel.md +1 -1
  79. package/3.guide/{4.going-further → 6.going-further}/2.hooks.md +5 -5
  80. package/3.guide/{4.going-further → 6.going-further}/4.kit.md +3 -3
  81. package/3.guide/{4.going-further → 6.going-further}/6.nuxt-app.md +6 -6
  82. package/3.guide/{4.going-further → 6.going-further}/7.layers.md +31 -5
  83. package/3.guide/{4.going-further → 6.going-further}/9.debugging.md +3 -2
  84. package/4.api/1.components/1.nuxt-client-fallback.md +5 -1
  85. package/4.api/1.components/10.nuxt-picture.md +1 -1
  86. package/4.api/1.components/11.teleports.md +2 -2
  87. package/4.api/1.components/12.nuxt-route-announcer.md +0 -2
  88. package/4.api/1.components/13.nuxt-time.md +0 -2
  89. package/4.api/1.components/2.nuxt-page.md +3 -3
  90. package/4.api/1.components/3.nuxt-layout.md +6 -6
  91. package/4.api/1.components/4.nuxt-link.md +13 -13
  92. package/4.api/1.components/5.nuxt-loading-indicator.md +1 -1
  93. package/4.api/1.components/6.nuxt-error-boundary.md +2 -2
  94. package/4.api/1.components/7.nuxt-welcome.md +2 -2
  95. package/4.api/1.components/8.nuxt-island.md +9 -2
  96. package/4.api/2.composables/use-app-config.md +1 -1
  97. package/4.api/2.composables/use-async-data.md +5 -5
  98. package/4.api/2.composables/use-cookie.md +16 -16
  99. package/4.api/2.composables/use-error.md +3 -3
  100. package/4.api/2.composables/use-fetch.md +37 -37
  101. package/4.api/2.composables/use-head-safe.md +1 -1
  102. package/4.api/2.composables/use-head.md +22 -7
  103. package/4.api/2.composables/use-lazy-async-data.md +1 -1
  104. package/4.api/2.composables/use-lazy-fetch.md +9 -9
  105. package/4.api/2.composables/use-nuxt-app.md +9 -7
  106. package/4.api/2.composables/use-route-announcer.md +0 -2
  107. package/4.api/2.composables/use-route.md +2 -2
  108. package/4.api/2.composables/use-router.md +15 -15
  109. package/4.api/2.composables/use-runtime-config.md +5 -5
  110. package/4.api/2.composables/use-seo-meta.md +2 -2
  111. package/4.api/2.composables/use-server-seo-meta.md +2 -2
  112. package/4.api/2.composables/use-state.md +12 -2
  113. package/4.api/3.utils/$fetch.md +1 -1
  114. package/4.api/3.utils/abort-navigation.md +2 -2
  115. package/4.api/3.utils/call-once.md +2 -4
  116. package/4.api/3.utils/clear-error.md +1 -1
  117. package/4.api/3.utils/create-error.md +7 -7
  118. package/4.api/3.utils/define-lazy-hydration-component.md +5 -5
  119. package/4.api/3.utils/define-nuxt-component.md +1 -1
  120. package/4.api/3.utils/define-nuxt-plugin.md +12 -12
  121. package/4.api/3.utils/define-nuxt-route-middleware.md +2 -2
  122. package/4.api/3.utils/define-page-meta.md +18 -11
  123. package/4.api/3.utils/define-route-rules.md +2 -2
  124. package/4.api/3.utils/navigate-to.md +14 -14
  125. package/4.api/3.utils/on-before-route-leave.md +1 -1
  126. package/4.api/3.utils/on-before-route-update.md +1 -1
  127. package/4.api/3.utils/preload-route-components.md +2 -2
  128. package/4.api/3.utils/refresh-cookie.md +0 -2
  129. package/4.api/3.utils/refresh-nuxt-data.md +1 -1
  130. package/4.api/3.utils/reload-nuxt-app.md +1 -1
  131. package/4.api/3.utils/set-page-layout.md +36 -0
  132. package/4.api/3.utils/set-response-status.md +3 -3
  133. package/4.api/3.utils/show-error.md +4 -4
  134. package/4.api/3.utils/update-app-config.md +1 -1
  135. package/4.api/4.commands/add.md +11 -11
  136. package/4.api/4.commands/analyze.md +11 -11
  137. package/4.api/4.commands/build-module.md +11 -11
  138. package/4.api/4.commands/build.md +12 -12
  139. package/4.api/4.commands/cleanup.md +6 -6
  140. package/4.api/4.commands/dev.md +23 -23
  141. package/4.api/4.commands/devtools.md +7 -7
  142. package/4.api/4.commands/generate.md +12 -12
  143. package/4.api/4.commands/info.md +6 -6
  144. package/4.api/4.commands/init.md +18 -18
  145. package/4.api/4.commands/module.md +18 -18
  146. package/4.api/4.commands/prepare.md +10 -10
  147. package/4.api/4.commands/preview.md +11 -11
  148. package/4.api/4.commands/test.md +9 -9
  149. package/4.api/4.commands/typecheck.md +10 -10
  150. package/4.api/4.commands/upgrade.md +10 -10
  151. package/4.api/5.kit/1.modules.md +31 -18
  152. package/4.api/5.kit/10.templates.md +23 -23
  153. package/4.api/5.kit/11.nitro.md +36 -36
  154. package/4.api/5.kit/12.resolving.md +2 -2
  155. package/4.api/5.kit/14.builder.md +35 -23
  156. package/4.api/5.kit/16.layers.md +16 -16
  157. package/4.api/5.kit/2.programmatic.md +2 -2
  158. package/4.api/5.kit/3.compatibility.md +2 -2
  159. package/4.api/5.kit/4.autoimports.md +18 -18
  160. package/4.api/5.kit/5.components.md +35 -35
  161. package/4.api/5.kit/6.context.md +1 -1
  162. package/4.api/5.kit/8.layout.md +1 -1
  163. package/4.api/6.advanced/1.hooks.md +85 -85
  164. package/4.api/index.md +7 -7
  165. package/5.community/4.contribution.md +10 -10
  166. package/5.community/5.framework-contribution.md +9 -9
  167. package/5.community/6.roadmap.md +25 -25
  168. package/5.community/7.changelog.md +10 -0
  169. package/6.bridge/1.overview.md +8 -0
  170. package/6.bridge/3.bridge-composition-api.md +2 -2
  171. package/6.bridge/4.plugins-and-middleware.md +2 -2
  172. package/6.bridge/5.nuxt3-compatible-api.md +1 -1
  173. package/6.bridge/8.nitro.md +4 -0
  174. package/7.migration/10.bundling.md +1 -1
  175. package/7.migration/11.server.md +3 -3
  176. package/7.migration/2.configuration.md +5 -5
  177. package/7.migration/20.module-authors.md +3 -3
  178. package/7.migration/4.meta.md +1 -1
  179. package/7.migration/5.plugins-and-middleware.md +3 -3
  180. package/7.migration/6.pages-and-layouts.md +5 -5
  181. package/7.migration/7.component-options.md +6 -6
  182. package/7.migration/8.runtime-config.md +1 -1
  183. package/package.json +1 -1
  184. package/3.guide/4.going-further/1.features.md +0 -103
  185. package/3.guide/4.going-further/3.modules.md +0 -901
  186. /package/3.guide/{3.recipes → 5.recipes}/.navigation.yml +0 -0
  187. /package/3.guide/{4.going-further → 6.going-further}/.navigation.yml +0 -0
  188. /package/3.guide/{4.going-further → 6.going-further}/index.md +0 -0
@@ -4,7 +4,7 @@ description: 'Define a lazy hydration component with a specific strategy.'
4
4
  links:
5
5
  - label: Source
6
6
  icon: i-simple-icons-github
7
- to: https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/components/plugins/lazy-hydration-macro-transform.ts
7
+ to: https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/components/plugins/lazy-hydration-macro-transform.ts
8
8
  size: xs
9
9
  ---
10
10
 
@@ -42,7 +42,7 @@ Read more about the options for `hydrate-on-visible`.
42
42
  ::
43
43
 
44
44
  ::note
45
- Under the hood, this uses Vue's built-in [`hydrateOnVisible` strategy](https://vuejs.org/guide/components/async.html#hydrate-on-visible).
45
+ Under the hood, this uses Vue's built-in [`hydrateOnVisible` strategy](https://vuejs.org/guide/components/async#hydrate-on-visible).
46
46
  ::
47
47
 
48
48
  ### Idle Strategy
@@ -70,7 +70,7 @@ The `hydrateOnIdle` prop is optional. You can pass a positive number to specify
70
70
  Idle strategy is for components that can be hydrated when the browser is idle.
71
71
 
72
72
  ::note
73
- Under the hood, this uses Vue's built-in [`hydrateOnIdle` strategy](https://vuejs.org/guide/components/async.html#hydrate-on-idle).
73
+ Under the hood, this uses Vue's built-in [`hydrateOnIdle` strategy](https://vuejs.org/guide/components/async#hydrate-on-idle).
74
74
  ::
75
75
 
76
76
  ### Interaction Strategy
@@ -99,7 +99,7 @@ const LazyHydrationMyComponent = defineLazyHydrationComponent(
99
99
  The `hydrateOnInteraction` prop is optional. If you do not pass an event or a list of events, it defaults to hydrating on `pointerenter`, `click`, and `focus`.
100
100
 
101
101
  ::note
102
- Under the hood, this uses Vue's built-in [`hydrateOnInteraction` strategy](https://vuejs.org/guide/components/async.html#hydrate-on-interaction).
102
+ Under the hood, this uses Vue's built-in [`hydrateOnInteraction` strategy](https://vuejs.org/guide/components/async#hydrate-on-interaction).
103
103
  ::
104
104
 
105
105
  ### Media Query Strategy
@@ -126,7 +126,7 @@ const LazyHydrationMyComponent = defineLazyHydrationComponent(
126
126
  ```
127
127
 
128
128
  ::note
129
- Under the hood, this uses Vue's built-in [`hydrateOnMediaQuery` strategy](https://vuejs.org/guide/components/async.html#hydrate-on-media-query).
129
+ Under the hood, this uses Vue's built-in [`hydrateOnMediaQuery` strategy](https://vuejs.org/guide/components/async#hydrate-on-media-query).
130
130
  ::
131
131
 
132
132
  ### Time Strategy
@@ -9,7 +9,7 @@ links:
9
9
  ---
10
10
 
11
11
  ::note
12
- `defineNuxtComponent()` is a helper function for defining type safe Vue components using options API similar to [`defineComponent()`](https://vuejs.org/api/general.html#definecomponent). `defineNuxtComponent()` wrapper also adds support for `asyncData` and `head` component options.
12
+ `defineNuxtComponent()` is a helper function for defining type safe Vue components using options API similar to [`defineComponent()`](https://vuejs.org/api/general#definecomponent). `defineNuxtComponent()` wrapper also adds support for `asyncData` and `head` component options.
13
13
  ::
14
14
 
15
15
  ::note
@@ -16,7 +16,7 @@ export default defineNuxtPlugin((nuxtApp) => {
16
16
  })
17
17
  ```
18
18
 
19
- :read-more{to="/docs/guide/directory-structure/plugins#creating-plugins"}
19
+ :read-more{to="/docs/3.x/directory-structure/plugins#creating-plugins"}
20
20
 
21
21
  ## Type
22
22
 
@@ -42,19 +42,19 @@ interface ObjectPlugin<T> {
42
42
  ## Parameters
43
43
 
44
44
  **plugin**: A plugin can be defined in two ways:
45
- 1. **Function Plugin**: A function that receives the [`NuxtApp`](/docs/3.x/guide/going-further/internals#the-nuxtapp-interface) instance and can return a promise with an potential object with a [`provide`](/docs/3.x/directory-structure/plugins#providing-helpers) property if you want to provide a helper on [`NuxtApp`](/docs/3.x/guide/going-further/internals#the-nuxtapp-interface) instance.
45
+ 1. **Function Plugin**: A function that receives the [`NuxtApp`](/docs/3.x/guide/going-further/internals#the-nuxtapp-interface) instance and can return a promise with a potential object with a [`provide`](/docs/3.x/directory-structure/plugins#providing-helpers) property if you want to provide a helper on [`NuxtApp`](/docs/3.x/guide/going-further/internals#the-nuxtapp-interface) instance.
46
46
  2. **Object Plugin**: An object that can include various properties to configure the plugin's behavior, such as `name`, `enforce`, `dependsOn`, `order`, `parallel`, `setup`, `hooks`, and `env`.
47
47
 
48
- | Property | Type | Required | Description |
49
- | ------------------ | -------------------------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------- |
50
- | `name` | `string` | `false` | Optional name for the plugin, useful for debugging and dependency management. |
51
- | `enforce` | `'pre'` \| `'default'` \| `'post'` | `false` | Controls when the plugin runs relative to other plugins. |
52
- | `dependsOn` | `string[]` | `false` | Array of plugin names this plugin depends on. Ensures proper execution order. |
53
- | `order` | `number` | `false` | This allows more granular control over plugin order and should only be used by advanced users. **It overrides the value of `enforce` and is used to sort plugins.** |
54
- | `parallel` | `boolean` | `false` | Whether to execute the plugin in parallel with other parallel plugins. |
55
- | `setup` | `Plugin<T>`{lang="ts"} | `false` | The main plugin function, equivalent to a function plugin. |
56
- | `hooks` | `Partial<RuntimeNuxtHooks>`{lang="ts"} | `false` | Nuxt app runtime hooks to register directly. |
57
- | `env` | `{ islands?: boolean }`{lang="ts"} | `false` | Set this value to `false` if you don't want the plugin to run when rendering server-only or island components. |
48
+ | Property | Type | Required | Description |
49
+ |-------------|----------------------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
50
+ | `name` | `string` | `false` | Optional name for the plugin, useful for debugging and dependency management. |
51
+ | `enforce` | `'pre'` \| `'default'` \| `'post'` | `false` | Controls when the plugin runs relative to other plugins. |
52
+ | `dependsOn` | `string[]` | `false` | Array of plugin names this plugin depends on. Ensures proper execution order. |
53
+ | `order` | `number` | `false` | This allows more granular control over plugin order and should only be used by advanced users. **It overrides the value of `enforce` and is used to sort plugins.** |
54
+ | `parallel` | `boolean` | `false` | Whether to execute the plugin in parallel with other parallel plugins. |
55
+ | `setup` | `Plugin<T>`{lang="ts"} | `false` | The main plugin function, equivalent to a function plugin. |
56
+ | `hooks` | `Partial<RuntimeNuxtHooks>`{lang="ts"} | `false` | Nuxt app runtime hooks to register directly. |
57
+ | `env` | `{ islands?: boolean }`{lang="ts"} | `false` | Set this value to `false` if you don't want the plugin to run when rendering server-only or island components. |
58
58
 
59
59
  :video-accordion{title="Watch a video from Alexander Lichter about the Object Syntax for Nuxt plugins" videoId="2aXZyXB1QGQ"}
60
60
 
@@ -28,7 +28,7 @@ interface RouteMiddleware {
28
28
 
29
29
  A function that takes two Vue Router's route location objects as parameters: the next route `to` as the first, and the current route `from` as the second.
30
30
 
31
- Learn more about available properties of `RouteLocationNormalized` in the **[Vue Router docs](https://router.vuejs.org/api/type-aliases/RouteLocationNormalized.html)**.
31
+ Learn more about available properties of `RouteLocationNormalized` in the **[Vue Router docs](https://router.vuejs.org/api/type-aliases/routelocationnormalized)**.
32
32
 
33
33
  ## Examples
34
34
 
@@ -39,7 +39,7 @@ You can use route middleware to throw errors and show helpful error messages:
39
39
  ```ts [middleware/error.ts]
40
40
  export default defineNuxtRouteMiddleware((to) => {
41
41
  if (to.params.id === '1') {
42
- throw createError({ statusCode: 404, statusMessage: 'Page Not Found' })
42
+ throw createError({ status: 404, statusText: 'Page Not Found' })
43
43
  }
44
44
  })
45
45
  ```
@@ -18,7 +18,7 @@ definePageMeta({
18
18
  </script>
19
19
  ```
20
20
 
21
- :read-more{to="/docs/guide/directory-structure/pages#page-metadata"}
21
+ :read-more{to="/docs/3.x/directory-structure/pages#page-metadata"}
22
22
 
23
23
  ## Type
24
24
 
@@ -32,6 +32,7 @@ interface PageMeta {
32
32
  path?: string
33
33
  props?: RouteRecordRaw['props']
34
34
  alias?: string | string[]
35
+ groups?: string[]
35
36
  pageTransition?: boolean | TransitionProps
36
37
  layoutTransition?: boolean | TransitionProps
37
38
  viewTransition?: boolean | 'always'
@@ -62,7 +63,7 @@ interface PageMeta {
62
63
 
63
64
  - **Type**: `string`
64
65
 
65
- You may define a [custom regular expression](#using-a-custom-regular-expression) if you have a more complex pattern than can be expressed with the file name.
66
+ You may define a [custom regular expression](/docs/3.x/api/utils/define-page-meta#using-a-custom-regular-expression) if you have a more complex pattern than can be expressed with the file name.
66
67
 
67
68
  **`props`**
68
69
 
@@ -76,11 +77,17 @@ interface PageMeta {
76
77
 
77
78
  Aliases for the record. Allows defining extra paths that will behave like a copy of the record. Allows having paths shorthands like `/users/:id` and `/u/:id`. All `alias` and `path` values must share the same params.
78
79
 
80
+ **`groups`**
81
+
82
+ - **Type**: `string[]`
83
+
84
+ Route groups the page belongs to, based on the folder structure. Automatically populated for pages within [route groups](/docs/3.x/guide/directory-structure/app/pages#route-groups).
85
+
79
86
  **`keepalive`**
80
87
 
81
- - **Type**: `boolean` | [`KeepAliveProps`](https://vuejs.org/api/built-in-components.html#keepalive)
88
+ - **Type**: `boolean` | [`KeepAliveProps`](https://vuejs.org/api/built-in-components#keepalive)
82
89
 
83
- Set to `true` when you want to preserve page state across route changes or use the [`KeepAliveProps`](https://vuejs.org/api/built-in-components.html#keepalive) for a fine-grained control.
90
+ Set to `true` when you want to preserve page state across route changes or use the [`KeepAliveProps`](https://vuejs.org/api/built-in-components#keepalive) for a fine-grained control.
84
91
 
85
92
  **`key`**
86
93
 
@@ -96,19 +103,19 @@ interface PageMeta {
96
103
 
97
104
  **`layoutTransition`**
98
105
 
99
- - **Type**: `boolean` | [`TransitionProps`](https://vuejs.org/api/built-in-components.html#transition)
106
+ - **Type**: `boolean` | [`TransitionProps`](https://vuejs.org/api/built-in-components#transition)
100
107
 
101
108
  Set name of the transition to apply for current layout. You can also set this value to `false` to disable the layout transition.
102
109
 
103
110
  **`middleware`**
104
111
 
105
- - **Type**: `MiddlewareKey` | [`NavigationGuard`](https://router.vuejs.org/api/interfaces/NavigationGuard.html#navigationguard) | `Array<MiddlewareKey | NavigationGuard>`
112
+ - **Type**: `MiddlewareKey` | [`NavigationGuard`](https://router.vuejs.org/api/interfaces/navigationguard) | `Array<MiddlewareKey | NavigationGuard>`
106
113
 
107
114
  Define anonymous or named middleware directly within `definePageMeta`. Learn more about [route middleware](/docs/3.x/directory-structure/middleware).
108
115
 
109
116
  **`pageTransition`**
110
117
 
111
- - **Type**: `boolean` | [`TransitionProps`](https://vuejs.org/api/built-in-components.html#transition)
118
+ - **Type**: `boolean` | [`TransitionProps`](https://vuejs.org/api/built-in-components#transition)
112
119
 
113
120
  Set name of the transition to apply for current page. You can also set this value to `false` to disable the page transition.
114
121
 
@@ -122,7 +129,7 @@ interface PageMeta {
122
129
 
123
130
  **`redirect`**
124
131
 
125
- - **Type**: [`RouteRecordRedirectOption`](https://router.vuejs.org/guide/essentials/redirect-and-alias.html#redirect-and-alias)
132
+ - **Type**: [`RouteRecordRedirectOption`](https://router.vuejs.org/guide/essentials/redirect-and-alias)
126
133
 
127
134
  Where to redirect if the route is directly matched. The redirection happens before any navigation guard and triggers a new navigation with the new target location.
128
135
 
@@ -130,13 +137,13 @@ interface PageMeta {
130
137
 
131
138
  - **Type**: `(route: RouteLocationNormalized) => boolean | Promise<boolean> | Partial<NuxtError> | Promise<Partial<NuxtError>>`
132
139
 
133
- Validate whether a given route can validly be rendered with this page. Return true if it is valid, or false if not. If another match can't be found, this will mean a 404. You can also directly return an object with `statusCode`/`statusMessage` to respond immediately with an error (other matches will not be checked).
140
+ Validate whether a given route can validly be rendered with this page. Return true if it is valid, or false if not. If another match can't be found, this will mean a 404. You can also directly return an object with `status`/`statusText` to respond immediately with an error (other matches will not be checked).
134
141
 
135
142
  **`scrollToTop`**
136
143
 
137
144
  - **Type**: `boolean | (to: RouteLocationNormalized, from: RouteLocationNormalized) => boolean`
138
145
 
139
- Tell Nuxt to scroll to the top before rendering the page or not. If you want to overwrite the default scroll behavior of Nuxt, you can do so in `~/app/router.options.ts` (see [custom routing](/docs/3.x/guide/recipes/custom-routing#using-approuteroptions)) for more info.
146
+ Tell Nuxt to scroll to the top before rendering the page or not. If you want to overwrite the default scroll behavior of Nuxt, you can do so in `~/router.options.ts` (see [custom routing](/docs/3.x/guide/recipes/custom-routing#using-routeroptions)) for more info.
140
147
 
141
148
  **`[key: string]`**
142
149
 
@@ -215,7 +222,7 @@ definePageMeta({
215
222
  </script>
216
223
  ```
217
224
 
218
- For more examples see [Vue Router's Matching Syntax](https://router.vuejs.org/guide/essentials/route-matching-syntax.html).
225
+ For more examples see [Vue Router's Matching Syntax](https://router.vuejs.org/guide/essentials/route-matching-syntax).
219
226
 
220
227
  ### Defining Layout
221
228
 
@@ -8,7 +8,7 @@ links:
8
8
  size: xs
9
9
  ---
10
10
 
11
- ::read-more{to="/docs/guide/going-further/experimental-features#inlinerouterules" icon="i-lucide-star"}
11
+ ::read-more{to="/docs/3.x/guide/going-further/experimental-features#inlinerouterules" icon="i-lucide-star"}
12
12
  This feature is experimental and in order to use it you must enable the `experimental.inlineRouteRules` option in your `nuxt.config`.
13
13
  ::
14
14
 
@@ -47,6 +47,6 @@ When running [`nuxt build`](/docs/3.x/api/commands/build), the home page will be
47
47
 
48
48
  For more control, such as if you are using a custom `path` or `alias` set in the page's [`definePageMeta`](/docs/3.x/api/utils/define-page-meta), you should set `routeRules` directly within your `nuxt.config`.
49
49
 
50
- ::read-more{to="/docs/guide/concepts/rendering#hybrid-rendering" icon="i-lucide-medal"}
50
+ ::read-more{to="/docs/3.x/guide/concepts/rendering#hybrid-rendering" icon="i-lucide-medal"}
51
51
  Read more about the `routeRules`.
52
52
  ::
@@ -17,7 +17,7 @@ Make sure to always use `await` or `return` on result of `navigateTo` when calli
17
17
  ::
18
18
 
19
19
  ::note
20
- `navigateTo` cannot be used within Nitro routes. To perform a server-side redirect in Nitro routes, use [`sendRedirect`](https://h3.dev/utils/response#sendredirectevent-location-code) instead.
20
+ `navigateTo` cannot be used within Nitro routes. To perform a server-side redirect in Nitro routes, use [`sendRedirect`](https://h3.dev/utils/response#redirectlocation-status-statustext) instead.
21
21
  ::
22
22
 
23
23
  ### Within a Vue Component
@@ -68,7 +68,7 @@ export default defineNuxtRouteMiddleware((to, from) => {
68
68
 
69
69
  In this case, `navigateTo` will be executed but not returned, which may lead to unexpected behavior.
70
70
 
71
- :read-more{to="/docs/guide/directory-structure/middleware"}
71
+ :read-more{to="/docs/3.x/directory-structure/middleware"}
72
72
 
73
73
  ### Navigating to an External URL
74
74
 
@@ -148,7 +148,7 @@ type OpenWindowFeatures = {
148
148
 
149
149
  ### `to`
150
150
 
151
- **Type**: [`RouteLocationRaw`](https://router.vuejs.org/api/interfaces/RouteLocationOptions.html#Interface-RouteLocationOptions) | `undefined` | `null`
151
+ **Type**: [`RouteLocationRaw`](https://router.vuejs.org/api/interfaces/routelocationoptions) | `undefined` | `null`
152
152
 
153
153
  **Default**: `'/'`
154
154
 
@@ -186,9 +186,9 @@ An object accepting the following properties:
186
186
  - **Type**: `number`
187
187
  - **Default**: `302`
188
188
 
189
- - `navigateTo` redirects to the given path and sets the redirect code to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302) by default when the redirection takes place on the server side.
189
+ - `navigateTo` redirects to the given path and sets the redirect code to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/302) by default when the redirection takes place on the server side.
190
190
 
191
- This default behavior can be modified by providing different `redirectCode`. Commonly, [`301 Moved Permanently`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/301) can be used for permanent redirections.
191
+ This default behavior can be modified by providing different `redirectCode`. Commonly, [`301 Moved Permanently`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/301) can be used for permanent redirections.
192
192
 
193
193
  - `external`
194
194
 
@@ -217,14 +217,14 @@ An object accepting the following properties:
217
217
 
218
218
  - An object accepting the following properties:
219
219
 
220
- | Property | Type | Description |
221
- |----------|---------|--------------|
222
- | `popup` | `boolean` | Requests a minimal popup window instead of a new tab, with UI features decided by the browser. |
223
- | `width` or `innerWidth` | `number` | Specifies the content area's width (minimum 100 pixels), including scrollbars. |
224
- | `height` or `innerHeight` | `number` | Specifies the content area's height (minimum 100 pixels), including scrollbars. |
225
- | `left` or `screenX` | `number` | Sets the horizontal position of the new window relative to the left edge of the screen. |
226
- | `top` or `screenY` | `number` | Sets the vertical position of the new window relative to the top edge of the screen. |
227
- | `noopener` | `boolean` | Prevents the new window from accessing the originating window via `window.opener`. |
228
- | `noreferrer` | `boolean` | Prevents the Referer header from being sent and implicitly enables `noopener`. |
220
+ | Property | Type | Description |
221
+ |---------------------------|-----------|------------------------------------------------------------------------------------------------|
222
+ | `popup` | `boolean` | Requests a minimal popup window instead of a new tab, with UI features decided by the browser. |
223
+ | `width` or `innerWidth` | `number` | Specifies the content area's width (minimum 100 pixels), including scrollbars. |
224
+ | `height` or `innerHeight` | `number` | Specifies the content area's height (minimum 100 pixels), including scrollbars. |
225
+ | `left` or `screenX` | `number` | Sets the horizontal position of the new window relative to the left edge of the screen. |
226
+ | `top` or `screenY` | `number` | Sets the vertical position of the new window relative to the top edge of the screen. |
227
+ | `noopener` | `boolean` | Prevents the new window from accessing the originating window via `window.opener`. |
228
+ | `noreferrer` | `boolean` | Prevents the Referer header from being sent and implicitly enables `noopener`. |
229
229
 
230
230
  Refer to the [documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/open#windowfeatures) for more detailed information on the **windowFeatures** properties.
@@ -8,4 +8,4 @@ links:
8
8
  size: xs
9
9
  ---
10
10
 
11
- :read-more{icon="i-simple-icons-vuedotjs" to="https://router.vuejs.org/api/functions/onBeforeRouteLeave.html" title="Vue Router Docs" target="_blank"}
11
+ :read-more{icon="i-simple-icons-vuedotjs" to="https://router.vuejs.org/api/functions/onbeforerouteleave" title="Vue Router Docs" target="_blank"}
@@ -8,4 +8,4 @@ links:
8
8
  size: xs
9
9
  ---
10
10
 
11
- :read-more{icon="i-simple-icons-vuedotjs" to="https://router.vuejs.org/api/functions/onBeforeRouteUpdate.html" title="Vue Router Docs" target="_blank"}
11
+ :read-more{icon="i-simple-icons-vuedotjs" to="https://router.vuejs.org/api/functions/onbeforerouteupdate" title="Vue Router Docs" target="_blank"}
@@ -14,7 +14,7 @@ Preloading routes loads the components of a given route that the user might navi
14
14
  Nuxt already automatically preloads the necessary routes if you're using the `NuxtLink` component.
15
15
  ::
16
16
 
17
- :read-more{to="/docs/api/components/nuxt-link"}
17
+ :read-more{to="/docs/3.x/api/components/nuxt-link"}
18
18
 
19
19
  ## Example
20
20
 
@@ -34,7 +34,7 @@ const submit = async () => {
34
34
  }
35
35
  ```
36
36
 
37
- :read-more{to="/docs/api/utils/navigate-to"}
37
+ :read-more{to="/docs/3.x/api/utils/navigate-to"}
38
38
 
39
39
  ::note
40
40
  On server, `preloadRouteComponents` will have no effect.
@@ -1,8 +1,6 @@
1
1
  ---
2
2
  title: "refreshCookie"
3
3
  description: "Refresh useCookie values manually when a cookie has changed"
4
- navigation:
5
- badge: New
6
4
  links:
7
5
  - label: Source
8
6
  icon: i-simple-icons-github
@@ -93,4 +93,4 @@ async function refresh () {
93
93
  If you have access to the `asyncData` instance, it is recommended to use its `refresh` or `execute` method as the preferred way to refetch the data.
94
94
  ::
95
95
 
96
- :read-more{to="/docs/getting-started/data-fetching"}
96
+ :read-more{to="/docs/3.x/getting-started/data-fetching"}
@@ -14,7 +14,7 @@ links:
14
14
 
15
15
  By default, it will also save the current `state` of your app (that is, any state you could access with `useState`).
16
16
 
17
- ::read-more{to="/docs/guide/going-further/experimental-features#restorestate" icon="i-lucide-star"}
17
+ ::read-more{to="/docs/3.x/guide/going-further/experimental-features#restorestate" icon="i-lucide-star"}
18
18
  You can enable experimental restoration of this state by enabling the `experimental.restoreState` option in your `nuxt.config` file.
19
19
  ::
20
20
 
@@ -19,6 +19,42 @@ export default defineNuxtRouteMiddleware((to) => {
19
19
  })
20
20
  ```
21
21
 
22
+ ## Passing Props to Layouts
23
+
24
+ You can pass props to the layout by providing an object as the second argument:
25
+
26
+ ```ts [middleware/admin-layout.ts]
27
+ export default defineNuxtRouteMiddleware((to) => {
28
+ setPageLayout('admin', {
29
+ sidebar: true,
30
+ title: 'Dashboard',
31
+ })
32
+ })
33
+ ```
34
+
35
+ The layout can then receive these props:
36
+
37
+ ```vue [layouts/admin.vue]
38
+ <script setup lang="ts">
39
+ const props = defineProps<{
40
+ sidebar?: boolean
41
+ title?: string
42
+ }>()
43
+ </script>
44
+
45
+ <template>
46
+ <div>
47
+ <aside v-if="sidebar">
48
+ Sidebar
49
+ </aside>
50
+ <main>
51
+ <h1>{{ title }}</h1>
52
+ <slot />
53
+ </main>
54
+ </div>
55
+ </template>
56
+ ```
57
+
22
58
  ::note
23
59
  If you choose to set the layout dynamically on the server side, you _must_ do so before the layout is rendered by Vue (that is, within a plugin or route middleware) to avoid a hydration mismatch.
24
60
  ::
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: 'setResponseStatus'
3
- description: setResponseStatus sets the statusCode (and optionally the statusMessage) of the response.
3
+ description: setResponseStatus sets the status (and optionally the statusText) of the response.
4
4
  links:
5
5
  - label: Source
6
6
  icon: i-simple-icons-github
@@ -10,7 +10,7 @@ links:
10
10
 
11
11
  Nuxt provides composables and utilities for first-class server-side-rendering support.
12
12
 
13
- `setResponseStatus` sets the statusCode (and optionally the statusMessage) of the response.
13
+ `setResponseStatus` sets the status (and optionally the statusText) of the response.
14
14
 
15
15
  ::important
16
16
  `setResponseStatus` can only be called in the [Nuxt context](/docs/3.x/guide/going-further/nuxt-app#the-nuxt-context).
@@ -33,4 +33,4 @@ if (event) {
33
33
  In the browser, `setResponseStatus` will have no effect.
34
34
  ::
35
35
 
36
- :read-more{to="/docs/getting-started/error-handling"}
36
+ :read-more{to="/docs/3.x/getting-started/error-handling"}
@@ -12,13 +12,13 @@ Within the [Nuxt context](/docs/3.x/guide/going-further/nuxt-app#the-nuxt-contex
12
12
 
13
13
  **Parameters:**
14
14
 
15
- - `error`: `string | Error | Partial<{ cause, data, message, name, stack, statusCode, statusMessage }>`
15
+ - `error`: `string | Error | Partial<{ cause, data, message, name, stack, status, statusText }>`
16
16
 
17
17
  ```ts
18
18
  showError('😱 Oh no, an error has been thrown.')
19
19
  showError({
20
- statusCode: 404,
21
- statusMessage: 'Page Not Found',
20
+ status: 404,
21
+ statusText: 'Page Not Found',
22
22
  })
23
23
  ```
24
24
 
@@ -28,4 +28,4 @@ The error is set in the state using [`useError()`](/docs/3.x/api/composables/use
28
28
  `showError` calls the `app:error` hook.
29
29
  ::
30
30
 
31
- :read-more{to="/docs/getting-started/error-handling"}
31
+ :read-more{to="/docs/3.x/getting-started/error-handling"}
@@ -25,4 +25,4 @@ updateAppConfig(newAppConfig)
25
25
  console.log(appConfig) // { foo: 'baz' }
26
26
  ```
27
27
 
28
- :read-more{to="/docs/guide/directory-structure/app-config"}
28
+ :read-more{to="/docs/3.x/directory-structure/app-config"}
@@ -14,23 +14,23 @@ npx nuxt add <TEMPLATE> <NAME> [--cwd=<directory>] [--logLevel=<silent|info|verb
14
14
  ```
15
15
  <!--/add-cmd-->
16
16
 
17
- ### Arguments
17
+ ## Arguments
18
18
 
19
19
  <!--add-args-->
20
- Argument | Description
21
- --- | ---
22
- `TEMPLATE` | Specify which template to generate (options: <api\|app\|app-config\|component\|composable\|error\|layer\|layout\|middleware\|module\|page\|plugin\|server-middleware\|server-plugin\|server-route\|server-util>)
23
- `NAME` | Specify name of the generated file
20
+ | Argument | Description |
21
+ |------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
22
+ | `TEMPLATE` | Specify which template to generate (options: <api\|app\|app-config\|component\|composable\|error\|layer\|layout\|middleware\|module\|page\|plugin\|server-middleware\|server-plugin\|server-route\|server-util>) |
23
+ | `NAME` | Specify name of the generated file |
24
24
  <!--/add-args-->
25
25
 
26
- ### Options
26
+ ## Options
27
27
 
28
28
  <!--add-opts-->
29
- Option | Default | Description
30
- --- | --- | ---
31
- `--cwd=<directory>` | `.` | Specify the working directory
32
- `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level
33
- `--force` | `false` | Force override file if it already exists
29
+ | Option | Default | Description |
30
+ |--------------------------------------|---------|------------------------------------------|
31
+ | `--cwd=<directory>` | `.` | Specify the working directory |
32
+ | `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level |
33
+ | `--force` | `false` | Force override file if it already exists |
34
34
  <!--/add-opts-->
35
35
 
36
36
  **Modifiers:**
@@ -19,22 +19,22 @@ The `analyze` command builds Nuxt and analyzes the production bundle (experiment
19
19
  ## Arguments
20
20
 
21
21
  <!--analyze-args-->
22
- Argument | Description
23
- --- | ---
24
- `ROOTDIR="."` | Specifies the working directory (default: `.`)
22
+ | Argument | Description |
23
+ |---------------|------------------------------------------------|
24
+ | `ROOTDIR="."` | Specifies the working directory (default: `.`) |
25
25
  <!--/analyze-args-->
26
26
 
27
27
  ## Options
28
28
 
29
29
  <!--analyze-opts-->
30
- Option | Default | Description
31
- --- | --- | ---
32
- `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`)
33
- `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level
34
- `--dotenv` | | Path to `.env` file to load, relative to the root directory
35
- `-e, --extends=<layer-name>` | | Extend from a Nuxt layer
36
- `--name=<name>` | `default` | Name of the analysis
37
- `--no-serve` | | Skip serving the analysis results
30
+ | Option | Default | Description |
31
+ |--------------------------------------|-----------|----------------------------------------------------------------------------------|
32
+ | `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
33
+ | `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level |
34
+ | `--dotenv` | | Path to `.env` file to load, relative to the root directory |
35
+ | `-e, --extends=<layer-name>` | | Extend from a Nuxt layer |
36
+ | `--name=<name>` | `default` | Name of the analysis |
37
+ | `--no-serve` | | Skip serving the analysis results |
38
38
  <!--/analyze-opts-->
39
39
 
40
40
  ::note
@@ -19,22 +19,22 @@ The `build-module` command runs `@nuxt/module-builder` to generate `dist` direct
19
19
  ## Arguments
20
20
 
21
21
  <!--build-module-args-->
22
- Argument | Description
23
- --- | ---
24
- `ROOTDIR="."` | Specifies the working directory (default: `.`)
22
+ | Argument | Description |
23
+ |---------------|------------------------------------------------|
24
+ | `ROOTDIR="."` | Specifies the working directory (default: `.`) |
25
25
  <!--/build-module-args-->
26
26
 
27
27
  ## Options
28
28
 
29
29
  <!--build-module-opts-->
30
- Option | Default | Description
31
- --- | --- | ---
32
- `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`)
33
- `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level
34
- `--build` | `false` | Build module for distribution
35
- `--stub` | `false` | Stub dist instead of actually building it for development
36
- `--sourcemap` | `false` | Generate sourcemaps
37
- `--prepare` | `false` | Prepare module for local development
30
+ | Option | Default | Description |
31
+ |--------------------------------------|---------|----------------------------------------------------------------------------------|
32
+ | `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
33
+ | `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level |
34
+ | `--build` | `false` | Build module for distribution |
35
+ | `--stub` | `false` | Stub dist instead of actually building it for development |
36
+ | `--sourcemap` | `false` | Generate sourcemaps |
37
+ | `--prepare` | `false` | Prepare module for local development |
38
38
  <!--/build-module-opts-->
39
39
 
40
40
  ::read-more{to="https://github.com/nuxt/module-builder" icon="i-simple-icons-github" target="\_blank"}
@@ -19,23 +19,23 @@ The `build` command creates a `.output` directory with all your application, ser
19
19
  ## Arguments
20
20
 
21
21
  <!--build-args-->
22
- Argument | Description
23
- --- | ---
24
- `ROOTDIR="."` | Specifies the working directory (default: `.`)
22
+ | Argument | Description |
23
+ |---------------|------------------------------------------------|
24
+ | `ROOTDIR="."` | Specifies the working directory (default: `.`) |
25
25
  <!--/build-args-->
26
26
 
27
27
  ## Options
28
28
 
29
29
  <!--build-opts-->
30
- Option | Default | Description
31
- --- | --- | ---
32
- `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`)
33
- `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level
34
- `--prerender` | | Build Nuxt and prerender static routes
35
- `--preset` | | Nitro server preset
36
- `--dotenv` | | Path to `.env` file to load, relative to the root directory
37
- `--envName` | | The environment to use when resolving configuration overrides (default is `production` when building, and `development` when running the dev server)
38
- `-e, --extends=<layer-name>` | | Extend from a Nuxt layer
30
+ | Option | Default | Description |
31
+ |--------------------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------|
32
+ | `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
33
+ | `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level |
34
+ | `--prerender` | | Build Nuxt and prerender static routes |
35
+ | `--preset` | | Nitro server preset |
36
+ | `--dotenv` | | Path to `.env` file to load, relative to the root directory |
37
+ | `--envName` | | The environment to use when resolving configuration overrides (default is `production` when building, and `development` when running the dev server) |
38
+ | `-e, --extends=<layer-name>` | | Extend from a Nuxt layer |
39
39
  <!--/build-opts-->
40
40
 
41
41
  ::note