Reference

DatePicker

A date field: the reader picks a day, and the bound state holds a Date.

DatePicker(bind: State, label: String, min: String, …)

Before 5.0

label

min

max

disabled

Starts November 17, 2026

Example

wf

state start: Date? = @2026-11-17 DatePicker(bind: start, label: "Start date", min: "2026-01-01", max: "2026-12-31") if let d = start { Text("Starts {d:.date(long)}").muted } else { Text("No date chosen").muted }

Empty until chosen

wf

state due: Date? = null DatePicker(bind: due, label: "Due date")

Disabled

wf

state renewal: Date? = @2027-01-01 DatePicker(bind: renewal, label: "Renews on").disabled

Props

Props of DatePicker
PropTypeUnsetMeaning

bind:

State

The Date? state it reads and writes: the day chosen, null when the field is emptied

label:

String

none

The label drawn above the field; also its accessible name

min:

String

none

The earliest day the picker offers, YYYY-MM-DD

max:

String

none

The latest day the picker offers, YYYY-MM-DD

disabled:

Bool

false

Whether the control is inert: it cannot be focused or changed, and a form does not send it. Written as a flag, .disabled, or disabled: true.

Attribute families: global, aria, data, input. Plus the 22 universal props every element takes: animate:, exit:, speed:, duration:, delay:, easing:, stagger:, on:, count:, shared:, class:, ref:, drag:, dragGroup:, dropValue:, dropAxis:, dropInside:, roving:, trapFocus:, mount:, update:, cleanup:.

Flags and cases

A flag is written after the parentheses with a dot: a Bool prop, or a case of one of the element's enum props. A case the enum lacks is an error with a hint.

.disabled

Events

The DOM events it is drawn to answer. Any other DOM event works too, in an on … { } handler.

DOM events DatePicker answers
EventSendsMeaning
on changeDOMThe value was committed

Every element also takes the props, the events and the attribute families listed on every element.

Slots

It takes no slots.

Renders with the class wf-datepicker, stable across releases, so a stylesheet may target it.