DatePicker
ui.widgets.DatePickerEnter a single date or pick it from a calendar.
BEHAVIOR CONTRACT
Trigger, calendar overlay, month navigation, selection and dismissal ship together.
RECORDED INTERACTION
The harness clicks “Pick a date” and the calendar opens.
// ── 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;
}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.DatePickerfn DatePicker(props: DatePickerProps) DatePickerBuilderField
Type
Default
Description
placeholder[]const u8"Select date..."—
selected_date?SimpleDatenull—
initial_yearu162025—
initial_monthu81—
widthf32220—
sizetheme.ControlSize.md控件尺寸(与 Button / Input / Select 同一 ControlSize,默认 md)
disabledboolfalse—
on_change?core.HandlerRefnull—
calendar_icon_asset?svg_assets.Assetnull—
prev_icon_asset?svg_assets.Assetnull—
next_icon_asset?svg_assets.Assetnull—
test_id?[]const u8null—
DatePickerResult
ui.widgets.DatePickerField
Type
Default
Description
wrapper*Node—
—
state*DatePickerState—
—