I'm new to React and Ant Design. Ant design's collapse widget allows all items to be open, but there is no way pre-baked way to set the items to be all open by default - you can only set a single collapse unit to be default opened with
defaultActiveKey={['1']}
How would I default open all?
You can use defaultActiveKey for that case.
As you see below it will accept an Array(also number and string)
defaultActiveKey?: Array<string | number> | string | number;
So you can do:
defaultActiveKey={['1', '2', '3', '4', '5']}
But do not use activeKey, because can not close the panels unless you want to force open them all panels without any option to be closed.
you should use activeKey property
activeKey={['1','2','3']}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With