- Dependencies:
- ∟Direct: 1
- ∟Peer: 2
- Source code ↗
- Check on NPM ↗
Merges any properties to the element directly below it.
This component is a clone of the Slot component developed and maintained by Radix UI.
It is included in our library to keep component imports consistent and to make it easier to work with dependent components.
Installation
Section titled “Installation”pnpm add @inpulse-ui/slotbun add @inpulse-ui/slotyarn add @inpulse-ui/slotnpm install @inpulse-ui/slot-
Create an element with slots
Use a simple
Slotto create your ownasChildAPI.import { Slot } from "@inpulse-ui/slot";function Button({ asChild, ...props }) {const Comp = asChild ? Slot : 'button';return <Comp {...props} />;}If your component has multiple childrens, use
Slottable. This way it will be possible to pass the properties to the correct element.import { Slottable } from "@inpulse-ui/slot";function Button({ asChild, leftElement, rightElement, ...props }) {const Comp = asChild ? Slot : 'button';return (<Comp {...props}>{leftElement}<Slottable>{children}</Slottable>{rightElement}</Comp>);} -
Apply your element
import { Button } from './your-button';export default () => (<Button asChild><a href="/contact">Contact</a></Button>);
Built with by Jo Santana in Brazil.
© 2026 Inpulse. All rights reserved.