Accordion ActiveIndex

UI Components for React
Post Reply
lharley
Posts: 4
Joined: 16 Nov 2018, 01:43

04 Feb 2019, 04:47

I am not quite a newbie to React after 6 months of coding, but I'm still learning. Is there a good working example of the Accordion component? The documentation and source for the Accordion don't show an example where the ActiveIndex is set to something other than the default. It is also not clear how to open and close a tab programmatically.

I have an accordion, set to multiple={true} and 4 accordion tabs. I need to have one or more tabs open depending on what happens above on the 'page.' If I set the default tab to anything other than zero, I get an error "activeIndexOf is not a function." How can I pass two indices to the Accordion, so two tabs are open?

lharley
Posts: 4
Joined: 16 Nov 2018, 01:43

04 Feb 2019, 18:31

I did some experiments and with the error messages I was able to determine that the activeIndex actually wants an array of index numbers. By using activeIndex=[0,3] I was able to set two of the AccordionTabs to open state.

I wish the documentation for Prime React Accordion was written better, so newbies like myself could learn React easier.

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests