Inputs
Date and time
DatePicker, DateRangePicker, DateField, TimeField, Calendar and RangeCalendar, fully keyboard operable.
<script>
import { DatePicker, CalendarDate } from "@codeatlasdev/ui";
let date = $state(new CalendarDate(2026, 10, 10));
</script>
<DatePicker label="Delivery date" bind:value={date} />
Values are @internationalized/date objects. CalendarDate, Time, today, getLocalTimeZone and the DateValue, DateRange and TimeValue types are re-exported from @codeatlasdev/ui, so you do not need that package as a direct dependency.
The default locale is pt-BR with Monday-first weeks. The demos below pass locale="en-US" and weekStartsOn={0} to show the English format.
Keyboard. In field segments, type digits or use the up and down arrows to change a value, and the left and right arrows or Tab to move between segments. In a calendar, the arrows move by day, PageUp and PageDown by month, Shift with PageUp or PageDown by year, Home and End to the week edges, Enter or Space selects, and Escape closes the popover.
An error is rendered with role="alert" and sets aria-invalid and aria-describedby. Clicking a field label focuses its first segment.
DatePicker and DateRangePicker
Editable segments plus a calendar popover. The range picker shows two months.
Type a date or pick one from the calendar.
value: –
start: – · end: –
Code
DateField and TimeField
Segments only, no popover. granularity="minute" adds a time, and hourCycle switches between 12h and 24h.
value: 2026-10-10
value: 14:30:00
Code
Calendar and RangeCalendar
Inline calendars. Click a start date, then an end date for the range.
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
value: 2026-10-13
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
start: – · end: –
Code
Min, max, error and disabled
Only the next 30 days are selectable. Out-of-range days are disabled and typed values become invalid.
Only the next 30 days.
Enter your date of birth.
Code
Shared props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | – | Field label. On Calendar and RangeCalendar it is the screen-reader label. |
description | string | – | Hint below the field (aria-describedby). Pickers and fields only. |
error | string | – | Error message (role="alert"). Sets aria-invalid and the error style. Pickers and fields only. |
disabled | boolean | false | Disables the field and popover. |
readonly | boolean | false | Shows the value without allowing edits. |
required | boolean | false | Marks the field as required. Pickers and fields only. |
value | DateValue | DateRange | Time | – | Bindable. DateValue for DatePicker, DateField and Calendar, DateRange for the range components, Time for TimeField. |
placeholder | DateValue | TimeValue | – | Bindable. Controls the visible month, or the starting point of an empty field. |
locale | string | 'pt-BR' | Intl locale for segments, month and weekday names. |
weekStartsOn | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 1 | First day of the week (0 is Sunday). Calendars and pickers. |
minValue | DateValue | – | Lower bound. Out-of-range days are disabled and typed values become invalid. |
maxValue | DateValue | – | Upper bound. |
granularity | 'day' | 'hour' | 'minute' | 'second' | 'day' (TimeField: 'minute') | Which segments are shown. TimeField accepts hour, minute and second. |
hourCycle | 12 | 24 | – | DateField and TimeField. Defaults to the locale (pt-BR is 24h). |
open | boolean | false | Bindable popover state. DatePicker and DateRangePicker. |
numberOfMonths | number | 1 (range components: 2) | Months shown side by side. |
fixedWeeks | boolean | false | Always render six weeks. Calendar and RangeCalendar. |
isDateDisabled | (d: DateValue) => boolean | – | Disables matching dates. Calendars and pickers. |
isDateUnavailable | (d: DateValue) => boolean | – | Marks matching dates as unavailable. Calendars and pickers. |
closeOnDateSelect | boolean | true | DatePicker: close the popover after picking a date. |
closeOnRangeSelect | boolean | true | DateRangePicker: close the popover once the range is complete. |
size | 'sm' | 'md' | 'md' | Field height. Pickers and fields. |
name | string | – | Name of the hidden input (ISO string) for native forms. DatePicker, DateField and TimeField. |
triggerLabel | string | 'Open calendar' (localized) | aria-label of the calendar button. Pickers. |
class | string | – | Extra classes on the root. |
onchange | (value) => void | – | Called when the value changes. Receives DateValue | undefined, DateRange or Time | undefined depending on the component. |