@nuxt/docs 3.20.2 → 3.21.1

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 +18 -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 +5 -2
  46. package/3.guide/1.concepts/{3.rendering.md → 1.rendering.md} +11 -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 +420 -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 +3 -3
  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 +1 -3
  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 +12 -12
  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 +40 -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 +23 -19
  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 +26 -26
  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
@@ -9,7 +9,7 @@ The hooking system is powered by [unjs/hookable](https://github.com/unjs/hookabl
9
9
 
10
10
  ## Nuxt Hooks (Build Time)
11
11
 
12
- These hooks are available for [Nuxt Modules](/docs/3.x/guide/going-further/modules) and build context.
12
+ These hooks are available for [Nuxt modules](/docs/3.x/guide/modules) and build context.
13
13
 
14
14
  ### Within `nuxt.config.ts`
15
15
 
@@ -33,7 +33,7 @@ export default defineNuxtModule({
33
33
  })
34
34
  ```
35
35
 
36
- ::read-more{to="/docs/api/advanced/hooks#nuxt-hooks-build-time"}
36
+ ::read-more{to="/docs/3.x/api/advanced/hooks#nuxt-hooks-build-time"}
37
37
  Explore all available Nuxt hooks.
38
38
  ::
39
39
 
@@ -49,7 +49,7 @@ export default defineNuxtPlugin((nuxtApp) => {
49
49
  })
50
50
  ```
51
51
 
52
- ::read-more{to="/docs/api/advanced/hooks#app-hooks-runtime"}
52
+ ::read-more{to="/docs/3.x/api/advanced/hooks#app-hooks-runtime"}
53
53
  Explore all available App hooks.
54
54
  ::
55
55
 
@@ -70,7 +70,7 @@ export default defineNitroPlugin((nitroApp) => {
70
70
  })
71
71
  ```
72
72
 
73
- ::read-more{to="/docs/api/advanced/hooks#nitro-app-hooks-runtime-server-side"}
73
+ ::read-more{to="/docs/3.x/api/advanced/hooks#nitro-app-hooks-runtime-server-side"}
74
74
  Learn more about available Nitro lifecycle hooks.
75
75
  ::
76
76
 
@@ -90,7 +90,7 @@ declare module '#app' {
90
90
  }
91
91
  }
92
92
 
93
- declare module 'nitropack' {
93
+ declare module 'nitropack/types' {
94
94
  interface NitroRuntimeHooks {
95
95
  'your-nitro-hook': () => void
96
96
  }
@@ -3,9 +3,9 @@ title: "Nuxt Kit"
3
3
  description: "@nuxt/kit provides features for module authors."
4
4
  ---
5
5
 
6
- Nuxt Kit provides composable utilities to make interacting with [Nuxt Hooks](/docs/3.x/api/advanced/hooks), the [Nuxt Interface](/docs/3.x/guide/going-further/internals#the-nuxt-interface) and developing [Nuxt Modules](/docs/3.x/guide/going-further/modules) super easy.
6
+ Nuxt Kit provides composable utilities to make interacting with [Nuxt Hooks](/docs/3.x/api/advanced/hooks), the [Nuxt Interface](/docs/3.x/guide/going-further/internals#the-nuxt-interface) and developing [Nuxt modules](/docs/3.x/guide/modules) super easy.
7
7
 
8
- ::read-more{to="/docs/api/kit"}
8
+ ::read-more{to="/docs/3.x/api/kit"}
9
9
  Discover all Nuxt Kit utilities.
10
10
  ::
11
11
 
@@ -33,7 +33,7 @@ You can install the latest Nuxt Kit by adding it to the `dependencies` section o
33
33
  import { useNuxt } from '@nuxt/kit'
34
34
  ```
35
35
 
36
- :read-more{to="/docs/api/kit"}
36
+ :read-more{to="/docs/3.x/api/kit"}
37
37
 
38
38
  ::note
39
39
  Nuxt Kit utilities are only available for modules and not meant to be imported in runtime (components, Vue composables, pages, plugins, or server routes).
@@ -9,13 +9,13 @@ links:
9
9
 
10
10
  In Nuxt, you can access runtime app context within composables, components and plugins.
11
11
 
12
- ::read-more{to="https://v2.nuxt.com/docs/internals-glossary/context#the-context" target="_blank"}
12
+ ::read-more{to="https://v2.nuxt.com/docs/internals-glossary/context/#the-context" target="_blank"}
13
13
  In Nuxt 2, this was referred to as **Nuxt context**.
14
14
  ::
15
15
 
16
16
  ## Nuxt App Interface
17
17
 
18
- ::read-more{to="/docs/guide/going-further/internals#the-nuxtapp-interface"}
18
+ ::read-more{to="/docs/3.x/guide/going-further/internals#the-nuxtapp-interface"}
19
19
  Jump over the `NuxtApp` interface documentation.
20
20
  ::
21
21
 
@@ -23,7 +23,7 @@ Jump over the `NuxtApp` interface documentation.
23
23
 
24
24
  Many composables and utilities, both built-in and user-made, may require access to the Nuxt instance. This doesn't exist everywhere on your application, because a fresh instance is created on every request.
25
25
 
26
- Currently, the Nuxt context is only accessible in [plugins](/docs/3.x/directory-structure/plugins), [Nuxt hooks](/docs/3.x/guide/going-further/hooks), [Nuxt middleware](/docs/3.x/directory-structure/middleware) (if wrapped in `defineNuxtRouteMiddleware`), and [setup functions](https://vuejs.org/api/composition-api-setup.html) (in pages and components).
26
+ Currently, the Nuxt context is only accessible in [plugins](/docs/3.x/directory-structure/plugins), [Nuxt hooks](/docs/3.x/guide/going-further/hooks), [Nuxt middleware](/docs/3.x/directory-structure/middleware) (if wrapped in `defineNuxtRouteMiddleware`), and [setup functions](https://vuejs.org/api/composition-api-setup) (in pages and components).
27
27
 
28
28
  If a composable is called without access to the context, you may get an error stating that 'A composable that requires access to the Nuxt instance was called outside of a plugin, Nuxt hook, Nuxt middleware, or Vue setup function.' In that case, you can also explicitly call functions within this context by using [`nuxtApp.runWithContext`](/docs/3.x/api/composables/use-nuxt-app#runwithcontext).
29
29
 
@@ -42,7 +42,7 @@ If your composable does not always need `nuxtApp` or you simply want to check if
42
42
 
43
43
  Plugins also receive `nuxtApp` as the first argument for convenience.
44
44
 
45
- :read-more{to="/docs/guide/directory-structure/plugins"}
45
+ :read-more{to="/docs/3.x/directory-structure/plugins"}
46
46
 
47
47
  ## Providing Helpers
48
48
 
@@ -55,10 +55,10 @@ nuxtApp.provide('hello', name => `Hello ${name}!`)
55
55
  console.log(nuxtApp.$hello('name')) // Prints "Hello name!"
56
56
  ```
57
57
 
58
- ::read-more{to="/docs/guide/directory-structure/plugins#providing-helpers"}
58
+ ::read-more{to="/docs/3.x/directory-structure/plugins#providing-helpers"}
59
59
  It is possible to inject helpers by returning an object with a `provide` key in plugins.
60
60
  ::
61
61
 
62
- ::read-more{to="https://v2.nuxt.com/docs/directory-structure/plugins#inject-in-root--context" target="_blank"}
62
+ ::read-more{to="https://v2.nuxt.com/docs/directory-structure/plugins/#inject-in-root--context" target="_blank"}
63
63
  In Nuxt 2 plugins, this was referred to as **inject function**.
64
64
  ::
@@ -5,7 +5,7 @@ description: Nuxt provides a powerful system that allows you to extend the defau
5
5
 
6
6
  Nuxt layers are a powerful feature that you can use to share and reuse partial Nuxt applications within a monorepo, or from a git repository or npm package. The layers structure is almost identical to a standard Nuxt application, which makes them easy to author and maintain.
7
7
 
8
- :read-more{to="/docs/getting-started/layers"}
8
+ :read-more{to="/docs/3.x/getting-started/layers"}
9
9
 
10
10
  A minimal Nuxt layer directory should contain a [`nuxt.config.ts`](/docs/3.x/directory-structure/nuxt-config) file to indicate it is a layer.
11
11
 
@@ -21,14 +21,14 @@ Additionally, certain other files in the layer directory will be auto-scanned an
21
21
  - [`middleware/*`](/docs/3.x/directory-structure/middleware) - Extend the default middleware
22
22
  - [`pages/*`](/docs/3.x/directory-structure/pages) - Extend the default pages
23
23
  - [`plugins/*`](/docs/3.x/directory-structure/plugins) - Extend the default plugins
24
- - [`server/*`](/docs/3.x/directory-structure/server) - Extend the default server endpoints & middleware
25
24
  - [`utils/*`](/docs/3.x/directory-structure/utils) - Extend the default utils
26
- - [`nuxt.config.ts`](/docs/3.x/directory-structure/nuxt-config)- Extend the default nuxt config
27
25
  - [`app.config.ts`](/docs/3.x/directory-structure/app-config) - Extend the default app config
26
+ - [`server/*`](/docs/3.x/directory-structure/server) - Extend the default server endpoints & middleware
27
+ - [`nuxt.config.ts`](/docs/3.x/directory-structure/nuxt-config)- Extend the default nuxt config
28
28
 
29
29
  ## Basic Example
30
30
 
31
- ::code-group
31
+ ::code-tree{defaultValue="nuxt.config.ts" expandAll}
32
32
 
33
33
  ```ts [nuxt.config.ts]
34
34
  export default defineNuxtConfig({
@@ -249,9 +249,35 @@ export default defineNuxtConfig({
249
249
  })
250
250
  ```
251
251
 
252
+ ## Disabling Modules from Layers
253
+
254
+ When extending a layer, you might want to disable certain modules that it includes. You can do this by setting the module's config key to `false` in your Nuxt config.
255
+
256
+ ```ts [nuxt.config.ts]
257
+ export default defineNuxtConfig({
258
+ extends: ['./base-layer'],
259
+ // Disable modules from the layer by setting their config key to false
260
+ image: false, // Disables @nuxt/image
261
+ pinia: false, // Disables @pinia/nuxt
262
+ })
263
+ ```
264
+
265
+ ::note
266
+ The config key is defined by each module. Common examples include `image` for `@nuxt/image`, `pinia` for `@pinia/nuxt`, and `content` for `@nuxt/content`. Check the module's documentation for its specific config key.
267
+ ::
268
+
269
+ This is useful when:
270
+ - A layer includes modules you don't need in your project
271
+ - You want to use a different implementation than what the layer provides
272
+ - You need to disable analytics or other modules in specific environments
273
+
274
+ ::tip
275
+ You can also use this approach to disable modules in your own project - not just those from layers. Setting a module's config key to `false` will prevent its setup function from running while still generating types for the module.
276
+ ::
277
+
252
278
  ## Multi-Layer Support for Nuxt Modules
253
279
 
254
- You can use the [`getLayerDirectories`](/docs/api/kit/layers#getlayerdirectories) utility from Nuxt Kit to support custom multi-layer handling for your modules.
280
+ You can use the [`getLayerDirectories`](/docs/3.x/api/kit/layers#getlayerdirectories) utility from Nuxt Kit to support custom multi-layer handling for your modules.
255
281
 
256
282
  ```ts [modules/my-module.ts]
257
283
  import { defineNuxtModule, getLayerDirectories } from 'nuxt/kit'
@@ -36,7 +36,7 @@ It is possible to debug your Nuxt app in your IDE while you are developing it.
36
36
 
37
37
  ### Example VS Code Debug Configuration
38
38
 
39
- You may need to update the config below with a path to your web browser. For more information, visit the [VS Code documentation about debug configuration](https://go.microsoft.com/fwlink/?linkid=830387).
39
+ You may need to update the config below with a path to your web browser. For more information, visit the [VS Code documentation about debug configuration](https://code.visualstudio.com/docs/debugtest/debugging#_launch-configurations).
40
40
 
41
41
  ```json5
42
42
  {
@@ -49,7 +49,8 @@ You may need to update the config below with a path to your web browser. For mor
49
49
  "request": "launch",
50
50
  "name": "client: chrome",
51
51
  "url": "http://localhost:3000",
52
- "webRoot": "${workspaceFolder}"
52
+ // this should point to your Nuxt `srcDir`, which is `app` by default
53
+ "webRoot": "${workspaceFolder}/app"
53
54
  },
54
55
  {
55
56
  "type": "node",
@@ -14,7 +14,7 @@ links:
14
14
 
15
15
  Nuxt provides the `<NuxtClientFallback>` component to render its content on the client if any of its children trigger an error in SSR.
16
16
 
17
- ::note{to="/docs/guide/going-further/experimental-features#clientfallback"}
17
+ ::note{to="/docs/3.x/guide/going-further/experimental-features#clientfallback"}
18
18
  This component is experimental and in order to use it you must enable the `experimental.clientFallback` option in your `nuxt.config`.
19
19
  ::
20
20
 
@@ -54,6 +54,10 @@ This component is experimental and in order to use it you must enable the `exper
54
54
  - **type**: `boolean`
55
55
  - **default**: `false`
56
56
 
57
+ ::warning{icon="i-ph-warning-duotone"}
58
+ The `placeholder` and `fallback` props render content as raw HTML. Do not pass untrusted user input to these props as it may lead to XSS vulnerabilities. Use the `#fallback` or `#placeholder` slots instead for dynamic content that needs proper escaping.
59
+ ::
60
+
57
61
  ```vue
58
62
  <template>
59
63
  <!-- render <span>Hello world</span> server-side if the default slot fails to render -->
@@ -12,7 +12,7 @@ links:
12
12
 
13
13
  Usage of `<NuxtPicture>` is almost identical to [`<NuxtImg>`](/docs/3.x/api/components/nuxt-img) but it also allows serving modern formats like `webp` when possible.
14
14
 
15
- Learn more about the [`<picture>` tag on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture).
15
+ Learn more about the [`<picture>` tag on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/picture).
16
16
 
17
17
  ## Setup
18
18
 
@@ -4,7 +4,7 @@ description: The <Teleport> component teleports a component to a different locat
4
4
  ---
5
5
 
6
6
  ::warning
7
- The `to` target of [`<Teleport>`](https://vuejs.org/guide/built-ins/teleport.html) expects a CSS selector string or an actual DOM node. Nuxt currently has SSR support for teleports to `#teleports` only, with client-side support for other targets using a `<ClientOnly>` wrapper.
7
+ The `to` target of [`<Teleport>`](https://vuejs.org/guide/built-ins/teleport) expects a CSS selector string or an actual DOM node. Nuxt currently has SSR support for teleports to `#teleports` only, with client-side support for other targets using a `<ClientOnly>` wrapper.
8
8
  ::
9
9
 
10
10
  ## Body Teleport
@@ -40,4 +40,4 @@ The `to` target of [`<Teleport>`](https://vuejs.org/guide/built-ins/teleport.htm
40
40
  </template>
41
41
  ```
42
42
 
43
- :link-example{to="/docs/examples/advanced/teleport"}
43
+ :link-example{to="/docs/3.x/examples/advanced/teleport"}
@@ -1,8 +1,6 @@
1
1
  ---
2
2
  title: '<NuxtRouteAnnouncer>'
3
3
  description: 'The <NuxtRouteAnnouncer> component adds a hidden element with the page title to announce route changes to assistive technologies.'
4
- navigation:
5
- badge: New
6
4
  links:
7
5
  - label: Source
8
6
  icon: i-simple-icons-github
@@ -1,8 +1,6 @@
1
1
  ---
2
2
  title: '<NuxtTime>'
3
3
  description: 'The <NuxtTime> component displays time in a locale-friendly format with server-client consistency.'
4
- navigation:
5
- badge: New
6
4
  links:
7
5
  - label: Source
8
6
  icon: i-simple-icons-github
@@ -11,7 +11,7 @@ links:
11
11
  `<NuxtPage>` is a built-in component that comes with Nuxt. It lets you display top-level or nested pages located in the [`pages/`](/docs/3.x/directory-structure/pages) directory.
12
12
 
13
13
  ::note
14
- `<NuxtPage>` is a wrapper around [`<RouterView>`](https://router.vuejs.org/api/interfaces/RouterViewProps.html#interface-routerviewprops) from Vue Router. It should be used instead of `<RouterView>` because the former takes additional care of internal states. Otherwise, `useRoute()` may return incorrect paths.
14
+ `<NuxtPage>` is a wrapper around [`<RouterView>`](https://router.vuejs.org/api/interfaces/routerviewprops) from Vue Router. It should be used instead of `<RouterView>` because the former takes additional care of internal states. Otherwise, `useRoute()` may return incorrect paths.
15
15
  ::
16
16
 
17
17
  `<NuxtPage>` includes the following components:
@@ -89,7 +89,7 @@ definePageMeta({
89
89
  </script>
90
90
  ```
91
91
 
92
- :link-example{to="/docs/examples/routing/pages"}
92
+ :link-example{to="/docs/3.x/examples/routing/pages"}
93
93
 
94
94
  ## Page's Ref
95
95
 
@@ -151,4 +151,4 @@ console.log(attrs.foobar) // Outputs: 123
151
151
  </script>
152
152
  ```
153
153
 
154
- :read-more{to="/docs/guide/directory-structure/pages"}
154
+ :read-more{to="/docs/3.x/directory-structure/pages"}
@@ -18,12 +18,12 @@ You can use `<NuxtLayout />` component to activate the `default` layout on `app.
18
18
  </template>
19
19
  ```
20
20
 
21
- :read-more{to="/docs/guide/directory-structure/layouts"}
21
+ :read-more{to="/docs/3.x/directory-structure/layouts"}
22
22
 
23
23
  ## Props
24
24
 
25
- - `name`: Specify a layout name to be rendered, can be a string, reactive reference or a computed property. It **must** match the name of the corresponding layout file in the [`layouts/`](/docs/3.x/directory-structure/layouts) directory.
26
- - **type**: `string`
25
+ - `name`: Specify a layout name to be rendered, can be a string, reactive reference or a computed property. It **must** match the name of the corresponding layout file in the [`layouts/`](/docs/3.x/directory-structure/layouts) directory, or `false` to disable the layout.
26
+ - **type**: `string | false`
27
27
  - **default**: `default`
28
28
 
29
29
  ```vue [pages/index.vue]
@@ -51,7 +51,7 @@ Please note the layout name is normalized to kebab-case, so if your layout file
51
51
  </template>
52
52
  ```
53
53
 
54
- ::read-more{to="/docs/guide/directory-structure/layouts"}
54
+ ::read-more{to="/docs/3.x/directory-structure/layouts"}
55
55
  Read more about dynamic layouts.
56
56
  ::
57
57
 
@@ -116,7 +116,7 @@ console.log(layoutCustomProps.title) // I am a custom layout
116
116
 
117
117
  ::
118
118
 
119
- :read-more{to="/docs/getting-started/transitions"}
119
+ :read-more{to="/docs/3.x/getting-started/transitions"}
120
120
 
121
121
  ## Layout's Ref
122
122
 
@@ -158,4 +158,4 @@ defineExpose({
158
158
 
159
159
  ::
160
160
 
161
- :read-more{to="/docs/guide/directory-structure/layouts"}
161
+ :read-more{to="/docs/3.x/directory-structure/layouts"}
@@ -244,21 +244,21 @@ export default defineNuxtConfig({
244
244
 
245
245
  ### RouterLink
246
246
 
247
- When not using `external`, `<NuxtLink>` supports all Vue Router's [`RouterLink` props](https://router.vuejs.org/api/interfaces/RouterLinkProps.html)
247
+ When not using `external`, `<NuxtLink>` supports all Vue Router's [`RouterLink` props](https://router.vuejs.org/api/interfaces/routerlinkprops)
248
248
 
249
- - `to`: Any URL or a [route location object](https://router.vuejs.org/api/type-aliases/RouteLocation.html) from Vue Router
250
- - `custom`: Whether `<NuxtLink>` should wrap its content in an `<a>` element. It allows taking full control of how a link is rendered and how navigation works when it is clicked. Works the same as [Vue Router's `custom` prop](https://router.vuejs.org/api/interfaces/RouterLinkProps.html#Properties-custom)
251
- - `exactActiveClass`: A class to apply on exact active links. Works the same as [Vue Router's `exactActiveClass` prop](https://router.vuejs.org/api/interfaces/RouterLinkProps.html#Properties-exactActiveClass) on internal links. Defaults to Vue Router's default (`"router-link-exact-active"`)
252
- - `activeClass`: A class to apply on active links. Works the same as [Vue Router's `activeClass` prop](https://router.vuejs.org/api/interfaces/RouterLinkProps.html#Properties-activeClass) on internal links. Defaults to Vue Router's default (`"router-link-active"`)
253
- - `replace`: Works the same as [Vue Router's `replace` prop](https://router.vuejs.org/api/interfaces/RouteLocationOptions.html#Properties-replace) on internal links
254
- - `ariaCurrentValue`: An `aria-current` attribute value to apply on exact active links. Works the same as [Vue Router's `ariaCurrentValue` prop](https://router.vuejs.org/api/interfaces/RouterLinkProps.html#Properties-ariaCurrentValue) on internal links
249
+ - `to`: Any URL or a [route location object](https://router.vuejs.org/api/type-aliases/routelocation) from Vue Router
250
+ - `custom`: Whether `<NuxtLink>` should wrap its content in an `<a>` element. It allows taking full control of how a link is rendered and how navigation works when it is clicked. Works the same as [Vue Router's `custom` prop](https://router.vuejs.org/api/interfaces/routerlinkprops#custom-)
251
+ - `exactActiveClass`: A class to apply on exact active links. Works the same as [Vue Router's `exactActiveClass` prop](https://router.vuejs.org/api/interfaces/routerlinkprops#exactActiveClass-) on internal links. Defaults to Vue Router's default (`"router-link-exact-active"`)
252
+ - `activeClass`: A class to apply on active links. Works the same as [Vue Router's `activeClass` prop](https://router.vuejs.org/api/interfaces/routerlinkprops#activeClass-) on internal links. Defaults to Vue Router's default (`"router-link-active"`)
253
+ - `replace`: Works the same as [Vue Router's `replace` prop](https://router.vuejs.org/api/interfaces/routelocationoptions#replace-) on internal links
254
+ - `ariaCurrentValue`: An `aria-current` attribute value to apply on exact active links. Works the same as [Vue Router's `ariaCurrentValue` prop](https://router.vuejs.org/api/interfaces/routerlinkprops#ariaCurrentValue-) on internal links
255
255
 
256
256
  ### NuxtLink
257
257
 
258
258
  - `href`: An alias for `to`. If used with `to`, `href` will be ignored
259
259
  - `noRel`: If set to `true`, no `rel` attribute will be added to the external link
260
260
  - `external`: Forces the link to be rendered as an `<a>` tag instead of a Vue Router `RouterLink`.
261
- - `prefetch`: When enabled will prefetch middleware, layouts and payloads (when using [payloadExtraction](/docs/3.x/api/nuxt-config#crossoriginprefetch)) of links in the viewport. Used by the experimental [crossOriginPrefetch](/docs/3.x/api/nuxt-config#crossoriginprefetch) config.
261
+ - `prefetch`: When enabled will prefetch middleware, layouts and payloads (when using [payloadExtraction](/docs/3.x/guide/going-further/experimental-features#payloadextraction)) of links in the viewport. Used by the experimental [crossOriginPrefetch](/docs/3.x/guide/going-further/experimental-features#crossoriginprefetch) config.
262
262
  - `prefetchOn`: Allows custom control of when to prefetch links. Possible options are `interaction` and `visibility` (default). You can also pass an object for full control, for example: `{ interaction: true, visibility: true }`. This prop is only used when `prefetch` is enabled (default) and `noPrefetch` is not set.
263
263
  - `noPrefetch`: Disables prefetching.
264
264
  - `prefetchedClass`: A class to apply to links that have been prefetched.
@@ -269,14 +269,14 @@ When not using `external`, `<NuxtLink>` supports all Vue Router's [`RouterLink`
269
269
  - `rel`: A `rel` attribute value to apply on the link. Defaults to `"noopener noreferrer"` for external links.
270
270
 
271
271
  ::tip
272
- Defaults can be overwritten, see [overwriting defaults](#overwriting-defaults) if you want to change them.
272
+ Defaults can be overwritten, see [overwriting defaults](/docs/3.x/api/components/nuxt-link#overwriting-defaults) if you want to change them.
273
273
  ::
274
274
 
275
275
  ## Overwriting Defaults
276
276
 
277
277
  ### In Nuxt Config
278
278
 
279
- You can overwrite some `<NuxtLink>` defaults in your [`nuxt.config`](/docs/3.x/api/nuxt-config#defaults)
279
+ You can overwrite some `<NuxtLink>` defaults in your [`nuxt.config`](/docs/3.x/guide/going-further/experimental-features#defaults)
280
280
 
281
281
  ::important
282
282
  These options will likely be moved elsewhere in the future, such as into `app.config` or into the `app/` directory.
@@ -336,11 +336,11 @@ function defineNuxtLink (options: NuxtLinkOptions): Component {}
336
336
 
337
337
  - `componentName`: A name for the component. Default is `NuxtLink`.
338
338
  - `externalRelAttribute`: A default `rel` attribute value applied on external links. Defaults to `"noopener noreferrer"`. Set it to `""` to disable
339
- - `activeClass`: A default class to apply on active links. Works the same as [Vue Router's `linkActiveClass` option](https://router.vuejs.org/api/interfaces/RouterOptions.html#Properties-linkActiveClass). Defaults to Vue Router's default (`"router-link-active"`)
340
- - `exactActiveClass`: A default class to apply on exact active links. Works the same as [Vue Router's `linkExactActiveClass` option](https://router.vuejs.org/api/interfaces/RouterOptions.html#Properties-linkExactActiveClass). Defaults to Vue Router's default (`"router-link-exact-active"`)
339
+ - `activeClass`: A default class to apply on active links. Works the same as [Vue Router's `linkActiveClass` option](https://router.vuejs.org/api/interfaces/routeroptions#linkActiveClass-). Defaults to Vue Router's default (`"router-link-active"`)
340
+ - `exactActiveClass`: A default class to apply on exact active links. Works the same as [Vue Router's `linkExactActiveClass` option](https://router.vuejs.org/api/interfaces/routeroptions#linkExactActiveClass-). Defaults to Vue Router's default (`"router-link-exact-active"`)
341
341
  - `trailingSlash`: An option to either add or remove trailing slashes in the `href`. If unset or not matching the valid values `append` or `remove`, it will be ignored.
342
342
  - `prefetch`: Whether or not to prefetch links by default.
343
343
  - `prefetchOn`: Granular control of which prefetch strategies to apply by default.
344
344
  - `prefetchedClass`: A default class to apply to links that have been prefetched.
345
345
 
346
- :link-example{to="/docs/examples/routing/pages"}
346
+ :link-example{to="/docs/3.x/examples/routing/pages"}
@@ -21,7 +21,7 @@ Add `<NuxtLoadingIndicator/>` in your [`app.vue`](/docs/3.x/directory-structure/
21
21
  </template>
22
22
  ```
23
23
 
24
- :link-example{to="/docs/examples/routing/pages"}
24
+ :link-example{to="/docs/3.x/examples/routing/pages"}
25
25
 
26
26
  ## Slots
27
27
 
@@ -9,7 +9,7 @@ links:
9
9
  ---
10
10
 
11
11
  ::tip
12
- The `<NuxtErrorBoundary>` uses Vue's [`onErrorCaptured`](https://vuejs.org/api/composition-api-lifecycle.html#onerrorcaptured) hook under the hood.
12
+ The `<NuxtErrorBoundary>` uses Vue's [`onErrorCaptured`](https://vuejs.org/api/composition-api-lifecycle#onerrorcaptured) hook under the hood.
13
13
  ::
14
14
 
15
15
  ## Events
@@ -43,7 +43,7 @@ The `<NuxtErrorBoundary>` uses Vue's [`onErrorCaptured`](https://vuejs.org/api/c
43
43
  </template>
44
44
  ```
45
45
 
46
- :read-more{to="/docs/getting-started/error-handling"}
46
+ :read-more{to="/docs/3.x/getting-started/error-handling"}
47
47
 
48
48
  ## Examples
49
49
 
@@ -4,7 +4,7 @@ description: The <NuxtWelcome> component greets users in new projects made from
4
4
  links:
5
5
  - label: Source
6
6
  icon: i-simple-icons-github
7
- to: https://github.com/nuxt/assets/blob/main/packages/templates/templates/welcome/index.html
7
+ to: https://github.com/nuxt/nuxt/blob/main/packages/ui-templates/templates/welcome/index.html
8
8
  size: xs
9
9
  ---
10
10
 
@@ -21,5 +21,5 @@ Preview the `<NuxtWelcome />` component.
21
21
  ::
22
22
 
23
23
  ::tip
24
- This component is part of [nuxt/assets](https://github.com/nuxt/assets).
24
+ This component is part of [`@nuxt/ui-templates`](https://github.com/nuxt/nuxt/tree/main/packages/ui-templates) package.
25
25
  ::
@@ -32,13 +32,20 @@ Server only components use `<NuxtIsland>` under the hood
32
32
  - **type**: `Record<string, any>`
33
33
  - `source`: Remote source to call the island to render.
34
34
  - **type**: `string`
35
- - **dangerouslyLoadClientComponents**: Required to load components from a remote source.
35
+ - **dangerouslyLoadClientComponents**: Required to load client components from a remote source.
36
36
  - **type**: `boolean`
37
37
  - **default**: `false`
38
38
 
39
39
  ::note
40
40
  Remote islands need `experimental.componentIslands` to be `'local+remote'` in your `nuxt.config`.
41
- It is strongly discouraged to enable `dangerouslyLoadClientComponents` as you can't trust a remote server's javascript.
41
+ ::
42
+
43
+ ::warning{icon="i-ph-warning-duotone"}
44
+ Using the `source` prop to render content from a remote server is inherently dangerous. When you specify a remote `source`, you are fully trusting that server to provide safe HTML content that will be rendered directly in your application.
45
+
46
+ This is similar to using `v-html` with external content - the remote server can inject any HTML, including potentially malicious content. **Only use `source` with servers you fully trust and control.**
47
+
48
+ The `dangerouslyLoadClientComponents` prop controls an additional layer of risk: whether to also download and execute client components from the remote source. Even with `dangerouslyLoadClientComponents` disabled (the default), you are still trusting the remote server's HTML output.
42
49
  ::
43
50
 
44
51
  ::note
@@ -16,4 +16,4 @@ const appConfig = useAppConfig()
16
16
  console.log(appConfig)
17
17
  ```
18
18
 
19
- :read-more{to="/docs/guide/directory-structure/app-config"}
19
+ :read-more{to="/docs/3.x/directory-structure/app-config"}
@@ -25,8 +25,8 @@ const { data, status, pending, error, refresh, clear } = await useAsyncData(
25
25
  </script>
26
26
  ```
27
27
 
28
- ::warning
29
- If you're using a custom useAsyncData wrapper, do not await it in the composable, as that can cause unexpected behavior. Please follow [this recipe](/docs/3.x/guide/recipes/custom-usefetch#custom-usefetch) for more information on how to make a custom async data fetcher.
28
+ ::warning{to="/docs/3.x/guide/recipes/custom-usefetch#custom-usefetchuseasyncdata"}
29
+ If you're using a custom `useAsyncData` wrapper, do not await it in the composable as that can cause unexpected behavior. See recipe for custom async data fetcher.
30
30
  ::
31
31
 
32
32
  ::note
@@ -133,7 +133,7 @@ The handler signal will be aborted when:
133
133
  [`useAsyncData`](/docs/3.x/api/composables/use-async-data) is a reserved function name transformed by the compiler, so you should not name your own function [`useAsyncData`](/docs/3.x/api/composables/use-async-data).
134
134
  ::
135
135
 
136
- :read-more{to="/docs/getting-started/data-fetching#useasyncdata"}
136
+ :read-more{to="/docs/3.x/getting-started/data-fetching#useasyncdata"}
137
137
 
138
138
  ## Params
139
139
 
@@ -167,7 +167,7 @@ The `handler` function should be **side-effect free** to ensure predictable beha
167
167
  Under the hood, `lazy: false` uses `<Suspense>` to block the loading of the route before the data has been fetched. Consider using `lazy: true` and implementing a loading state instead for a snappier user experience.
168
168
  ::
169
169
 
170
- ::read-more{to="/docs/api/composables/use-lazy-async-data"}
170
+ ::read-more{to="/docs/3.x/api/composables/use-lazy-async-data"}
171
171
  You can use `useLazyAsyncData` to have the same behavior as `lazy: true` with `useAsyncData`.
172
172
  ::
173
173
 
@@ -280,4 +280,4 @@ interface AsyncDataExecuteOptions {
280
280
  type AsyncDataRequestStatus = 'idle' | 'pending' | 'success' | 'error'
281
281
  ```
282
282
 
283
- :read-more{to="/docs/getting-started/data-fetching"}
283
+ :read-more{to="/docs/3.x/getting-started/data-fetching"}
@@ -54,21 +54,21 @@ export function useCookie<T = string | null | undefined> (
54
54
 
55
55
  Most of the options will be directly passed to the [cookie](https://github.com/jshttp/cookie) package.
56
56
 
57
- | Property | Type | Default | Description |
58
- | --- | --- | --- | --- |
59
- | `decode` | `(value: string) => T` | `decodeURIComponent` + [destr](https://github.com/unjs/destr). | Custom function to decode the cookie value. Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to decode a previously encoded cookie value into a JavaScript string or other object. <br/> **Note:** If an error is thrown from this function, the original, non-decoded cookie value will be returned as the cookie's value. |
60
- | `encode` | `(value: T) => string` | `JSON.stringify` + `encodeURIComponent` | Custom function to encode the cookie value. Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to encode a value into a string suited for a cookie's value. |
61
- | `default` | `() => T \| Ref<T>` | `undefined` | Function returning the default value if the cookie does not exist. The function can also return a `Ref`. |
62
- | `watch` | `boolean \| 'shallow'` | `true` | Whether to watch for changes and update the cookie. `true` for deep watch, `'shallow'` for shallow watch, i.e. data changes for only top level properties, `false` to disable. <br/> **Note:** Refresh `useCookie` values manually when a cookie has changed with [`refreshCookie`](/docs/3.x/api/utils/refresh-cookie). |
63
- | `readonly` | `boolean` | `false` | If `true`, disables writing to the cookie. |
64
- | `maxAge` | `number` | `undefined` | Max age in seconds for the cookie, i.e. the value for the [`Max-Age` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.2). The given number will be converted to an integer by rounding down. By default, no maximum age is set. |
65
- | `expires` | `Date` | `undefined` | Expiration date for the cookie. By default, no expiration is set. Most clients will consider this a "non-persistent cookie" and will delete it on a condition like exiting a web browser application. <br/> **Note:** The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and `maxAge` is set, then `maxAge` takes precedence, but not all clients may obey this, so if both are set, they should point to the same date and time! <br/>If neither of `expires` and `maxAge` is set, the cookie will be session-only and removed when the user closes their browser. |
66
- | `httpOnly` | `boolean` | `false` | Sets the HttpOnly attribute. <br/> **Note:** Be careful when setting this to `true`, as compliant clients will not allow client-side JavaScript to see the cookie in `document.cookie`. |
67
- | `secure` | `boolean` | `false` | Sets the [`Secure` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.5). <br/>**Note:** Be careful when setting this to `true`, as compliant clients will not send the cookie back to the server in the future if the browser does not have an HTTPS connection. This can lead to hydration errors. |
68
- | `partitioned` | `boolean` | `false` | Sets the [`Partitioned` `Set-Cookie` attribute](https://datatracker.ietf.org/doc/html/draft-cutler-httpbis-partitioned-cookies#section-2.1). <br/>**Note:** This is an attribute that has not yet been fully standardized, and may change in the future. <br/>This also means many clients may ignore this attribute until they understand it.<br/>More information can be found in the [proposal](https://github.com/privacycg/CHIPS). |
69
- | `domain` | `string` | `undefined` | Sets the [`Domain` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.3). By default, no domain is set, and most clients will consider applying the cookie only to the current domain. |
70
- | `path` | `string` | `'/'` | Sets the [`Path` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.4). By default, the path is considered the ["default path"](https://tools.ietf.org/html/rfc6265#section-5.1.4). |
71
- | `sameSite` | `boolean \| string` | `undefined` | Sets the [`SameSite` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7). <br/>- `true` will set the `SameSite` attribute to `Strict` for strict same-site enforcement.<br/>- `false` will not set the `SameSite` attribute.<br/>- `'lax'` will set the `SameSite` attribute to `Lax` for lax same-site enforcement.<br/>- `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie.<br/>- `'strict'` will set the `SameSite` attribute to `Strict` for strict same-site enforcement. |
57
+ | Property | Type | Default | Description |
58
+ |---------------|------------------------|----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
59
+ | `decode` | `(value: string) => T` | `decodeURIComponent` + [destr](https://github.com/unjs/destr). | Custom function to decode the cookie value. Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to decode a previously encoded cookie value into a JavaScript string or other object. <br/> **Note:** If an error is thrown from this function, the original, non-decoded cookie value will be returned as the cookie's value. |
60
+ | `encode` | `(value: T) => string` | `JSON.stringify` + `encodeURIComponent` | Custom function to encode the cookie value. Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to encode a value into a string suited for a cookie's value. |
61
+ | `default` | `() => T \| Ref<T>` | `undefined` | Function returning the default value if the cookie does not exist. The function can also return a `Ref`. |
62
+ | `watch` | `boolean \| 'shallow'` | `true` | Whether to watch for changes and update the cookie. `true` for deep watch, `'shallow'` for shallow watch, i.e. data changes for only top level properties, `false` to disable. <br/> **Note:** Refresh `useCookie` values manually when a cookie has changed with [`refreshCookie`](/docs/3.x/api/utils/refresh-cookie). |
63
+ | `readonly` | `boolean` | `false` | If `true`, disables writing to the cookie. |
64
+ | `maxAge` | `number` | `undefined` | Max age in seconds for the cookie, i.e. the value for the [`Max-Age` `Set-Cookie` attribute](https://datatracker.ietf.org/doc/html/rfc6265#section-5.2.2). The given number will be converted to an integer by rounding down. By default, no maximum age is set. |
65
+ | `expires` | `Date` | `undefined` | Expiration date for the cookie. By default, no expiration is set. Most clients will consider this a "non-persistent cookie" and will delete it on a condition like exiting a web browser application. <br/> **Note:** The [cookie storage model specification](https://datatracker.ietf.org/doc/html/rfc6265#section-5.3) states that if both `expires` and `maxAge` is set, then `maxAge` takes precedence, but not all clients may obey this, so if both are set, they should point to the same date and time! <br/>If neither of `expires` and `maxAge` is set, the cookie will be session-only and removed when the user closes their browser. |
66
+ | `httpOnly` | `boolean` | `false` | Sets the HttpOnly attribute. <br/> **Note:** Be careful when setting this to `true`, as compliant clients will not allow client-side JavaScript to see the cookie in `document.cookie`. |
67
+ | `secure` | `boolean` | `false` | Sets the [`Secure` `Set-Cookie` attribute](https://datatracker.ietf.org/doc/html/rfc6265#section-5.2.5). <br/>**Note:** Be careful when setting this to `true`, as compliant clients will not send the cookie back to the server in the future if the browser does not have an HTTPS connection. This can lead to hydration errors. |
68
+ | `partitioned` | `boolean` | `false` | Sets the [`Partitioned` `Set-Cookie` attribute](https://datatracker.ietf.org/doc/html/draft-cutler-httpbis-partitioned-cookies#section-2.1). <br/>**Note:** This is an attribute that has not yet been fully standardized, and may change in the future. <br/>This also means many clients may ignore this attribute until they understand it.<br/>More information can be found in the [proposal](https://github.com/privacycg/CHIPS). |
69
+ | `domain` | `string` | `undefined` | Sets the [`Domain` `Set-Cookie` attribute](https://datatracker.ietf.org/doc/html/rfc6265#section-5.2.3). By default, no domain is set, and most clients will consider applying the cookie only to the current domain. |
70
+ | `path` | `string` | `'/'` | Sets the [`Path` `Set-Cookie` attribute](https://datatracker.ietf.org/doc/html/rfc6265#section-5.2.4). By default, the path is considered the ["default path"](https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.4). |
71
+ | `sameSite` | `boolean \| string` | `undefined` | Sets the [`SameSite` `Set-Cookie` attribute](https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7). <br/>- `true` will set the `SameSite` attribute to `Strict` for strict same-site enforcement.<br/>- `false` will not set the `SameSite` attribute.<br/>- `'lax'` will set the `SameSite` attribute to `Lax` for lax same-site enforcement.<br/>- `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie.<br/>- `'strict'` will set the `SameSite` attribute to `Strict` for strict same-site enforcement. |
72
72
 
73
73
  ## Return Values
74
74
 
@@ -180,4 +180,4 @@ export default defineEventHandler((event) => {
180
180
  })
181
181
  ```
182
182
 
183
- :link-example{to="/docs/examples/advanced/use-cookie"}
183
+ :link-example{to="/docs/3.x/examples/advanced/use-cookie"}
@@ -22,8 +22,8 @@ You can use this composable in your components, pages, or plugins to access or r
22
22
 
23
23
  ```ts
24
24
  interface NuxtError<DataT = unknown> {
25
- statusCode: number
26
- statusMessage: string
25
+ status: number
26
+ statusText: string
27
27
  message: string
28
28
  data?: DataT
29
29
  error?: true
@@ -52,4 +52,4 @@ if (error.value) {
52
52
  </script>
53
53
  ```
54
54
 
55
- :read-more{to="/docs/getting-started/error-handling"}
55
+ :read-more{to="/docs/3.x/getting-started/error-handling"}