Calendar
ui.widgets.Calendar月视图日期浏览与选择。
BEHAVIOR CONTRACT
月份计算、首周偏移、选中日和导航按钮共享 SimpleDate 模型。
RECORDED INTERACTION
Harness 点击 18 日,选中态随之移动。
// ── Calendar ──
pub fn buildCalendar(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
const cal = try W.Calendar(.{ .initial_year = 2026, .initial_month = 5 }).mount(scope, cx);
return cal.wrapper;
}这是 Storybook 中该 story 的原样代码(zenit 5f9add5+wip 2026-09-30)。其中 W 即 ui.widgets,col / row / label 是 Storybook 内的布局小工具。
CalendarProps
ui.widgets.Calendarfn Calendar(props: CalendarProps) CalendarBuilder字段
类型
默认值
说明
initial_yearu162025—
initial_monthu81—
selected_date?SimpleDatenull—
on_select?core.HandlerRefnull—
cell_sizef3236—
prev_icon_asset?svg_assets.Assetnull—
next_icon_asset?svg_assets.Assetnull—
CalendarResult
ui.widgets.Calendar字段
类型
默认值
说明
wrapper*Node—
—
state*CalendarState—
—