---
title: "Divider コンポーネント — zenit Zig UI"
description: "水平、垂直、ラベル付きの区切り線。方向、ラベルの位置、色、間隔はテーマ token から取得します。"
url: https://zenit.z.express/ja/components/divider
language: ja
alternate_en: https://zenit.z.express/components/divider.md
alternate_zh: https://zenit.z.express/zh/components/divider.md
alternate_es: https://zenit.z.express/es/components/divider.md
alternate_ko: https://zenit.z.express/ko/components/divider.md
alternate_fr: https://zenit.z.express/fr/components/divider.md
alternate_de: https://zenit.z.express/de/components/divider.md
project: zenit v0.1.0-alpha (Zig 0.15.2, macOS)
source: https://github.com/version-next/zenit
---

# Divider

`ui.widgets.Divider`

水平、垂直、ラベル付きの区切り線。

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

**BEHAVIOR CONTRACT**

方向、ラベルの位置、色、間隔はテーマ token から取得します。

**RECORDED INTERACTION**

solid / dashed、OR ラベル、縦の区切り線を示します。

`examples/storybook/stories.zig:523`

```zig
// ── Divider ──
pub fn buildDivider(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
    const a = cx.allocator;
    const c = try col(cx, 16);

    // ── 样式：solid / dashed / dotted ──
    try c.appendChild(a, try label(cx, "Styles (solid / dashed / dotted)"));
    inline for (.{ W.divider.DividerVariant.solid, .dashed, .dotted }) |variant| {
        try c.appendChild(a, try W.Divider(.{ .orientation = .horizontal, .variant = variant }).mount(scope, cx));
    }

    // ── 带 label，三种位置 ──
    try c.appendChild(a, try label(cx, "Labeled (left / center / right)"));
    try c.appendChild(a, try W.Divider(.{ .label_text = "LEFT", .label_position = .left }).mount(scope, cx));
    try c.appendChild(a, try W.Divider(.{ .label_text = "OR", .label_position = .center }).mount(scope, cx));
    try c.appendChild(a, try W.Divider(.{ .label_text = "RIGHT", .label_position = .right }).mount(scope, cx));

    // ── 垂直方向 ──
    try c.appendChild(a, try label(cx, "Vertical"));
    const vrow = try ui.box(cx, .{ .direction = .row, .gap = 12, .align_items = .center, .height = .{ .px = 32 } }, .{});
    try vrow.appendChild(a, try ui.text(cx, "Left", .{ .font_size = 13, .color = light.color.fg_primary }));
    try vrow.appendChild(a, try W.Divider(.{ .orientation = .vertical }).mount(scope, cx));
    try vrow.appendChild(a, try ui.text(cx, "Middle", .{ .font_size = 13, .color = light.color.fg_primary }));
    try vrow.appendChild(a, try W.Divider(.{ .orientation = .vertical }).mount(scope, cx));
    try vrow.appendChild(a, try ui.text(cx, "Right", .{ .font_size = 13, .color = light.color.fg_primary }));
    try c.appendChild(a, vrow);
    return c;
}
```

[GitHub でソースを見るexamples/storybook/stories.zig:523](https://github.com/version-next/zenit/blob/HEAD/examples/storybook/stories.zig#L523)

Storybook にあるこの story のコードそのままです（zenit 5f9add5+wip 2026-09-30）。`W` は `ui.widgets` のことで、`col` / `row` / `label` は Storybook 内の小さなレイアウトヘルパーです。

### DividerProps

`ui.widgets.Divider`

[src/ui/components/divider/mod.zig:59](https://github.com/version-next/zenit/blob/HEAD/src/ui/components/divider/mod.zig#L59)

```zig
fn Divider(props: DividerProps) DividerBuilder
```

| フィールド | 型 | デフォルト値 | 説明 |
| --- | --- | --- | --- |
| `orientation` | `DividerOrientation` `.horizontal` `.vertical` | `.horizontal` | 方向 |
| `variant` | `DividerVariant` `.solid` `.dashed` `.dotted` | `.solid` | 样式变体 |
| `spacing` | `DividerSpacing` `.none` `.sm` `.md` `.lg` | `.md` | 间距 |
| `label_text` | `?[]const u8` | `null` | 标签文本 |
| `label_position` | `LabelPosition` `.left` `.center` `.right` | `.center` | 标签位置 |
| `color` | `?Color` | `null` | 颜色 |
| `thickness` | `f32` | `1` | 粗细 |
| `dash_length` | `f32` | `8` | dash 的实线段长度 |
| `dash_gap` | `f32` | `8` | dash 的间距 |

### \*Node

`ui.widgets.Divider`

mount は `*Node` を直接返します。親ノードに append してください。
