| 1 |
import { Popover, Button } from '@patternfly/react-core'; |
| 2 |
|
| 3 |
export const PopoverCustomFocus: React.FunctionComponent = () => ( |
| 4 |
<Popover |
| 5 |
elementToFocus="#popover-cancel-button" |
| 6 |
showClose={false} |
| 7 |
aria-label="Popover with custom focus" |
| 8 |
headerContent={<div>Popover header</div>} |
| 9 |
bodyContent={ |
| 10 |
<div> |
| 11 |
Lorem ipsum dolor sit amet, consectetur adipisicing elit.{' '} |
| 12 |
<Button |
| 13 |
// Preventing default click behavior for example purposes only |
| 14 |
onClick={(event: React.MouseEvent) => event.preventDefault()} |
| 15 |
component="a" |
| 16 |
isInline |
| 17 |
variant="link" |
| 18 |
href="#basic" |
| 19 |
> |
| 20 |
View the basic example |
| 21 |
</Button> |
| 22 |
</div> |
| 23 |
} |
| 24 |
footerContent={(hide) => ( |
| 25 |
<Button onClick={hide} variant="secondary" id="popover-cancel-button"> |
| 26 |
Cancel |
| 27 |
</Button> |
| 28 |
)} |
| 29 |
> |
| 30 |
<Button>Toggle popover with custom focus</Button> |
| 31 |
</Popover> |
| 32 |
); |