---
title: "Alert 컴포넌트 — zenit Zig UI"
description: "페이지 안에 유지되는 피드백.info / success / warning / error는 제목 유무와 관계없이 하나의 레이아웃을 유지합니다."
url: https://zenit.z.express/ko/components/alert
language: ko
alternate_en: https://zenit.z.express/components/alert.md
alternate_zh: https://zenit.z.express/zh/components/alert.md
alternate_es: https://zenit.z.express/es/components/alert.md
alternate_ja: https://zenit.z.express/ja/components/alert.md
alternate_fr: https://zenit.z.express/fr/components/alert.md
alternate_de: https://zenit.z.express/de/components/alert.md
project: zenit v0.1.0-alpha (Zig 0.15.2, macOS)
source: https://github.com/version-next/zenit
---

# Alert

`ui.widgets.Alert`

페이지 안에 유지되는 피드백.

[Video](https://zenit.z.express/media/stories/alert.mp4?v=b7df1ff242)

**BEHAVIOR CONTRACT**

info / success / warning / error는 제목 유무와 관계없이 하나의 레이아웃을 유지합니다.

**RECORDED INTERACTION**

네 가지 심각도 수준을 보여 줍니다.

`examples/storybook/stories.zig:664`

```zig
// ── Alert ──
pub fn buildAlert(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
    const a = cx.allocator;
    const c = try col(cx, 12);
    // 全 4 变体，且都带 closable（× 关闭按钮）
    try c.appendChild(a, try W.Alert(.{ .variant = .info, .title = "Info", .message = "Informational message.", .closable = true }).mount(scope, cx));
    try c.appendChild(a, try W.Alert(.{ .variant = .success, .title = "Success", .message = "It worked.", .closable = true }).mount(scope, cx));
    try c.appendChild(a, try W.Alert(.{ .variant = .warning, .title = "Warning", .message = "Be careful.", .closable = true }).mount(scope, cx));
    try c.appendChild(a, try W.Alert(.{ .variant = .@"error", .title = "Error", .message = "Something broke.", .closable = true }).mount(scope, cx));
    // 无标题（仅 message）
    try c.appendChild(a, try W.Alert(.{ .variant = .info, .message = "Title-less alert with just a message." }).mount(scope, cx));
    return c;
}
```

[GitHub에서 소스 보기examples/storybook/stories.zig:664](https://github.com/version-next/zenit/blob/HEAD/examples/storybook/stories.zig#L664)

Storybook에 있는 이 story의 원본 코드입니다(zenit 5f9add5+wip 2026-09-30). `W`는 `ui.widgets`이며, `col` / `row` / `label`은 Storybook 내부의 작은 레이아웃 헬퍼입니다.

### AlertProps

`ui.widgets.Alert`

[src/ui/components/alert/mod.zig:40](https://github.com/version-next/zenit/blob/HEAD/src/ui/components/alert/mod.zig#L40)

```zig
fn Alert(props: AlertProps) AlertBuilder
```

| 필드 | 타입 | 기본값 | 설명 |
| --- | --- | --- | --- |
| `variant` | `AlertVariant` `.info` `.success` `.warning` `.@"error"` | `.info` | — |
| `title` | `?[]const u8` | `null` | — |
| `message` | `[]const u8` | `""` | — |
| `closable` | `bool` | `false` | — |
| `on_close` | `?core.HandlerRef` | `null` | — |
| `close_icon_asset` | `?svg_assets.Asset` | `null` | — |

### \*Node

`ui.widgets.Alert`

mount는 `*Node`을(를) 직접 반환합니다. 부모 노드에 append하면 됩니다.
