diff --git a/docs/2.guide/2.directory-structure/1.components.md b/docs/2.guide/2.directory-structure/1.components.md index 1addc266c2..a33a0cbff8 100644 --- a/docs/2.guide/2.directory-structure/1.components.md +++ b/docs/2.guide/2.directory-structure/1.components.md @@ -244,6 +244,10 @@ This feature only works with Nuxt auto-imports and `#components` imports. Explic `.client` components are rendered only after being mounted. To access the rendered template using `onMounted()`, add `await nextTick()` in the callback of the `onMounted()` hook. :: +::read-more{to="/docs/api/components/client-only"} +You can also achieve a similar result with the `` component. +:: + ## Server Components Server components allow server-rendering individual components within your client-side apps. It's possible to use server components within Nuxt, even if you are generating a static site. That makes it possible to build complex sites that mix dynamic components, server-rendered HTML and even static chunks of markup. @@ -357,89 +361,12 @@ In this case, the `.server` + `.client` components are two 'halves' of a compone ``` -## `` Component +## Built-In Nuxt Components -Nuxt provides the [``](/docs/api/components/client-only) component for purposely rendering a component only on client side. +There are a number of components that Nuxt provides, including `` and ``. You can read more about them in the API documentation. -```vue [pages/example.vue] - -``` - -Use a slot as fallback until `` is mounted on client side. - -```vue [pages/example.vue] - -``` - - - - -## `` Component - -Nuxt provides the `` component to render a component only during development. - -The content will not be included in production builds and tree-shaken. - -```vue [pages/example.vue] - -``` - -## `` Component - -Nuxt provides the `` component to render its content on the client if any of its children trigger an error in SSR. -You can specify a `fallbackTag` to make it render a specific tag if it fails to render on the server. - -```vue [pages/example.vue] - -``` ## Library Authors diff --git a/docs/3.api/1.components/1.client-only.md b/docs/3.api/1.components/1.client-only.md index 481ab8ab9c..86e56d2547 100644 --- a/docs/3.api/1.components/1.client-only.md +++ b/docs/3.api/1.components/1.client-only.md @@ -8,7 +8,11 @@ links: size: xs --- -The `` component renders its slot only in client-side. To import a component only on the client, register the component in a client-side only plugin. +The `` component is used for purposely rendering a component only on client side. + +::note +The content of the default slot will be tree-shaken out of the server build. (This does mean that any CSS used by components within it may not be inlined when rendering the initial HTML.) +:: ## Props @@ -19,6 +23,7 @@ The `` component renders its slot only in client-side. To import a c