Show

Show displays content in the UI based on a condition. Inspired by SolidJS.

import { Show } from '@cerberus/react'

Usage

The Show component takes a when prop that determines whether the children or the fallback content should be rendered. If when is true, the children are rendered. If when is false, the fallback content is rendered.

You are not allowed to enter!

API

export interface ShowProps {
when: boolean | null | undefined
fallback?: ReactNode
}
define function Show(props: ShowProps): ReactNode | null

Props

The Show component accepts the following props:

NameDefaultDescription
whenfalseThe condition to evalue for showing the children or fallback.
fallbacknullThe content to render when the condition is false.