メインコンテンツへスキップ

Notification 通知

Message より重いフィードバック:タイトル / 本文 / タイプアイコンを備え、四隅からポップアップします。内容が比較的長いシステム通知に適しています。

基本的な使い方​

基本的な使い方
import { notification } from '@lh-ui/react'
import '@lh-ui/react/style/notification'

notification.success({ title: '保存成功', content: '作品がギャラリーに公開されました。' })

// 文字列の省略記法:タイトル行のみ描画
notification.info('システム通知')

notification メソッド​

メソッド説明戻り値
info / success / warning / error / danger通知を表示{ close }
close指定した通知を閉じる(先に退場アニメーションを再生)void
closeAll全通知を閉じてコンテナをアンマウントvoid
const handle = notification.warning({ title: 'ストレージ容量不足' })
handle.close()

LhNotificationOptions​

プロパティ説明型デフォルト値
titleタイトル(未指定時は content を使用)string—
content本文(title と同値の時はタイトル行のみ描画)string—
duration自動的に閉じるまでのミリ秒数。0 で自動閉じしないnumber4500
positionポップアップ位置'top-right' | 'top-left' | 'bottom-right' | 'bottom-left''top-right'
showClose閉じるボタンを表示するかどうかbooleantrue
closeLabel閉じるボタンの aria-labelstring言語パック(zh-CN:关闭通知)
onClickクリックコールバック(渡すとカードがクリック可能になる)() => void—
onClose閉じた時のコールバック() => void—
sxクイックレイアウトプロパティSxProps—
退場アニメーション

React には transition-group がなく、項目自身が退場を管理します:閉じる時にまず lh-notification-slide-leave-* (280ms)を再生してからレコードを削除します。FLIP の譲りアニメーションは未実装:キューの増減時に兄弟カードが一瞬で移動し、 積み重ねの間隔はコンテナの flex gap が担います。

アクセシビリティ

warning / danger は role="alert"(即時読み上げ)、info / success は role="status"(順番待ち読み上げ)です。コンテナは role="region" + aria-live="polite" です。

スタイル​

import '@lh-ui/react/style/notification'