VayuUI

Show

Declarative control-flow components for conditional rendering.

Installation

npx vayu-ui-cli@latest add show

Usage

Show / Hide

✅ Content is visible!

Show with render prop (type-safe value)

Hello from Show!

Switch / Case

Idle — pick a status above.

Features

  • <Show> — renders children when the when prop is truthy, otherwise renders fallback
  • Render-prop — pass a function as children to receive the type-narrowed truthy value
  • <Match> / <Case> / <Default> — evaluates cases in order, renders first match
  • Zero runtime overhead — no extra DOM nodes or styles
  • Server component compatible (no "use client" in the component file)

Show Props

PropTypeDefaultDescription
whenT | undefined | null | false—Condition to check
fallbackReactNodenullRendered when when is falsy
childrenReactNode | (value: T) => ReactNode—Content or render function

Match Props

ComponentPropTypeDescription
MatchchildrenReactNodeMust contain Case and/or Default
CaseconditionbooleanRenders if truthy (first match wins)
DefaultchildrenReactNodeRendered if no Case matches

On this page