client-only
diceui-radix/client-onlyFreeComponent
diceui/radix publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/sadmann7/diceui/HEAD/docs/public/r/styles/radix-nova/client-only.jsonSource
1"use client";23import * as React from "react";45interface ClientOnlyProps {6 children: React.ReactNode;7 fallback?: React.ReactNode;8}910function subscribe() {11 return () => {};12}1314function getSnapshot() {15 return true;16}1718function getServerSnapshot() {19 return false;20}2122function ClientOnly({ children, fallback = null }: ClientOnlyProps) {23 const mounted = React.useSyncExternalStore(24 subscribe,25 getSnapshot,26 getServerSnapshot,27 );2829 if (!mounted) return fallback;3031 return children;32}3334export { ClientOnly };
Files it writes
More from diceui/radix
All 58 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| action-baraction-bar | diceui/radix | Components | Free | 1 dep · 2 files | |
| angle-sliderangle-slider | diceui/radix | Components | Free | 1 dep · 3 files | |
| avatar-groupavatar-group | diceui/radix | Components | Free | 1 dep | |
| badge-overflowbadge-overflow | diceui/radix | Components | Free | 1 dep · 2 files | |
| bannerbanner | diceui/radix | Components | Free | 1 dep | |
| checkbox-groupcheckbox-group | diceui/radix | Components | Free | 1 dep | |
| circular-progresscircular-progress | diceui/radix | Components | Free | 1 dep | |
| color-pickercolor-picker | diceui/radix | Components | Free | 1 dep · 3 files |
