For this, we use slot props. In Hoverable.svelte
, pass the hovering
value into the slot:
Then, to expose hovering
to the contents of the <Hoverable>
component, we use the directive:
You can have as many of these components as you like, and the slotted props will remain local to the component where they’re declared.