DatePicker
ui.widgets.DatePicker日付を入力するか、カレンダーから選びます。
BEHAVIOR CONTRACT
トリガー、calendar overlay、月の移動、選択値、dismiss の挙動を一式で提供します。
RECORDED INTERACTION
harness が「Pick a date」をクリックし、カレンダーが開きます。
// ── 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;
}Storybook にあるこの story のコードそのままです(zenit 5f9add5+wip 2026-09-30)。W は ui.widgets のことで、col / row / label は Storybook 内の小さなレイアウトヘルパーです。
DatePickerProps
ui.widgets.DatePickerfn DatePicker(props: DatePickerProps) DatePickerBuilderフィールド
型
デフォルト値
説明
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.DatePickerフィールド
型
デフォルト値
説明
wrapper*Node—
—
state*DatePickerState—
—