Skip to content
shadcn.io
shadcn.io is not affiliated with official shadcn/ui

Shadcn Client Only for React and Tailwind

Render content only on the client side.

Installation

bunx --bun shadcn@latest add https://kit.dev/r/client-only.json

Usage

import { ClientOnly } from "@/registry/react/components/client-only";
<ClientOnly>
  <div>This content only renders on the client.</div>
</ClientOnly>

Examples

With fallback

Pass fallback to show content while the client-only content is loading:

API Reference

ClientOnly

Shows children only on the client. Useful for hydration-safe client components.

PropTypeDefault
fallbackReactNode-

For a complete list of props, see the Ark UI documentation.