<Accordion />
s are good for toggling contents on the web. <Accordion />
is a stateless wrapper for <AccordionItem />
s.
Prop | Type | Description |
---|---|---|
children | node | Accordion is the wrapper of <AccordionItem /> s. |
Here is how to use the stateless <Accordion />
wrapper.
<Accordion>
<AccordionItem
title="Basic information"
isOpen={ this.state.accordion.basic }
onClick={ () => this.toggle('basic') }
>
Not much.
</AccordionItem>
<AccordionItem
title="Not basic information"
isOpen={ this.state.accordion.notBasic }
onClick={ () => this.toggle('notBasic') }
>
Much.
</AccordionItem>
</Accordion>
Stateful component. It lets any number of <AccordionItem />
s to be open at the same time.
Prop | Type | Description |
---|---|---|
children | node | Just like at <Accordion /> , children should contain all the <AccordionItem /> s. |
Here is how to use MultiAccordion:
import { MultiAccordion } from '@pi/intellyo-components';
...
<MultiAccordion>
<AccordionItem
title="Basic information"
isOpen={ this.state.accordion.basic }
>
Not much.
</AccordionItem>
<AccordionItem
title="Not basic information"
isOpen={ this.state.accordion.notBasic }
>
Much.
</AccordionItem>
</MultiAccordion>
<SingleAccordion />
is an extension of <MultiAccordion />
. The difference between them, as their name suggest, that <SingleAccordion />
lets only one <AccordionItem />
to be open at the same time.
Same as <MultiAccordion />
's.
import { SingleAccordion } from '@pi/intellyo-components';
...
<SingleAccordion>
<AccordionItem
title="Basic information"
isOpen={ this.state.accordion.basic }
>
Not much.
</AccordionItem>
<AccordionItem
title="Not basic information"
isOpen={ this.state.accordion.notBasic }
>
Much.
</AccordionItem>
</SingleAccordion>
<AccordionItem />
does the heavy-lifting.
Prop | Type | Description |
---|---|---|
children | node | You can put any element. |
title | node | You can define the title of the AccordionItem. |
icon | element | You can define the which <Icon /> should get rendered. |
isOpen | boolean | isOpen is responsible whether the item should be open or not. |
<AccordionItem
title="Basic information"
icon={ (<Icon icon="ion-information-circled" />) }
isOpen={ this.state.accordion.basic }
onClick={ () => this.toggle('basic') }
>
Not much.
</AccordionItem>