Skip to content

Wrap

Conditionally wrap the children of this component with the component given to with and passing props to it.

import { Wrap } from "@alloy-js/core";
<Wrap
props={Omit<TProps, "children">}
when
with={ComponentDefinition<TProps>}
>
{children}
</Wrap>

Props

childrenChildren

Children to be wrapped.

propsoptionalOmit<TProps, “children”>

Props to pass to the wrapper component.

whenboolean

When true, the children will be wrapped with the provided component. Otherwise, the children will be rendered as is.

withComponentDefinition<TProps>

Component to be used for wrapping.