Skip to main content

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.

Base
Mantine + override
Mantine
DatePicker, DatePickerInput, DateTimePicker, TimePicker
Import
{ DatePicker, DatePickerInput, DateTimePicker, TimePicker } from '@mantine/dates'
Source
src/themes/component-overrides/inputs.ts
src/themes/style-overrides/calendar.module.css
src/themes/style-overrides/date-picker-input.module.css
src/themes/style-overrides/date-time-picker.module.css
src/themes/style-overrides/time-picker.module.css

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​

MoTuWeThFrSaSu
type
presets
hideWeekdays
React
<DatePicker />

Date and Time Pickers​

component
clearable
disabled
size
sm
md
lg
React
<DatePickerInput label="Velg dato" placeholder="Velg dato" size="md" />
ComponentUse it for
DatePickerA calendar that stays open on the page
DatePickerInputA date, several dates or a date range
DateTimePickerA date and a time in one field
TimePickerA 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.

PropertyTypeAllowed valuesDefaultDescription
sizeMantineSizexs · sm · md · lg · xlmdSets height, padding and font size on the same height ladder as every other themed input — 40px at the default.
rightSectionReactNode—IconCalendarWeekDatePickerInput and DateTimePicker. Content at the right end of the field. Defaults to a calendar icon; pass your own node to replace it.
valueFormatstring—'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.
withDropdownboolean—trueTimePicker 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.withDropdownboolean—falseDateTimePicker only. The time field under the calendar opens no dropdown of its own.
submitButtonPropsActionIconProps—{ 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.