DatePicker
A calendar popover for selecting a single date, a range, or multiple dates.
A DatePicker lets users pick a date from a calendar popover. It supports single
dates (the default), date ranges, and multiple-date selection, and renders the
selected value using date-fns format tokens.
import { DatePicker } from '@workflowbuilder/ui';import { useState } from 'react';
function Example() { const [date, setDate] = useState<Date | null>(null); return ( <DatePicker value={date ?? undefined} placeholder="dd/mm/yyyy" valueFormat="dd-MM-yyyy" onChange={(next) => setDate((next as Date | null) ?? null)} /> );}aria-labelAccessible name for the trigger button.
aria-labelledby`aria-labelledby` for the trigger button.
classNameClass name applied to the trigger button.
defaultValueInitial value when the picker is uncontrolled. - `default` accepts `Date | string` - `range` accepts `[Date, Date]` - `multiple` accepts `Date[]`
disabledDisable the picker. The trigger button is not interactive and the popover cannot be opened.
errorRender the trigger in an error state.
helperTextMessage rendered under the trigger and announced with it.
id`id` attribute applied to the trigger button.
inputSizeSize variant of the trigger input.
isRequiredAdds the required marker next to the label.
labelLabel rendered above the trigger and linked to it.
maxDateThe latest selectable date (inclusive).
minDateThe earliest selectable date (inclusive).
onChangeCallback fired when the selected value changes. - `default` -> the selected `Date` or `null` when cleared - `range` -> `[from, to]` once both dates are selected, otherwise `null` - `multiple`-> the array of selected `Date`s (empty array allowed)
placeholderPlaceholder text shown when no date is selected.
readOnlyRender the picker as read-only. The trigger displays the current value but the popover cannot be opened.
stateVisual state of the control.
typePicker type. - `default` selects a single date - `range` selects a `[from, to]` date range - `multiple` selects an arbitrary array of dates
valueControlled selected value. When set, the picker becomes controlled.
valueFormatFormat string used to render the selected date(s) in the trigger. **Note:** This implementation uses `date-fns` format tokens (e.g. `dd/MM/yyyy`). The legacy default value `DD/MM/YYYY` (dayjs tokens) is accepted and converted to the equivalent `date-fns` tokens for backwards compatibility.
CSS variables
Section titled “CSS variables”Color
--wb-public-date-picker-dropdown-background--wb-public-date-picker-dropdown-border-color--wb-public-date-picker-dropdown-box-shadow--wb-public-date-picker-color--wb-public-date-picker-header-background--wb-public-date-picker-date-header-color--wb-public-date-picker-nav-color--wb-public-date-picker-date-outside-color--wb-public-date-picker-date-hover-background-color--wb-public-date-picker-date-selected-background-color--wb-public-date-picker-date-selected-color--wb-public-date-picker-date-today-color