Alert
fandhe-frontend-pre-styled-ui の alert mod が提供するスタイル済み Alert 部品です。
ユーザーへ注意喚起・状態変化を伝える部品です。role="alert" を状態に関わらず固定で付与するため、四つの状態(Info/Success/Warning/Error)いずれでもスクリーンリーダーへ通知が届きます。値の変化を伴わない静的な警告表示には Status を、一時的な進捗通知には Progress を検討してください。
Demo
status(info / success / warning / error)で色が切り替わる通知領域。root / indicator / content / title / description の slot 構成です。
!
Info
新しいバージョンが利用可能です。
!
Success
ビルドが完了しました。
!
Warning
依存クレート数が上限に近づいています。
!
Error
リンク切れを検出したため書き出しを中止しました。
Features
- AlertStatus(Info/Success/Warning/Error、crates/pre-styled-ui/src/alert.rs:24-33)で 4 種の状態色を切り替える
- root に WAI-ARIA live region の role="alert" を状態に関わらず固定付与する(alert.rs:153, 4)
- indicator/content/title/description の 4 パーツで見出し・本文を構造化できる(alert.rs:163-181)
Anatomy
root
indicator
content
title
descriptionAPI Reference
Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| status | AlertStatus | Info | 見た目の状態色(alert.rs:24-33、#[default] は Info)。 |
Examples
Warning
Warning 状態の Alert を indicator + title/description で組み立てた例です。
Heads up
Something needs attention
Accessibility
WAI-ARIA
| Attribute | Description |
|---|---|
| role="alert" | WAI-ARIA live region。status の値に関わらず固定で付与される(alert.rs:4, 153)。 |