#Child slot prop to parent

2 messages · Page 1 of 1 (latest)

paper torrentBOT
#

Hi @timid oasis. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

I'm sorry, but the knowledge sources do not describe a way to pass props or objects directly from a child slot back up to a parent component in Astro. Slots in Astro are designed for passing content from parent to child, not the other way around. The slot mechanism allows you to inject HTML or components into a child, but there is no documented pattern for sending data "up" from a slotted child to its parent.

If you need to share state or data between components, Astro recommends using shared state solutions like Nano Stores, especially when working with interactive islands, but this is for sharing state across components, not specifically for passing data from a slot child to a parent via the slot mechanism Share state between islands.

If you have a use case where a child needs to communicate with a parent, you may need to restructure your component hierarchy or use a shared state/store approach. There is no built-in or documented way in Astro to pass props or objects from a child slot to a parent component.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: