Show
Truthy conditional renderer that unwraps non-null data directly to children render function.
1.2 KB
•Updated on September 3, 2026
Installation
Bash
pnpm dlx shadcn@latest add @spaceui/hooks-components-showUsage
Code
import { Show } from '@/components/show'
import { Show } from '@/components/show'```
```tsx
<Show when={currentUser} fallback={<p>Logged Out</p>}>
{(user) => <h1>Hello, {user.name}</h1>}
</Show>API Reference
Parameters / Props
| Prop | Type | Default | Description |
|---|---|---|---|
when | T|null|undefined|false | required | Condition data. |
fallback | ReactNode | null | Falsy fallback. |
children | ReactNode|((data: NonNullable<T>) => ReactNode) | required | Render callback with unwrapped data. |
Return Value
| Return Type | Description |
|---|---|
ReactNode | Rendered output. |