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>
childrenChildrenChildren to be wrapped.
propsoptional Omit<TProps, “children”>Props to pass to the wrapper component.
whenbooleanWhen 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.