Alert
重要なメッセージの確認を求めます。
使い方
確認には AlertDialog、インラインの状態には Alert を使用します。
アクセシビリティ
モーダルはフォーカスを保持し、確認後に戻します。インライン通知には role="alert" を使えます。
| プロパティ | 型 | 既定値 |
|---|---|---|
| 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>
</>
);
};