| 1 |
import { Popover, Button } from '@patternfly/react-core'; |
| 2 |
|
| 3 |
export const PopoverCloseUncontrolled: React.FunctionComponent = () => ( |
| 4 |
<div style={{ margin: '50px' }}> |
| 5 |
<Popover |
| 6 |
aria-label="Uncontrolled popover with button in the body that can close it" |
| 7 |
headerContent={<div>Popover header</div>} |
| 8 |
bodyContent={(hide) => ( |
| 9 |
<div> |
| 10 |
<div> |
| 11 |
All the content props (headerContent, bodyContent, footerContent) can take a function which the popover |
| 12 |
component passes the hide function to which can be used to close the popover after some user interaction. |
| 13 |
</div> |
| 14 |
<div> |
| 15 |
<button onClick={hide}>Close popover</button> |
| 16 |
</div> |
| 17 |
</div> |
| 18 |
)} |
| 19 |
footerContent="Popover footer" |
| 20 |
> |
| 21 |
<Button>Toggle popover</Button> |
| 22 |
</Popover> |
| 23 |
</div> |
| 24 |
); |