🔀Slot
Last updated
Was this helpful?
Was this helpful?
<my-component>
<my-component-header></my-component-header>
<my-component-footer></my-component-footer>
</my-component>myComponentHeader.props = {
slot: { type: String, value: "header" }
}
myComponentFooter.props = {
slot: { type: String, value: "footer" }
}import { useRef } from "atomico";
import { useSlot } from "@atomico/hooks/use-slot";
function component() {
const ref = useRef();
const childNodes = useSlot(ref);
return <host shadowDom>
<header style={{
display: childNodes.length? "block": "none"
}}>
<slot name="header" ref={ref} />
</header>
</host>
}