| 1 |
import { useRef } from 'react'; |
| 2 |
import { Popover } from '@patternfly/react-core'; |
| 3 |
|
| 4 |
export const PopoverReactRef: React.FunctionComponent = () => { |
| 5 |
const popoverRef = useRef<HTMLButtonElement>(null); |
| 6 |
|
| 7 |
return ( |
| 8 |
<div style={{ margin: '50px' }}> |
| 9 |
<button ref={popoverRef}>Popover attached via react ref</button> |
| 10 |
<Popover |
| 11 |
aria-label="Popover with react reference example" |
| 12 |
headerContent={<div>Popover header</div>} |
| 13 |
bodyContent={ |
| 14 |
<div> |
| 15 |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis. |
| 16 |
</div> |
| 17 |
} |
| 18 |
footerContent="Popover footer" |
| 19 |
triggerRef={popoverRef} |
| 20 |
/> |
| 21 |
</div> |
| 22 |
); |
| 23 |
}; |