Accordion is a header that opens and closes the content under it. The content's height eases open and the icon turns. Closed content stays mounted, so it keeps its state. See the web Accordion for the same component in the browser.
The accordion keeps its own state. defaultOpen (or open without a handler) sets the first state.
Pass open with onOpenChange (or onToggle) when the screen owns the state. onOpenChange is called with the next state.
A ref gives toggle, open and close, so another control can open the accordion.
- Accordion also takes core 3.0's defaultOpen and onOpenChange.
- With open and no onToggle or onOpenChange, open only sets the first state, and later changes to it are followed.
- Flex props other than those listed go to the content area, as on the web.