| 1 |
import { Fragment } from 'react'; |
| 2 |
import { Alert, AlertActionCloseButton } from '@patternfly/react-core'; |
| 3 |
|
| 4 |
export const AlertStaticLiveRegion: React.FunctionComponent = () => ( |
| 5 |
<Fragment> |
| 6 |
<Alert |
| 7 |
isLiveRegion |
| 8 |
variant="info" |
| 9 |
title="Default live region configuration" |
| 10 |
// eslint-disable-next-line no-console |
| 11 |
actionClose={<AlertActionCloseButton onClose={() => console.log('Clicked the close button')} />} |
| 12 |
> |
| 13 |
This alert uses the recommended <code>isLiveRegion</code> prop to automatically set ARIA attributes and CSS |
| 14 |
classes. |
| 15 |
</Alert> |
| 16 |
<Alert |
| 17 |
aria-live="assertive" |
| 18 |
aria-relevant="additions text" |
| 19 |
aria-atomic="true" |
| 20 |
variant="info" |
| 21 |
title="Customized live region" |
| 22 |
// eslint-disable-next-line no-console |
| 23 |
actionClose={<AlertActionCloseButton onClose={() => console.log('Clicked the close button')} />} |
| 24 |
> |
| 25 |
You can alternatively omit the <code>isLiveRegion</code> prop to specify ARIA attributes and CSS manually on the |
| 26 |
containing element. |
| 27 |
</Alert> |
| 28 |
</Fragment> |
| 29 |
); |