Join the Webstudio community

Updated 4 months ago

Collection index

At a glance

The community member has a collection of three sentences and wants to know if they can get the corresponding indices (0, 1, 2) for each sentence. The community members discuss that the collection is used in a radix accordion, and the unique values for each item need to be defined to make the accordion work. They suggest using the full text of the sentences as the unique values. The community members also discuss how the accordion works behind the scenes, and one community member asks about changing the position of the arrow for the opened item, but there is no explicit answer provided.

Let's suppose that collection :

[
"What age groups do you cater to?",
"What are the school hours?",
"Is there a summer program?"
]

In my item, can I get (0, 1, 2) corresponding on the key of my 3 sentences ?
B
Z
12 comments
Hey, what do you need it for?
That collection is in a radix accordion, and by reading the doc, I need to define an unique value to items in order to make the accordion to work. Got the idea to have that kind of pattern "accordion-item + key" as a value for each items
You can use the text, could be any unique value
ah, the value don't need to be of type code or slugified ? Can put a full sentence here ?
ah yes you right, it works
the doc is a little short about how it works, I'm not sure to understand how it works behind the scene, but it works quite "magically" ^^
Another question if you are still here : here is my accordion, how can I change the position of the arrow for the opened item ?
Attachment
image.png
is there a "state" for the opened item when I can change css of children elements like I can do with "hover" or "active" etc.. ?
No way yet, wait til announcement in coming weeks πŸ™‚
ok, nice, thank you !
Add a reply
Sign up and join the conversation on Discord