Skip to content

Date picker - Frameworks

A date picker allows the user to select a specific calendar date.

AndroidreleasedElementsreleasediOSreleasedReact 19released

React-19

Import

You can import the component like so:

js
import { Datepicker } from '@warp-ds/components/react/datepicker';

Props

Required props

NameTypeDefaultDescription
labelstringLabel shown on the input of the datepicker.
onChange(day: string) => voidCalled with the date when the user makes a selection from the calendar or a changes the input.

Optional Props

NameTypeDefaultDescription
valuestringThe current selected date.
isDayDisabled(day: Date) => booleannoopCalled with the day of an entry in the calendar to determine if the day is disabled.
localeLocaleNorwegian localeA date-fns locale object. This enables internationalization in the datepicker such as date formatting and which day a week starts on. See date fns documentation.
phrasesPhrasesAn object of translation strings used by the datepicker for accessibility.
displayFormatstringA date-fns format string for the input. See date fns documentation.
monthFormatstringA date-fns format string for the month. See date fns documentation.
weekDayFormatstringA date-fns format string for the weekday. See date fns documentation.
dayAriaLabelFormatstringA date-fns format string for a day. Used for screen readers together with phrases. See date fns documentation.

Example

jsx
function DatePickerExample() {

    return <DatePicker
        label="Dato"
        onChange={setValue}
    />;
}

Questions?

Feel free to ask any questions on usage in the Warp DS Slack channel: #warp-design-system