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>
import { Wrap } from "@alloy-js/core/stc";
Wrap({ props: Omit<TProps, "children">, when: boolean, with: ComponentDefinition<TProps>,}).children(children)
Props
children | Children Children to be wrapped. |
props | optionalOmit<TProps, “children”> Props to pass to the wrapper component. |
when | boolean When true, the children will be wrapped with the provided component. Otherwise, the children will be rendered as is. |
with | ComponentDefinition<TProps> Component to be used for wrapping. |