Merges its props onto its immediate child.
Can be used to support your own `asChild` prop.
Install the component from your command line.
Import the component.
Use to create your own asChild
API.
When your component has a single children element:
Use when your component has multiple childrens to pass the props to the correct element:
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.