---
title: "DatePicker component | zenit Zig UI"
description: "Enter a single date or pick it from a calendar. Trigger, calendar overlay, month navigation, selection and dismissal ship together."
url: https://ui.surf/zenit/components/datepicker
language: en
alternate_zh: https://ui.surf/zenit/zh/components/datepicker.md
alternate_es: https://ui.surf/zenit/es/components/datepicker.md
alternate_ja: https://ui.surf/zenit/ja/components/datepicker.md
alternate_ko: https://ui.surf/zenit/ko/components/datepicker.md
alternate_fr: https://ui.surf/zenit/fr/components/datepicker.md
alternate_de: https://ui.surf/zenit/de/components/datepicker.md
project: zenit v0.1.0-alpha (Zig 0.15.2, macOS)
source: https://github.com/version-next/zenit
---

# DatePicker

`ui.widgets.DatePicker`

Enter a single date or pick it from a calendar.

[Video](https://ui.surf/zenit/media/stories/datepicker.mp4?v=401e05b131)

**BEHAVIOR CONTRACT**

Trigger, calendar overlay, month navigation, selection and dismissal ship together.

**RECORDED INTERACTION**

The harness clicks “Pick a date” and the calendar opens.

`examples/storybook/stories.zig:2463`

```zig
// ── DatePicker ──
pub fn buildDatePicker(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
    const dp = try W.DatePicker(.{ .placeholder = "Pick a date", .initial_year = 2026, .initial_month = 5 }).mount(scope, cx);
    return dp.wrapper;
}
```

[View source on GitHubexamples/storybook/stories.zig:2463](https://github.com/version-next/zenit/blob/HEAD/examples/storybook/stories.zig#L2463)

The story's verbatim source from the Storybook (zenit 4c50245 2026-10-01). `W` is `ui.widgets`; `col` / `row` / `label` are small Storybook layout helpers.

### DatePickerProps

`ui.widgets.DatePicker`

[src/ui/components/date\_picker/mod.zig:32](https://github.com/version-next/zenit/blob/HEAD/src/ui/components/date_picker/mod.zig#L32)

```zig
fn DatePicker(props: DatePickerProps) DatePickerBuilder
```

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `placeholder` | `[]const u8` | `"Select date..."` | — |
| `selected_date` | `?SimpleDate` | `null` | — |
| `initial_year` | `u16` | `2025` | — |
| `initial_month` | `u8` | `1` | — |
| `width` | `f32` | `220` | — |
| `size` | `theme.ControlSize` | `.md` | 控件尺寸（与 Button / Input / Select 同一 ControlSize，默认 md） |
| `disabled` | `bool` | `false` | — |
| `on_change` | `?core.HandlerRef` | `null` | — |
| `calendar_icon_asset` | `?svg_assets.Asset` | `null` | — |
| `prev_icon_asset` | `?svg_assets.Asset` | `null` | — |
| `next_icon_asset` | `?svg_assets.Asset` | `null` | — |
| `test_id` | `?[]const u8` | `null` | — |

### DatePickerResult

`ui.widgets.DatePicker`

[src/ui/components/date\_picker/mod.zig:85](https://github.com/version-next/zenit/blob/HEAD/src/ui/components/date_picker/mod.zig#L85)

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `wrapper` | `*Node` | — | — |
| `state` | `*DatePickerState` | — | — |
