Demos
Single Accordion
Code Editor
<Accordion expanded remember_state id="single-accordion" title="Accordion title" > <P>Accordion content</P> </Accordion> <Accordion.Provider top remember_state icon="chevron_down" icon_position="right" > <Accordion id="single-provider-accordion" title="Accordion title"> <P>Accordion content</P> </Accordion> </Accordion.Provider>
Accordion with large title and content
Grouped Accordion
NB: Please have a read on the unexpected behavior thoughts.
Accordion title
Code Editor
<Accordion.Group expanded allow_close_all> <Accordion expanded={false}> <Accordion.Header>Accordion title</Accordion.Header> <Accordion.Content top> <P> Sociis sapien sociosqu vel sollicitudin accumsan laoreet gravida himenaeos nostra mollis volutpat bibendum convallis cum condimentum dictumst blandit rutrum vehicula </P> </Accordion.Content> </Accordion> <Accordion top> <Accordion.Header>Accordion title</Accordion.Header> <Accordion.Content> <P> Nec sit mattis natoque interdum sagittis cubilia nibh nullam etiam </P> </Accordion.Content> </Accordion> </Accordion.Group>
Customized Accordion
Code Editor
<Accordion group="unique-id" left_component={<Icon icon={bell} />}> <Accordion.Header>Accordion title</Accordion.Header> <Accordion.Content> <P> Sociis sapien sociosqu vel sollicitudin accumsan laoreet gravida himenaeos nostra mollis volutpat bibendum convallis cum condimentum dictumst blandit rutrum vehicula </P> </Accordion.Content> </Accordion> <Accordion top expanded={true} group="unique-id"> <Accordion.Header>Accordion title</Accordion.Header> <Accordion.Content> <P> Nec sit mattis natoque interdum sagittis cubilia nibh nullam etiam </P> </Accordion.Content> </Accordion>
Nested Accordions
Code Editor
<Accordion id="nested-accordion" title="Accordion" expanded space> <P space={0}>Content A</P> <Accordion id="nested-accordion-1" title="Accordion nested 1" space> <P space={0}>I'm nested 1</P> </Accordion> <P space={0}>Content B</P> <Accordion id="nested-accordion-2" title="Accordion nested 2" space> <P space={0}>I'm nested 2</P> </Accordion> </Accordion>
Disabled
Accordion can be disabled, though is not exactly defined what the use case is.
Code Editor
<Accordion expanded disabled remember_state title="Disabled (expanded)"> <P>I am expanded, but disabled, so I can't be closed</P> </Accordion> <Accordion.Provider top disabled remember_state icon="chevron_down" icon_position="right" > <Accordion title="Disabled (closed)"> <P>You can't see this text because I am disabled and closed.</P> </Accordion> </Accordion.Provider>
filled
Variant Accordion title
Code Editor
<Accordion expanded title="Accordion title" variant="filled"> <P>Accordion content</P> </Accordion> <Accordion top title="Accordion title" variant="filled"> <P>Accordion content</P> </Accordion>