DatePicker
Calendar in a popover
A date field: a button showing the chosen date, Calendar in a popover below it. The model is an ISO string, or [start, end] with range. locale only shapes the text shown (the model stays ISO), min / max pass through to the calendar. Picking a day closes the popover and returns focus to the field. Esc does the same without picking.
On touch devices (pointer: coarse), single mode renders the <input type="date"> of the platform instead. The OS picker is better on a phone than any popover. The component decides this after mount, so server and client agree. nativeOnTouch="false" forces the popover everywhere. Inside a BlessField, the label of the field names it. For a calendar that lives in the page rather than a field, use BlessCalendar directly.
Not inside <p>
The floating panel is a <div>. HTML closes a <p> at a <div>. For this reason, a trigger placed inside a paragraph renders differently on the server and the client. Wrap it in a <span> or <div> instead.
Usage
import { BlessDatePicker } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
id | string | — | |
range | boolean | — | |
min | string | — | |
max | string | — | |
placeholder | string | "Select date" | |
locale | string | "ja-JP" | |
disabled | boolean | — | |
invalid | boolean | — | |
nativeOnTouch | boolean | true | prefer native <input type=date> on coarse pointers (touch) |
size | "md" | "sm" | "lg" | "md" | |
labels | Partial<{ clear: string; }> | — | |
modelValue | string | [string, string] | — |
Events
| Name | Payload | Description |
|---|---|---|
update:modelValue | [value: string | [string, string] | undefined] |