react-daisyui icon indicating copy to clipboard operation
react-daisyui copied to clipboard

Collapse default open

Open itaiperi opened this issue 11 months ago • 4 comments

Hi Benji,

Wanted to suggest an improvement to the Collapse component - a defaultOpen attribute, that will set the Collapse to be open by default on mount, but will have a default value of false, to keep backward compatibility of course. This will enable to have the collapse open at the beginning, without taking full control over opening and closing from a controlling component, which can be cumbersome.

I've had several such use-cases over the past few weeks.

What do you say? I'm willing to implement this, if you'll give it the green light.

itaiperi avatar Apr 10 '25 22:04 itaiperi

@itaiperi that would be great, and looking back, I'm surprised we don't have this. Feel free to open a PR!

benjitrosch avatar Apr 16 '25 19:04 benjitrosch

This is a great suggestion, and I'd like to propose adding a defaultOpen prop (defaulting to false) to initialize the collapse state on mount without affecting controlled usage. If no one has taken this on yet, I'd love to work on it.

AdeboyeDN avatar Apr 19 '25 10:04 AdeboyeDN

@AdeboyeDN All yours if you're asking me :)

itaiperi avatar Apr 23 '25 08:04 itaiperi

@AdeboyeDN All yours if you're asking me :)

Yeah, i already created a PR I'm waiting for it to be reviewed and merged.

AdeboyeDN avatar Apr 23 '25 09:04 AdeboyeDN