For AI agents: the complete documentation index is available at https://rickyshin93.github.io/tao-ui/zh/llms.txt, the full documentation bundle is available at https://rickyshin93.github.io/tao-ui/zh/llms-full.txt, and this page is available as Markdown at https://rickyshin93.github.io/tao-ui/zh/components/alert.md.
v0.0.57
  • 简体中文
  • Alert

    反馈@rockshin/tao-ui

    用于展示带有明确语义状态的重要上下文反馈信息。

    何时使用

    页面需要持续展示某个状态、风险或操作结果时使用 Alert;短暂通知应使用 Sonner。

    推荐

    • 根据消息严重程度选择对应的语义类型。
    • 标题保持简短,将补充信息放入说明。
    • 需要快速扫读时开启状态图标。

    避免

    • 避免在同一视图堆叠大量 Alert。
    • 不要用 Alert 承载短暂反馈,改用 toast。

    代码演示

    基础用法

    Changes saved
    New version available
    Refresh when you are ready.
    Subscription expires soon
    Could not save changes
    TSX

    说明与图标

    Deployment complete
    Production is running version 0.0.25.
    Update available
    Refresh when you are ready.
    Quota almost reached
    Storage is 92% full.
    Build failed
    Fix the type errors and run again.
    TSX

    可关闭提示与操作

    Closable message
    Payment method expires soon
    Update it before the next billing date.
    Connection lost
    TSX

    标题与详细说明

    用 description 补充原因和恢复方式,让标题保持简短。

    Success
    Your changes have been saved successfully.
    Info
    A new version is available. Refresh to update.
    Warning
    Your subscription expires in 3 days.
    Error
    Something went wrong while processing your request.
    TSX

    状态图标

    showIcon 为成功、信息、警告和错误提供对应的语义图标。

    Success
    Info
    Warning
    Error
    Success
    Icons grow larger when a description is present.
    🔥
    Custom Icon
    TSX

    行内操作

    通过 action 放置与提示相关的操作,操作结果应在应用中明确反馈。

    New version available
    Request failed
    These actions update local example state.
    TSX

    API

    Alert

    属性说明类型默认值
    className节点类名string | undefined-
    style节点样式CSSProperties | undefined-