Skip to content

Commit d5d8eab

Browse files
author
Hakan Orak
committed
docs(canopee): update Accordion README
1 parent a8d9556 commit d5d8eab

File tree

1 file changed

+91
-0
lines changed
  • packages/canopee-react/src/distributeur/Accordion

1 file changed

+91
-0
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# `Button - @axa-fr/canopee-react/distributeur`
2+
3+
1. [Installation](#installation)
4+
2. [Import](#import)
5+
3. [Accordion](#accordion)
6+
3. [Accordion Actions](#accordion-actions)
7+
3. [Light mode](#light-mode)
8+
9+
## Installation
10+
11+
```sh
12+
npm i @axa-fr/canopee-react
13+
```
14+
15+
### Import
16+
17+
```javascript
18+
import { Accordion, CollapseCard } from "@axa-fr/canopee-react/distributeur";
19+
```
20+
21+
## Accordion
22+
23+
Closed by default:
24+
25+
```javascript
26+
const AccordionComponent = () => (
27+
<Accordion>
28+
<CollapseCard id="1" title="My title">
29+
My collapse content
30+
</CollapseCard>
31+
</Accordion>
32+
)
33+
export default AccordionComponent;
34+
```
35+
36+
Forced open by default :
37+
38+
```javascript
39+
const AccordionsComponent = () => (
40+
<Accordion>
41+
<CollapseCard id="1" title="My title" open>
42+
My collapse content
43+
</CollapseCard>
44+
<CollapseCard id="2" title="My second title" open>
45+
My second collapse content
46+
</CollapseCard>
47+
</Accordion>
48+
);
49+
export default AccordionsComponent;
50+
```
51+
52+
## Accordion Actions
53+
54+
```javascript
55+
const actions = [
56+
{
57+
key: "action-1",
58+
label: "Action 1",
59+
leftIcon: edit, // import your edit icon
60+
onClick: action1, // set your action1 function
61+
},
62+
{
63+
key: "action-2",
64+
label: "Action 2",
65+
rightIcon: trash, // import your trash icon
66+
onClick: action2, // set your action2 function
67+
},
68+
] as const;
69+
70+
const AccordionComponent = () => (
71+
<Accordion>
72+
<CollapseCard id="1" title="My title" actions={actions}>
73+
My collapse content
74+
</CollapseCard>
75+
</Accordion>
76+
)
77+
export default AccordionComponent;
78+
```
79+
## Light mode
80+
81+
```javascript
82+
83+
const LightAccordion = () => (
84+
<Accordion variant="light">
85+
<CollapseCard id="1" title="My title">
86+
My collapse content
87+
</CollapseCard>
88+
</Accordion>
89+
)
90+
export default LightAccordion;
91+
```

0 commit comments

Comments
 (0)