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

Allow user to define initial expanded state of List.Accordion #616

Closed
connercms opened this issue Oct 21, 2018 · 4 comments
Closed

Allow user to define initial expanded state of List.Accordion #616

connercms opened this issue Oct 21, 2018 · 4 comments

Comments

@connercms
Copy link

Current behaviour

Unless I am missing something in the code, currently all List.Accordion components are initialized with expanded state as false, but I think some users (myself included) would find it beneficial to have them begin opened.

Expected behaviour

I think it would be as easy as setting the initial state as follows to allow user to define if the component should start as opened or closed

state = {
    expanded: this.props.expanded || false
  }

Code sample

^

@jimmiehansson
Copy link

Sure, I can go ahead with this 👍

@Trancever
Copy link
Contributor

Hi @connercms . Would you like to submit PR with a fix?

@bombillazo
Copy link
Contributor

Is there any way to have a default open accordion without needing to control the component? I don't want to track a state variable just to have an initial state on the accordion group.

@ArnaudFeelbat
Copy link

@bombillazo Did you find a way to do it ?

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

No branches or pull requests

7 participants