Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need accordion mode to prevent collapsing all sections #108

Open
rickthepick opened this issue Jan 24, 2019 · 1 comment
Open

Need accordion mode to prevent collapsing all sections #108

rickthepick opened this issue Jan 24, 2019 · 1 comment

Comments

@rickthepick
Copy link

rickthepick commented Jan 24, 2019

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.

@rickthepick rickthepick changed the title Need accordion mode flag "alwaysExpanded" Need accordion mode to prevent collapsing all section Jan 24, 2019
@rickthepick rickthepick changed the title Need accordion mode to prevent collapsing all section Need accordion mode to prevent collapsing all sections Jan 24, 2019
@ghost
Copy link

ghost commented Apr 11, 2019

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant