Skip to content

Date Input

@astryxdesign/core v0.7.1 · DateInput

DateInput Props ​

NameTypeDefaultDescription
modelValueDate | nullnullThe selected date.
placeholderstringSelect a date / 选择日期Placeholder text. English by default; Chinese when zh-CN is provided.
minDate—Earliest selectable date.
maxDate—Latest selectable date.
isDateDisabled(date: Date) => boolean—Return true to disable a date.
dateConstraintsArray<(date: Date) => boolean>—A day is disabled when any function returns false.
namestring—Form field name.
labelstring—Field label.
descriptionstring—Helper text under the label.
isLabelHiddenbooleanfalseKeeps the label for screen readers and hides it visually. labelHidden is the older name; either one hides it.
isOptionalboolean—Marks the label as optional.
isRequiredboolean—Marks the field required and sets aria-required on the input.
labelTooltipstring—Hint shown from the info icon at the end of the label.
format'date' | 'date_long' | 'date_weekday' | 'system_date' | ((iso: string) => string)'date_long'How a committed date is displayed. A function receives YYYY-MM-DD.
presentation'popover' | 'bottom-sheet' | 'native' | 'adaptive-bottom-sheet' | 'adaptive-native'adaptive-native when omittedPopover, bottom sheet, system date control, or a switch between them based on the pointer. presentation wins when nativePicker is also set.
nativePicker'touch' | 'always' | 'never'—Older surface name. touch follows the pointer, always uses the system control, and never switches between the popover and the bottom sheet by pointer. presentation wins when both are set.
numberOfMonths1 | 21Months shown side by side in the calendar. The system date control cannot express this.
weekStartsOn0-6 | 'sun' | 'mon' | ...—First day of the week in the calendar. The system date control cannot express this.
disabledbooleanfalseDisables the field.
isLoadingbooleanfalseThe field cannot be edited and shows a loading indicator.
changeAction(value: Date | null) => void | Promise<void>—Runs after the value is committed. A promise keeps the field busy until it settles.
widthnumber | string—Width of the whole field. A number is pixels.
disabledMessagestring—Explains why the field is disabled. With disabled, the message shows in a tooltip on hover or keyboard focus and the input stays focusable with aria-disabled; the value still cannot change. The older disabledReason name works too.
hasClearbooleanfalseShows a clear button when a date is set. Clearing also returns focus to the input. The older clearable name works too.
clearLabelstringClear / 清除Accessible name for the clear button. Includes label when one is set. English by default; Chinese when zh-CN is provided.
size'sm' | 'md' | 'lg''md'Field size.
status'default' | 'error' | 'warning' | 'success' | { type, message? }—Validation status. An object with message shows that text under the field.
statusVariant'attached' | 'detached' | 'tooltip''attached'Where the status message sits.
containerClassstring | object | array—Class for the field container. Has no effect, and warns in development, inside InputGroup and in a horizontal-labels FormLayout.
containerStyleStyleValue—Inline style for the field container. Same targeting as containerClass.
controlClassstring | object | array—Class for the bordered control box. A class written on the component lands here too, not on the inner input.
controlStyleStyleValue—Inline style for the bordered control box.

DateInput events ​

NamePayloadDescription
update:modelValuevalue: Date | nullEmitted when the date changes.
changevalue: Date | nullEmitted when the date changes.

DateInput slots ​

NameDescription
prefixIcon shown before the input.
suffixContent shown after the input.