Composable

Defines a composable child inside of a Compose component

function Button({ asChild, children, ...props }) {
  const Composition = asChild ? Compose : "button";
  return (
    <Composition {...props}>
      Prefix <Composable>{children}</Composable>
    </Composition>
  );
}

Required props

children

Defines the composition root

type
React.ReactNode
default
null

Optional props

render

Render function. Use it to wrap the root with containers

type
RenderProps
default
null
Last updated on