How to make one nestable according item open at a time

Hi There,

How do I create an Accordion(nestable) where only one item can be opened? The other open item will automatically close if you click on an item.

Here’s a video of this feature on a website, exactly what I need.
https://jam.dev/c/727d8ff1-ae30-4599-8258-f7a575b6ce57

I’m aiming to make the very same accordion on my current project.
Thank you!