DateInput
Documentation and examples for the DateInput component. Includes support for range selection and intuitive calendar interactions.
When To Use
- By clicking the input box, you can select a date from a popup calendar.
Basic
Basic use case. Users can select or input a date in panel.
astro
---
import DateInput from '@/components/data-entry/DateInput.astro';
---
<DateInput id="start-date" label="Single Date" placeholder="Select a date..." class="max-w-xs" /> Range Picker
Set range picker type by range prop.
astro
---
import DateInput from '@/components/data-entry/DateInput.astro';
---
<DateInput id="date-range" label="Date Range" placeholder="Select a date range..." range={true} class="max-w-xs" /> Disabled
A disabled state of the DatePicker.
astro
---
import DateInput from '@/components/data-entry/DateInput.astro';
---
<DateInput id="dt-disabled" label="Disabled" placeholder="Disabled..." disabled class="max-w-xs" /> Status
Add status to DatePicker with error, which could be error or warning.
Please select a valid date
astro
---
import DateInput from '@/components/data-entry/DateInput.astro';
---
<DateInput id="dt-error" label="Error State" placeholder="Select a date..." error="Please select a valid date" class="max-w-xs" /> Customized
Customized rendering and formatting.
astro
---
import DateInput from '@/components/data-entry/DateInput.astro';
---
<DateInput
id="dt-custom"
label="Custom Locale & Icon"
placeholder="Sélectionnez une date..."
locale="fr-FR"
icon="MapPin"
class="max-w-xs"
/> Properties
| Property | Description | Type | Default |
|---|---|---|---|
| range | Enables date range selection mode. | boolean | false |
| locale | The locale used for calendar rendering and date formatting. | string | '' |
| icon | The icon to display inside the input. | IconName | 'Calendar' |
| label | Label text shown above the input. | string | '' |
| error | Indicates an error state or displays an error message | string | boolean | |
| success | Indicates a success state or displays a success message | string | boolean | |
| disabled | Disables the component | boolean | false |