Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

docs(api): add <ClientOnly> to API docs #8400

Merged
merged 2 commits into from Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 41 additions & 0 deletions docs/content/3.api/2.components/1.client-only.md
@@ -0,0 +1,41 @@
---
description: The <ClientOnly> component renders its slot only in client-side.
---
# `<ClientOnly>`

The `<ClientOnly>` 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(there seems a type at end of the sentence)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which one ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of the plugin, I assume you meant "within the component". (Alternative to .client components)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was retrieved from the guide docs.
Maybe changing to To import a component only on the client, add the .client suffix to the component file name or import it explicitly within the component. might be better ?


## Props

- **placeholderTag** | **fallbackTag**: specify a tag to be rendered server-side.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(default missing)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll fix this :) thanks !

- **placeholder** | **fallback**: specify a content to be rendered server-side.

```vue
<template>
<div>
<Sidebar />
<ClientOnly fallback-tag="span" fallback="Loading comments...">
<Comment />
</ClientOnly>
</div>
</template>
```

## Slots

- **#fallback**: specify a content to be displayed server-side.

```vue
<template>
<div>
<Sidebar />
<ClientOnly>
<!-- ... -->
<template #fallback>
<!-- this will be rendered on server side -->
<p>Loading comments...</p>
</template>
</ClientOnly>
</div>
</template>
```