🔗Slot as templates
Introduction
import { useRef } from "atomico";
import { useSlot } from "@atomico/hooks/use-slot";
function component() {
const refSlotIcon = useRef();
const slotIcon = useSlot(refSlotIcon);
return (
<host shadowDom>
<slot
name="icon"
ref={refSlotIcon}
style={slotIcon.length ? null : "display: none"}
/>
<slot />
</host>
);
}Slot pattern as a template
Example
ExampleLast updated
Was this helpful?
