DateInput
A button-style input that opens a calendar popup on click. The selected date is displayed in a human-readable format (July 4, 2026) and stored internally as YYYY-MM-DD. Supports the same label / description / error structure as all other form inputs.
Default
June 2026
Su
Mo
Tu
We
Th
Fr
Sa
<DateInput label="Pick a date" />Initial value
July 2026
Su
Mo
Tu
We
Th
Fr
Sa
<DateInput label="Departure date" value="2026-07-04" />Label, description and asterisk
When should the event take place?
June 2026
Su
Mo
Tu
We
Th
Fr
Sa
<DateInput
label="Event date"
description="When should the event take place?"
withAsterisk
/>Error state
June 2026
Su
Mo
Tu
We
Th
Fr
Sa
Please select a future date.
<DateInput label="Check-in date" error="Please select a future date." />Disabled
June 2026
Su
Mo
Tu
We
Th
Fr
Sa
<DateInput label="Read-only date" value="2026-06-21" disabled />Monday first
June 2026
Mo
Tu
We
Th
Fr
Sa
Su
<DateInput label="Week starts Monday" firstDayOfWeek={1} />Form submission
Add a name prop to include the date in a form POST. The submitted value is always in YYYY-MM-DD format regardless of how it is displayed.
<form method="POST" action="/api/reserve">
<DateInput label="Reservation date" name="date" withAsterisk />
<button type="submit">Reserve</button>
</form>Listening for changes
The dv-date-change event fires on the component root whenever a date is selected from the popup.
<DateInput id="booking-date" label="Booking date" />
<script>
document.getElementById('booking-date').addEventListener('dv-date-change', (e) => {
console.log('Selected:', e.detail.date) // "2026-07-04"
})
</script>Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Initial selected date in YYYY-MM-DD format |
name | string | — | Hidden input name for form submission |
label | string | — | Field label displayed above the input |
description | string | — | Helper text below the label |
error | string | boolean | — | Error message or highlight flag |
placeholder | string | 'Pick a date' | Text shown when no date is selected |
disabled | boolean | false | Prevents the popup from opening |
firstDayOfWeek | 0 | 1 | 0 | 0 = Sunday first, 1 = Monday first |
required | boolean | false | Adds an asterisk to the label |
withAsterisk | boolean | false | Adds an asterisk without affecting HTML validation |