Alert
Require acknowledgment of an important message.
Usage
Use AlertDialog for acknowledgment and Alert for inline status.
Accessibility
The modal traps focus and restores it on confirmation. Inline alerts can use role="alert".
| Property | Type | Default |
|---|---|---|
| open | boolean | Required |
| title | string | Required |
| onConfirm | () => void | Required |
| confirmLabel | string | OK |
import { useState } from 'react';
export const RecordingNotice = () => {
const [visible, setVisible] = useState(false);
return (
<>
<Button onClick={() => setVisible(true)}>Show alert</Button>
<AlertDialog open={visible} title="Recording stopped" onConfirm={() => setVisible(false)}>
Reconnect the inspector to continue capturing events.
</AlertDialog>
</>
);
};