Next.js Discord

Discord Forum

close the nextui accordion not by clicking it

Unanswered
Barbary Lion posted this in #help-forum
Open in Discord
Barbary LionOP
but with a state variable, is it possible?

11 Replies

Sure its possible. you using shadcn?
Barbary LionOP
oh it needs to be controlled
yep
Barbary LionOP
okay fixed :lolsob:
Lol NJ. Make sure to close your post please 🙂
Barbary LionOP
everytime i ask on discord, i inmediately solve the problem
No worries man. If you can provide the example of how you fixed it and mark it as the answer. Just so if anyone else has this problem they can find it archived!
Barbary LionOP
cool, give me some minutes
np!
Barbary LionOP
if you set this to an empty array you can close it, but it needs to be controlled
  const [expandedKeys, setExpandedKeys] = useState<Set<Key>>(new Set<Key>(['item1']));
Original message was deleted
Use this to mark the answer 🙂