-
Notifications
You must be signed in to change notification settings - Fork 843
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow state to be controlled from outside
- Loading branch information
1 parent
9ccf699
commit 80b213d
Showing
3 changed files
with
65 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React, { useState } from 'react'; | ||
|
||
import { | ||
EuiAccordion, | ||
EuiText, | ||
EuiSwitch, | ||
EuiSpacer, | ||
} from '../../../../src/components'; | ||
|
||
export default () => { | ||
const [forceClose, setForceClose] = useState(true); | ||
const onChange = e => { | ||
setForceClose(e.target.checked); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<EuiSwitch label="forceClose" checked={forceClose} onChange={onChange} /> | ||
<EuiSpacer /> | ||
<EuiAccordion | ||
id="accordion1" | ||
forceClose={forceClose} | ||
buttonContent="Click me to toggle open / close"> | ||
<EuiText> | ||
<p> | ||
Any content inside of <strong>EuiAccordion</strong> will appear | ||
here. | ||
</p> | ||
</EuiText> | ||
</EuiAccordion> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters