---
title: "Badge 컴포넌트 — zenit Zig UI"
description: "낮은 강조의 상태, 개수, 시맨틱 색상 라벨.info / success / warning / error, 크기, dot, 아이콘 변형이 테마 token을 따…"
url: https://zenit.z.express/ko/components/badge
language: ko
alternate_en: https://zenit.z.express/components/badge.md
alternate_zh: https://zenit.z.express/zh/components/badge.md
alternate_es: https://zenit.z.express/es/components/badge.md
alternate_ja: https://zenit.z.express/ja/components/badge.md
alternate_fr: https://zenit.z.express/fr/components/badge.md
alternate_de: https://zenit.z.express/de/components/badge.md
project: zenit v0.1.0-alpha (Zig 0.15.2, macOS)
source: https://github.com/version-next/zenit
---

# Badge

`ui.widgets.Badge`

낮은 강조의 상태, 개수, 시맨틱 색상 라벨.

[Video](https://zenit.z.express/media/stories/badge.mp4?v=7f94d928b3)

**BEHAVIOR CONTRACT**

info / success / warning / error, 크기, dot, 아이콘 변형이 테마 token을 따릅니다.

**RECORDED INTERACTION**

모든 시맨틱 색상과 크기를 훑습니다.

`examples/storybook/stories.zig:463`

```zig
// ── Badge / StatusBadge ──
pub fn buildBadge(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
    const a = cx.allocator;
    const c = try col(cx, 12);
    const r1 = try row(cx, 12);
    inline for (.{ "info", "success", "warning", "error" }, .{ W.badge.BadgeStatus.info, .success, .warning, .@"error" }) |t, st| {
        try r1.appendChild(a, try W.Badge(.{ .text = t, .status = st }).mount(scope, cx));
    }
    try c.appendChild(a, try label(cx, "Badge status"));
    try c.appendChild(a, r1);

    const r2 = try row(cx, 12);
    try r2.appendChild(a, try W.Badge(.{ .count = 5 }).mount(scope, cx));
    try r2.appendChild(a, try W.Badge(.{ .count = 120, .max_count = 99 }).mount(scope, cx));
    try r2.appendChild(a, try W.Badge(.{ .dot = true }).mount(scope, cx));
    try c.appendChild(a, try label(cx, "Count / dot"));
    try c.appendChild(a, r2);

    // ── 尺寸 ──
    try c.appendChild(a, try label(cx, "Sizes (sm / md)"));
    const r_sz = try row(cx, 12);
    inline for (.{ W.badge.BadgeSize.sm, .md }) |sz| {
        try r_sz.appendChild(a, try W.Badge(.{ .count = 8, .size = sz }).mount(scope, cx));
    }
    try c.appendChild(a, r_sz);

    const r3 = try row(cx, 12);
    try r3.appendChild(a, try W.StatusBadge(.{ .label_text = "Online", .status = .success }).mount(scope, cx));
    try r3.appendChild(a, try W.StatusBadge(.{ .label_text = "Error", .status = .@"error" }).mount(scope, cx));
    try c.appendChild(a, try label(cx, "StatusBadge"));
    try c.appendChild(a, r3);
    return c;
}
```

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

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

### BadgeProps

`ui.widgets.Badge`

[src/ui/components/badge/mod.zig:64](https://github.com/version-next/zenit/blob/HEAD/src/ui/components/badge/mod.zig#L64)

```zig
fn Badge(props: BadgeProps) BadgeBuilder
```

| 필드 | 타입 | 기본값 | 설명 |
| --- | --- | --- | --- |
| `text` | `?[]const u8` | `null` | 显示文本 |
| `count` | `?u32` | `null` | 数字计数 |
| `max_count` | `u32` | `99` | 最大显示数 |
| `status` | `BadgeStatus` `.info` `.success` `.warning` `.@"error"` | `.info` | 状态 |
| `size` | `BadgeSize` `.sm` `.md` | `.md` | 尺寸 |
| `dot` | `bool` | `false` | 点状模式（只显示点，不显示内容） |

### StatusBadgeProps

`ui.widgets.StatusBadge`

[src/ui/components/badge/mod.zig:190](https://github.com/version-next/zenit/blob/HEAD/src/ui/components/badge/mod.zig#L190)

```zig
fn StatusBadge(props: StatusBadgeProps) StatusBadgeBuilder
```

| 필드 | 타입 | 기본값 | 설명 |
| --- | --- | --- | --- |
| `status` | `BadgeStatus` `.info` `.success` `.warning` `.@"error"` | `.info` | — |
| `label_text` | `?[]const u8` | `null` | — |

### \*Node

`ui.widgets.Badge`

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

### \*Node

`ui.widgets.StatusBadge`

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