Merges its props onto its immediate child.
Can be used to support your own `asChild` prop.
Import the component.
Use to create your own asChild API.
When your component has a single children element:
Use Slottable when your component has multiple children to pass the props to the correct element:
Pass the child to Slottable via the child prop and provide a render function to wrap the slotted element in additional markup, while Slot still merges its props and refs onto the child.
Any prop that starts with on (e.g., onClick) is considered an event handler.
When merging event handlers, Slot will create a new function where the child handler takes precedence over the slot handler.
If one of the event handlers relies on event.defaultPrevented make sure that the order is correct.
Slot.createSlot returns a Slot component scoped to the name you pass, which is used in its error messages. It accepts type arguments to specify the element the slot renders and the props it accepts, so consumers get accurate types. Slot.SlotProps accepts the same type arguments.