# Client Only (REACT)

## Motivation

The `ClientOnly` component renders its children only on the client side. This is useful for components that need to
access the DOM or browser APIs that are not available on the server side.

## Examples

### Basic

**Example: basic**

#### React

```tsx
import { ClientOnly } from '@ark-ui/react/client-only'

export const Basic = () => (
  <ClientOnly>
    <div>This content is only rendered on the client side.</div>
  </ClientOnly>
)

```

#### Solid

```tsx
import { ClientOnly } from '@ark-ui/solid/client-only'

export const Basic = () => (
  <ClientOnly>
    <div>This content is only rendered on the client side.</div>
  </ClientOnly>
)

```

#### Vue

```vue
<script setup lang="ts">
import { ClientOnly } from '@ark-ui/vue/client-only'
</script>

<template>
  <ClientOnly>
    <div>This content is only rendered on the client side.</div>
  </ClientOnly>
</template>

```

#### Svelte

```svelte
<script lang="ts">
  import { ClientOnly } from '@ark-ui/svelte/client-only'
</script>

<ClientOnly>
  <div>This content is only rendered on the client side.</div>
</ClientOnly>

```

### With Fallback

**Example: with-fallback**

#### React

```tsx
import { ClientOnly } from '@ark-ui/react/client-only'

export const WithFallback = () => (
  <ClientOnly fallback={<div>Loading...</div>}>
    <div>This content is only rendered on the client side.</div>
  </ClientOnly>
)

```

#### Solid

```tsx
import { ClientOnly } from '@ark-ui/solid/client-only'

export const WithFallback = () => (
  <ClientOnly fallback={<div>Loading...</div>}>
    <div>This content is only rendered on the client side.</div>
  </ClientOnly>
)

```

#### Vue

```vue
<script setup lang="ts">
import { ClientOnly } from '@ark-ui/vue/client-only'
</script>

<template>
  <ClientOnly>
    <template #fallback>
      <div>Loading...</div>
    </template>
    <div>This content is only rendered on the client side.</div>
  </ClientOnly>
</template>

```

#### Svelte

```svelte
<script lang="ts">
  import { ClientOnly } from '@ark-ui/svelte/client-only'
</script>

<ClientOnly>
  {#snippet fallback()}
    <div>Loading...</div>
  {/snippet}
  <div>This content is only rendered on the client side.</div>
</ClientOnly>

```

## API Reference

**Component API Reference**

#### React

**ClientOnly Props:**

| Prop | Type | Required | Description |
|------|------|----------|-------------|
| `fallback` | `any` | No |  |


#### Solid

**ClientOnly Props:**

| Prop | Type | Required | Description |
|------|------|----------|-------------|
| `fallback` | `number | boolean | Node | ArrayElement | (string & {})` | No |  |


#### Svelte

**ClientOnly Props:**

| Prop | Type | Required | Description |
|------|------|----------|-------------|
| `fallback` | `Snippet<[]>` | No |  |