Join the Webstudio community

Updated 2 months ago

Collection variables in slots

At a glance

The community member is asking if it is possible to use a collection's variables in the slots contained within that collection. They have several repeating elements within a single collection and would like to link them, but they cannot find a way to pull data from the collection for these elements.

The comments indicate that while it is possible to access variables defined outside the slot within the slot, the community member is unable to access the collection variables, only global variables. Another community member confirms that slots within collections do not have access to any variables outside the slot. It is suggested that this functionality may be possible with components, as slots have access only to global variables.

Though it is mentioned that it is possible to access CSS variables from these slots.

Useful resources
Is it possible to use a collection’s variables in the slots contained within that collection? I have several repeating elements within a single collection, and I’d like to link them. However, I can’t find a way to pull data from the collection for these elements.
J
s
B
6 comments
Hi yes you should be able to access variables defined outside the slot within the slot https://youtu.be/MWTpgOmv6N0
I have access to global variables, but I don’t see the collection variables—meaning the data retrieved in that specific instance.
Ah I see. @Bogdan should this be supported? Slots within Collections dont have access to any vars outside the Slot
This will be possible with components. Slot have access only to global variables.
Ah gotcha. I forgot this was the case
Though it is possible to access css variables from these slots
Add a reply
Sign up and join the conversation on Discord