Date and time picker
Date and time pickers help users select a date, a time, or both. They provide a structured way to enter date and time values accurately and consistently.
Usage
We use Mantine's Date and Time Picker. For more information about properties and how to use it, go to https://mantine.dev/dates/getting-started/
Date picker
| Mo | Tu | We | Th | Fr | Sa | Su |
|---|---|---|---|---|---|---|
<DatePicker />
Date and Time Pickers
<DatePickerInput label="Velg dato" placeholder="Velg dato" size="md" />
| Component | Use it for |
|---|---|
DatePicker | A calendar that stays open on the page |
DatePickerInput | A date, several dates or a date range |
DateTimePicker | A date and a time in one field |
TimePicker | A time on its own |
Props
Only what this design system changes. In the calendar, each day is a 32px square at every size, and today is marked with a grey background and bold text. The date field is 156px wide, the date and time field 196px, and the time field under its calendar 32px high. Everything else is Mantine's — read the full props tables for DatePicker, DatePickerInput, DateTimePicker and TimePicker there.
| Property | Type | Allowed values | Default | Description |
|---|---|---|---|---|
size | MantineSize | xs · sm · md · lg · xl | md | Sets height, padding and font size on the same height ladder as every other themed input — 40px at the default. |
rightSection | ReactNode | — | IconCalendarWeek | DatePickerInput and DateTimePicker. Content at the right end of the field. Defaults to a calendar icon; pass your own node to replace it. |
valueFormat | string | — | 'DD.MM.YYYY', 'DD.MM.YYYY HH:mm' | DatePickerInput and DateTimePicker. Formats the displayed value: a day-first Norwegian date on DatePickerInput, the same date with 24-hour time on DateTimePicker. |
format | '12h' | '24h' | 12h · 24h | '24h' | TimePicker only. The clock the segments are read and written in. |
withDropdown | boolean | — | true | TimePicker only. Opens a dropdown of hours, minutes and seconds, so the segments do not have to be typed by hand. Stock Mantine leaves it off. |
timePickerProps.withDropdown | boolean | — | false | DateTimePicker only. The time field under the calendar opens no dropdown of its own. |
submitButtonProps | ActionIconProps | — | { size: 'sm', variant: 'secondary' } | DateTimePicker only. Props for the confirm button beside the time field — the small secondary ActionIcon. |
Accessibility
Always pass a label. It names the field as a whole, not the hours, minutes
and seconds segments a screen reader lands on one at a time — name those with
hoursInputLabel, minutesInputLabel and secondsInputLabel, directly on
TimePicker and through timePickerProps on DateTimePicker.
Pass ariaLabels so the calendar's previous, next and level controls are
announced in the user's language, and label the clear button through
clearButtonProps when clearable is on. See
Accessibility for the theme-wide rules.