skip to Main Content

Currently, I am facing issue in React js Chakra UI Accordion. Issue is all items are remain closed by default for mobile responsive only but keep open for desktop and tablet view.
I am not using any different condition for responsive but it behaves differently for mobile view only.

My goal is to all accordion items should open by default.

<Accordion defaultIndex={defaultIndices}>

2

Answers


  1. Assuming that defaultIndices is an array, try to add allowMultiple={true}

    Login or Signup to reply.
  2. I think you should do the map on your index of accordion items and chakra ui component will look’s like

    <Accordion defaultIndex={[0,1,3,4]} allowMultiple>
    

    [0,1,3,4] – possible to do the map

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search