Need accordion mode to prevent collapsing all sections
rickthepick opened this issue · 1 comments
rickthepick commented
Currently in accordion mode (accordion=true) all the sections can be collapsed. We need a flag so that there is always one section open, e.g., if a section is open you cannot click on that section to collapse it.
Deleted user commented
I solved this by utilizing the onChange
callback and state.
Example with React 16.8:
const Accordion = () => {
const [activeKey, setActiveKey] = React.useState(`0`)
return (
<Collapse
accordion={true}
activeKey={activeKey}
onChange={key => {
setActiveKey(key || activeKey)
}}
>
...
</Collapse>
)
}
But a convenient flag would be much appreciated!