---
title: "Timeline 组件 — zenit Zig UI"
description: "按时间或状态展示纵向事件。completed / current / pending、时间、标题与描述按统一轨道对齐。"
url: https://zenit.z.express/zh/components/timeline
language: zh-CN
alternate_en: https://zenit.z.express/components/timeline.md
alternate_es: https://zenit.z.express/es/components/timeline.md
alternate_ja: https://zenit.z.express/ja/components/timeline.md
alternate_ko: https://zenit.z.express/ko/components/timeline.md
alternate_fr: https://zenit.z.express/fr/components/timeline.md
alternate_de: https://zenit.z.express/de/components/timeline.md
project: zenit v0.1.0-alpha (Zig 0.15.2, macOS)
source: https://github.com/version-next/zenit
---

# Timeline

`ui.widgets.Timeline`

按时间或状态展示纵向事件。

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

**BEHAVIOR CONTRACT**

completed / current / pending、时间、标题与描述按统一轨道对齐。

**RECORDED INTERACTION**

录像展示订单生命周期。

`examples/storybook/stories.zig:681`

```zig
// ── Timeline ──
pub fn buildTimeline(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
    const items = [_]W.TimelineItem{
        .{ .title = "Created", .description = "Order placed", .time = "09:00", .status = .completed },
        .{ .title = "Shipped", .description = "In transit", .time = "12:30", .status = .active },
        .{ .title = "Delivered", .description = "Pending", .status = .pending },
    };
    return W.Timeline(.{ .items = &items }).mount(scope, cx);
}
```

[在 GitHub 查看源码examples/storybook/stories.zig:681](https://github.com/version-next/zenit/blob/HEAD/examples/storybook/stories.zig#L681)

这是 Storybook 中该 story 的原样代码（zenit 5f9add5+wip 2026-09-30）。其中 `W` 即 `ui.widgets`，`col` / `row` / `label` 是 Storybook 内的布局小工具。

### TimelineProps

`ui.widgets.Timeline`

[src/ui/components/timeline/mod.zig:52](https://github.com/version-next/zenit/blob/HEAD/src/ui/components/timeline/mod.zig#L52)

```zig
fn Timeline(props: TimelineProps) TimelineBuilder
```

| 字段 | 类型 | 默认值 | 说明 |
| --- | --- | --- | --- |
| `items` | `[]const TimelineItem` | `&.{}` | — |

### \*Node

`ui.widgets.Timeline`

mount 直接返回 `*Node`，把它 append 到父节点即可。
