/
AccordionFlush.js
45 lines (42 loc) · 1.92 KB
/
AccordionFlush.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import React, { useState } from 'react';
import { Accordion, AccordionBody, AccordionHeader, AccordionItem } from 'reactstrap';
const Example = (props) => {
const [open, setOpen] = useState();
const toggle = (id) => {
open === id ? setOpen() : setOpen(id);
};
return (
<div>
<Accordion flush open={open} toggle={toggle}>
<AccordionItem>
<AccordionHeader targetId="1">
Accordion Item 1
</AccordionHeader>
<AccordionBody accordionId="1">
<strong>This is the first item's accordion body.</strong>
You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
</AccordionBody>
</AccordionItem>
<AccordionItem>
<AccordionHeader targetId="2">
Accordion Item 2
</AccordionHeader>
<AccordionBody accordionId="2">
<strong>This is the second item's accordion body.</strong>
You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
</AccordionBody>
</AccordionItem>
<AccordionItem>
<AccordionHeader targetId="3">
Accordion Item 3
</AccordionHeader>
<AccordionBody accordionId="3">
<strong>This is the third item's accordion body.</strong>
You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
</AccordionBody>
</AccordionItem>
</Accordion>
</div>
);
};
export default Example;