Helpers·loomora/ConditionalWrapper
⚙Related configs↗ConditionalWrapper
A helper for optional element composition based on a child condition and fallback wrapper configuration.
Interactive live playground
Tweak props, change states, and see the live component respond in real time.
How to call
Import directly from the Loomora package root. For projects without Tailwind CSS, ensure loomora/dist/index.css is imported once in your root layout.
import { ConditionalWrapper } from 'loomora'
<ConditionalWrapper
childrenCondition={Boolean(link)}
fallback={{ as: 'div', attributes: { className: 'rounded-xl p-4' } }}
>
Content
</ConditionalWrapper>API reference
Important public props and how they affect rendering.
| Prop | Type | Default | Description |
|---|---|---|---|
| childrenCondition | boolean | false | Controls whether the primary wrapper is used. |
| children | ReactNode | — | Content passed through the selected wrapper. |
| wrapper | wrapper configuration | — | Primary element/component wrapper props. |
| fallback | wrapper configuration | — | Optional wrapper configuration when condition is false. |