Skip to content

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 platform's <input type="date"> instead — the OS picker is better on a phone than any popover — decided after mount so server and client agree; nativeOnTouch="false" forces the popover everywhere. Inside a BlessField the field's label names it. For a calendar that lives in the page rather than a field, use BlessCalendar directly.

Basic

Not inside <p>

The floating panel is a <div>. HTML closes a <p> when it meets a <div>, so a trigger placed inside a paragraph renders differently on the server and the client. Wrap with <span>/<div> instead.

Usage ​

ts
import { BlessDatePicker } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
idstring—
rangeboolean—
minstring—
maxstring—
placeholderstring"Select date"
localestring"ja-JP"
disabledboolean—
invalidboolean—
nativeOnTouchbooleantrueprefer native <input type=date> on coarse pointers (touch)
size"md" | "sm" | "lg""md"
modelValuestring | [string, string]—

Events

NamePayloadDescription
update:modelValue[value: string | [string, string] | undefined]

Released under the MIT License. Character names and artwork belong to their owners.