Skip to content
fandhe-frontend
GitHub

Toast

一時的な通知の queue 表示です。fandhe-frontend-headless-uitoast mod は group(live region)/ root(通知 1 件)/ title / description / action-trigger / close-trigger の 6 anatomy パーツと、複数通知を有界な キューとして管理する状態機械 Toaster を提供します。aria-liveToastStatus から決定的に導出され(Error のみ assertive、他は polite)、group は role="region" + 必須の aria-label を固定付与 します。タイマーによる自動 dismiss の実配線は本部品のスコープ外です。

スタイル済みの表示例は Toast を参照してください。

関連 API: fandhe-frontend-headless-ui API

Demo

枠線・余白は docs サイト側のデモ枠であり、fandhe-frontend-headless-ui 自体はスタイルを持ちません。

Saved
Your changes have been saved.

Features

  • group(live region)/ root(通知 1 件)/ title/description/action-trigger/close-trigger の 6 anatomy パーツと、複数通知を有界なキューとして管理する状態機械 Toaster を提供する(dispatch: dismiss/clear)。
  • aria-live は ToastStatus から決定的に導出する(呼び出し側文字列を直接流し込まない)。Error のみ "assertive"、他は "polite"。aria-atomic="true" を併用し、通知全体を単位として読み上げさせる。
  • group は role="region" + aria-label(label は必須引数)を固定付与する。
  • タイマーによる自動 dismiss の実配線は fandhe-frontend-wasm-full 側の後続イシューのスコープ。

Anatomy

group
  root
    title
    description
    action-trigger
    close-trigger

API Reference

Arguments

NameTypeDefaultDescription
group: placementToastPlacementBottomEnddata-placement へ反映するビューポート角配置(6 語彙)。
group: label&strrole="region" とセットの aria-label(呼び出し側が必ず指定する)。
root: statusToastStatusInfodata-type と aria-live の緊急度(Error のみ assertive、他は polite)を導出する状態。

Data Attributes

PartAttributeObserved Values
groupdata-placementbottom-end
rootdata-typesuccess

Examples

Error status

ToastStatus::Error の Toast は aria-live="assertive" になり、他の状態より即座に割り込んで読み上げられます。

Upload failed
Network connection was lost.

Accessibility

WAI-ARIA

AttributeDescription
role="region" / aria-labelgroup に固定付与。
role="status"root に固定付与。
aria-atomic="true"root に固定付与。通知全体を単位として読み上げさせる。
aria-liveroot に付与。status から決定的に導出される(Error のみ assertive、他は polite)。