Skip to content
Vertical Jump Designs-uiFront-End Studio
Get Pro

v3.9 is out.

Forms

DatePicker

Free27.1 KB gzipped

A date field: type a date in the locale's short format (or ISO), or press the calendar button to pick one from a Calendar in a popup dialog.

Accessibility: WCAG 2.2 AA · No A or AA violations in light or dark mode · Keys: Alt+Arrow Down, Arrow Left, Arrow Right and 9 more · Full report

Import

tsx
import { DatePicker, Calendar, DateRangePicker } from "@vjdesigns/vjdesigns-ui";

Importing only DatePicker adds about 27.1 KB of minified, gzipped JavaScript to your app (React not included). The stylesheet is shared by every component and loaded once: 75.1 KB gzipped.

Examples

Basic

Type a date or pick one from the calendar. Values are ISO strings like "2026-10-14".

Format: MM/DD/YYYY

Value: null

tsx
import { useState } from "react";
import { DatePicker, Field, Stack, Text } from "@vjdesigns/vjdesigns-ui";

export function Basic() {
  const [date, setDate] = useState<string | null>(null);
  return (
    <Stack gap={3} style={{ width: "100%", maxWidth: "18rem" }}>
      <Field label="Start date">
        <DatePicker value={date} onValueChange={setDate} clearable />
      </Field>
      <Text size="sm" tone="muted">
        Value: <code>{String(date)}</code>
      </Text>
    </Stack>
  );
}

Limits

min, max and isDateDisabled limit which dates can be chosen. Here, weekends are off.

Format: MM/DD/YYYY

Weekdays only, within the next 30 days.

tsx
import { DatePicker, Field } from "@vjdesigns/vjdesigns-ui";

export function Limits() {
  return (
    <div style={{ width: "100%", maxWidth: "18rem" }}>
      <Field label="Delivery day" hint="Weekdays only, within the next 30 days.">
        <DatePicker
          min={new Date().toISOString().slice(0, 10)}
          max={new Date(Date.now() + 30 * 864e5).toISOString().slice(0, 10)}
          isDateDisabled={(_, date) => date.getDay() === 0 || date.getDay() === 6}
        />
      </Field>
    </div>
  );
}

Range

DateRangePicker picks a start and end date, showing two months by default.

Start date
End date
Format: MM/DD/YYYY
tsx
import { DateRangePicker, Field } from "@vjdesigns/vjdesigns-ui";

export function Range() {
  return (
    <div style={{ width: "100%", maxWidth: "24rem" }}>
      <Field label="Trip dates">
        <DateRangePicker />
      </Field>
    </div>
  );
}

Inline calendar

Calendar is the grid on its own, for always-visible date selection.

October 2026

SunMonTueWedThuFriSat
tsx
import { Calendar } from "@vjdesigns/vjdesigns-ui";

export function InlineCalendar() {
  return <Calendar aria-label="Pick a date" defaultValue="2026-10-14" />;
}

Accessibility

The calendar follows the WAI-ARIA date picker pattern: arrow keys move by day and week, Page Up / Page Down by month (with Shift, by year), Home / End to the week's edges, and Enter selects. People can also just type the date; the expected format is described to screen readers.

Format: MM/DD/YYYY

You can type the date or pick it from the calendar.

tsx
import { DatePicker, Field } from "@vjdesigns/vjdesigns-ui";

export function Accessibility() {
  return (
    <div style={{ width: "100%", maxWidth: "18rem" }}>
      <Field label="Check-in date" hint="You can type the date or pick it from the calendar.">
        <DatePicker min="2026-10-20" defaultValue="2026-10-24" clearable />
      </Field>
    </div>
  );
}

Regional formats

Formats follow the region, not just the language. The same value shows as 10/24/2026 in en-US, 24/10/2026 in en-GB and 24.10.2026 in de-DE, and the calendar starts on Sunday or Monday to match. Set locale per field, or once for the whole app with LocaleProvider. Override the first day with weekStartsOn. The value is always the ISO date "2026-10-24", whatever the region or time zone.

Format: MM/DD/YYYY
Format: DD/MM/YYYY
Format: DD.MM.YYYY
Format: MM/DD/YYYY
tsx
import { DatePicker, Field, Stack } from "@vjdesigns/vjdesigns-ui";

export function RegionalFormats() {
  return (
    <Stack gap={4} style={{ width: "100%", maxWidth: "18rem" }}>
      <Field label="United States (en-US)">
        <DatePicker locale="en-US" defaultValue="2026-10-24" />
      </Field>
      <Field label="United Kingdom (en-GB)">
        <DatePicker locale="en-GB" defaultValue="2026-10-24" />
      </Field>
      <Field label="Germany (de-DE)">
        <DatePicker locale="de-DE" defaultValue="2026-10-24" />
      </Field>
      <Field label="United States, weeks start Monday">
        <DatePicker locale="en-US" weekStartsOn={1} defaultValue="2026-10-24" />
      </Field>
    </Stack>
  );
}

Translated

The typed format, month and weekday names, the first day of the week and the buttons' names all come from the locale. In Japanese the field shows 2026/10/24 and the calendar starts on Sunday.

形式: YYYY/MM/DD

2026年10月

日月火水木金土
tsx
import {
  Calendar,
  DatePicker,
  Field,
  Stack,
  LocaleProvider,
} from "@vjdesigns/vjdesigns-ui";
import ja from "@vjdesigns/vjdesigns-ui/locales/ja";

export function Translated() {
  return (
    <LocaleProvider locale="ja" messages={ja}>
      <Stack gap={4} style={{ width: "100%", maxWidth: "18rem" }}>
        <Field label="予約日">
          <DatePicker defaultValue="2026-10-24" />
        </Field>
        <Calendar aria-label="日付を選択" defaultValue="2026-10-24" />
      </Stack>
    </LocaleProvider>
  );
}

Right to left

The first example again, inside a right-to-left LocaleProvider (Arabic). Layout, spacing and arrow icons mirror, and the components' built-in text is translated. The example's own text stays in English.

Basic

التنسيق: يي/شش/سسسس

Value: null

tsx
import { LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import ar from "@vjdesigns/vjdesigns-ui/locales/ar";

// Basic is the "Basic" example above.
<LocaleProvider locale="ar" messages={ar}>
  <Basic />
</LocaleProvider>

Usage notes

The value is an ISO date string ("YYYY-MM-DD"), so it never shifts with time zones. The text field shows it in the locale's numeric format; on blur (or Enter), typed text is parsed and normalized, or rejected with an inline error. Inside a Field, label, hint, error, required, disabled, and invalid state are wired to the text input.

The popup is a modal Popover on the shared overlay layer stack, so Escape closes only the calendar, also inside a Modal or Drawer.

tsx
<Field label="Game day">
  <DatePicker name="gameDay" min="2026-10-01" onValueChange={setDay} />
</Field>

API reference

DatePicker

DatePicker props
PropTypeDefault
value

Selected date, "YYYY-MM-DD", or null for none (controlled).

ISODate | null—
defaultValue

Initially selected date when uncontrolled.

ISODate | null—
onValueChange

Called with the new ISO date (or null) when the user picks a date, types one and leaves the field, or clears it. Typed text that isn't a valid, allowed date sets the value to null.

(value: ISODate | null) => void—
min

Earliest allowed date, "YYYY-MM-DD".

ISODate—
max

Latest allowed date, "YYYY-MM-DD".

ISODate—
isDateDisabled

Marks individual dates unavailable. Receives the ISO date and a local Date.

(date: ISODate, dateObject: Date) => boolean—
locale

BCP 47 locale for the typed format, the calendar, and labels. Defaults to the browser locale.

string—
weekStartsOn

First day of the week in the calendar. Defaults to the locale's.

0123456—
placement

Where the calendar popup opens relative to the field. Flips when there isn't room.

"top""top-start""top-end""bottom""bottom-start""bottom-end""left""left-start""left-end""right""right-start""right-end""bottom-start"
size

Field and calendar size. Inherits from a surrounding Field.

"sm""md""lg""md"
name

Name of a hidden input that submits the ISO value ("YYYY-MM-DD") with a form.

string—
clearable

Shows a clear button while there is text.

booleanfalse
open

Controlled open state of the calendar popup.

boolean—
defaultOpen

Initial open state of the calendar popup when uncontrolled.

booleanfalse
onOpenChange

Called when the calendar popup opens or closes.

(open: boolean) => void—
onInvalidInput

Called when the user leaves the field with text that isn't a valid, allowed date. Use it to set your own Field error.

(error: DateInputError) => void—
invalidMessage

Message shown under the field when typed text is rejected. Pass a function to word it per reason, or null to show none (for example when you show a Field error from onInvalidInput instead). Defaults to "Enter a date as MM/DD/YYYY." and range/availability messages.

ReactNode | ((error: DateInputError) => ReactNode)—
chooseDateLabel

Accessible name of the calendar button while no date is set.

string"Choose date"
changeDateLabel

Accessible name of the calendar button while a date is set.

(formattedDate: string) => string(date) => `Change date, ${date}`
dialogLabel

Accessible name of the calendar popup dialog.

string"Choose date"
formatDescription

Screen-reader description of the expected format.

(pattern: string) => string(pattern) => `Format: ${pattern}`
today

Override "today" ("YYYY-MM-DD") in the calendar, e.g. for tests.

ISODate—
numberOfMonths

Months shown in the popup.

121
fieldClassName

Class name for the Input's field wrapper. className goes to the outer root.

string—
ref

Ref to the <input> element.

Ref<HTMLInputElement>—
startIcon

Decorative icon before the text. Hidden from assistive technology.

ReactNode—
endIcon

Decorative icon after the text. Hidden from assistive technology.

ReactNode—
loading

Shows a decorative spinner at the end and sets aria-busy on the input. Announce the outcome of the async work elsewhere (e.g. a status message).

booleanfalse
fullWidth

Stretches the field to fill its container.

booleantrue
variant

Visual style.

"outline""filled""outline"
radius

Corner rounding. When omitted, uses --field-radius. Use pill for search bars.

"none""xs""sm""md""lg""xl""2xl""pill"—
invalid

Marks the value as invalid: sets aria-invalid and a danger border. Pair it with a visible error message (a Field does this for you). Inherits from a surrounding Field.

booleanfalse
clearLabel

Accessible name of the clear button.

string"Clear"
inputClassName

Class name for the <input> element. className goes to the wrapper.

string—
startAddon

Static content attached to the start edge, such as "https://" or a currency symbol. Text addons are announced as part of the input's description (aria-describedby).

ReactNode—
endAddon

Static content attached to the end edge, such as ".com" or a unit ("kg"). Text addons are announced as part of the input's description.

ReactNode—
startElement

Interactive content inside the start edge (for example an IconButton with size="sm" and variant="ghost"). Stays in the tab order; give it its own accessible name.

ReactNode—
endElement

Interactive content inside the end edge (for example a copy or show-password IconButton). Stays in the tab order; give it its own accessible name.

ReactNode—
htmlSize

The native size attribute (visible width in characters). Mostly useful with fullWidth={false}.

number—

Also accepts standard HTML attributes, plus className, style and ref.

Calendar

A month grid for picking a date or a date range, following the WAI-ARIA date picker grid pattern: arrow keys move by day and week, Home/End to the week's edges, PageUp/PageDown by month (with Shift, by year), and Enter or Space selects. One date is in the tab order (roving tabindex).

Dates are plain ISO strings ("YYYY-MM-DD"), so values never shift with time zones. Use parseISODate / toISODate to convert to and from Date.

tsx
<Calendar defaultValue="2026-10-04" onValueChange={setDate} />
<Calendar mode="range" numberOfMonths={2} onValueChange={setRange} />
Calendar props
PropTypeDefault
mode

Select one date.

"single""range""single"
value

Selected date, "YYYY-MM-DD", or null for none (controlled).

ISODate | null | DateRange | null—
defaultValue

Initially selected date when uncontrolled.

ISODate | null | DateRange | null—
onValueChange

Called with the selected ISO date.

(value: ISODate | null) => void | (value: DateRange) => void—
min

Earliest selectable date, "YYYY-MM-DD". Keyboard navigation stops here.

ISODate—
max

Latest selectable date, "YYYY-MM-DD". Keyboard navigation stops here.

ISODate—
isDateDisabled

Marks individual dates unavailable (aria-disabled, struck through, not selectable but still focusable so they can be read). Receives the ISO date and a local Date for it.

(date: ISODate, dateObject: Date) => boolean—
locale

BCP 47 locale for month names, weekday names, and date labels. Defaults to the browser locale.

string—
weekStartsOn

First day of the week (0 = Sunday ... 6 = Saturday). Defaults to the locale's first day where the browser exposes it (Intl.Locale week info), otherwise Sunday.

0123456—
month

Visible month, "YYYY-MM" (controlled). With two months, this is the first one.

ISOMonth—
defaultMonth

Initially visible month, "YYYY-MM". Defaults to the selected date's month, or today's.

ISOMonth—
onMonthChange

Called with the new visible month ("YYYY-MM") when the user pages or moves focus to another month.

(month: ISOMonth) => void—
numberOfMonths

Months shown side by side.

121
showOutsideDays

Show the leading and trailing days of neighbouring months (muted). They can be pressed to select them and jump to that month. Defaults to true with one month and false with two.

boolean—
size

Day cell and text size.

"sm""md""lg""md"
today

Override "today" ("YYYY-MM-DD"), e.g. for tests or a server-provided date. Defaults to the local date.

ISODate—
headingLevel

Heading level of the month title. Pick it by document outline.

234562
previousMonthLabel

Accessible name of the previous-month button.

string"Previous month"
nextMonthLabel

Accessible name of the next-month button.

string"Next month"

Also accepts standard HTML attributes, plus className, style and ref.

DateRangePicker

A date range field: two text fields (start and end) typed in the locale's short format, plus a calendar button that opens a range Calendar (two months by default) in a modal popup.

The value is { start, end } with ISO dates ("YYYY-MM-DD"). In the calendar, the first pick sets the start and the second the end; the range is committed (and the popup closes) only when both are picked, so Escape after one pick changes nothing. Typed dates are validated like DatePicker's, plus an end before the start is rejected.

Accessibility: the pair is a role="group" named by the Field label (or aria-label); each field is named by that label plus its own visible label ("Season dates, Start date"). Field hint, error, required, disabled, and invalid state reach both fields. Errors are announced politely.

tsx
<Field label="Season dates">
  <DateRangePicker startName="from" endName="to" onValueChange={setRange} />
</Field>
DateRangePicker props
PropTypeDefault
value

Selected range (controlled). null (or empty ends) for none.

DateRange | null—
defaultValue

Initially selected range when uncontrolled.

DateRange | null—
onValueChange

Called with the new range when the user completes a pick in the calendar, or types a date in either field and leaves it. Typed text that isn't a valid, allowed date clears that end.

(value: DateRange) => void—
min

Earliest allowed date, "YYYY-MM-DD".

ISODate—
max

Latest allowed date, "YYYY-MM-DD".

ISODate—
isDateDisabled

Marks individual dates unavailable. Receives the ISO date and a local Date.

(date: ISODate, dateObject: Date) => boolean—
locale

BCP 47 locale for the typed format, the calendar, and labels. Defaults to the browser locale.

string—
weekStartsOn

First day of the week in the calendar. Defaults to the locale's.

0123456—
placement

Where the calendar popup opens. Flips when there isn't room.

"top""top-start""top-end""bottom""bottom-start""bottom-end""left""left-start""left-end""right""right-start""right-end""bottom-start"
size

Field and calendar size. Inherits from a surrounding Field.

"sm""md""lg""md"
startName

Name of a hidden input that submits the start date ("YYYY-MM-DD") with a form.

string—
endName

Name of a hidden input that submits the end date ("YYYY-MM-DD") with a form.

string—
open

Controlled open state of the calendar popup.

boolean—
defaultOpen

Initial open state of the calendar popup when uncontrolled.

booleanfalse
onOpenChange

Called when the calendar popup opens or closes.

(open: boolean) => void—
onInvalidInput

Called when the user leaves a field with text that isn't a valid, allowed date.

(error: DateRangeInputError) => void—
invalidMessage

Message shown under the fields when typed text is rejected. Pass a function to word it per reason, or null to show none.

ReactNode | ((error: DateRangeInputError) => ReactNode)—
startLabel

Visible label of the start field (read after the Field label).

string"Start date"
endLabel

Visible label of the end field (read after the Field label).

string"End date"
chooseRangeLabel

Accessible name of the calendar button while no range is set.

string"Choose dates"
changeRangeLabel

Accessible name of the calendar button while a range is set.

(formattedRange: string) => string(range) => `Change dates, ${range}`
dialogLabel

Accessible name of the calendar popup dialog.

string"Choose dates"
formatDescription

Screen-reader description of the expected format.

(pattern: string) => string(pattern) => `Format: ${pattern}`
today

Override "today" ("YYYY-MM-DD") in the calendar, e.g. for tests.

ISODate—
numberOfMonths

Months shown in the popup.

122
invalid

Marks the fields invalid. Inherits from a surrounding Field.

boolean—
required

Both dates are required. Inherits from a surrounding Field.

boolean—
disabled

Disables both fields and the calendar button. Inherits from a surrounding Field.

boolean—
readOnly

Read-only fields, no calendar button. Inherits from a surrounding Field.

boolean—
fullWidth

Stretch to the container's width.

booleantrue
aria-label

Accessible name of the pair when there is no surrounding Field label.

string—
aria-describedby

Extra description ids for both fields.

string—
className

Class name for the outer root.

string—
style

Style for the outer root.

CSSProperties—
id

id of the start field (the Field label points here).

string—

See what changed in each version in the Changelog.

Accessibility report

DatePicker targets WCAG 2.2 AA. Below: a live axe-core audit of this page's examples, Lighthouse scores for the page in both modes, the accessibility behavior built into the component, and the checks only a person can do.

axe-core audit (live)

Running accessibility audit

Checking the examples above…

Lighthouse audit

Light mode

Score 100

37 passed · 0 failed · 28 not applicable · 10 to check by hand

Dark mode

Score 100

37 passed · 0 failed · 28 not applicable · 10 to check by hand

Lighthouse 13.5.0 audits the whole docs page (header and sidebar included), not just the examples, in English. Last run 11/27/2026. Some failed audits carry no weight in the score, so a page can score 100 and still list one.

Built-in behavior

Keyboard

Keyboard
KeyAction
TypingEnter a date in the field; Enter applies it.
Alt+Arrow DownOpens the calendar.
Arrow LeftArrow RightPrevious or next day (mirrored right to left).
Arrow UpArrow DownSame day of the previous or next week.
HomeEndFirst or last day of the week.
Page UpPage DownPrevious or next month (Shift: year).
EnterSpaceSelects the focused day.
EscapeCloses the calendar and returns focus to the field.

The calendar is a modal popover: focus moves into the grid on open and returns on close.

Roles and states

Roles and states
ElementRoleStates and properties
Text fieldtextboxaria-describedby → format hint and error
Calendar buttonbuttonaria-haspopup="dialog", aria-expanded, aria-label
Monthgridaria-labelledby → month heading
Daygridcellaria-selected, aria-current="date" on today, aria-disabled
Month headingheadingaria-live="polite"

Manual checks

Automated tools find roughly a third of accessibility issues. Test these in your app, with your content.

Manual accessibility checks
CheckWhat to testWCAG 2.2
KeyboardEvery action works with Tab, Shift+Tab, Enter, Space and the arrow keys, and focus never gets stuck.2.1.1 (A), 2.1.2 (A)
FocusFocus moves in a logical order, is always visible, and isn't hidden behind sticky headers.2.4.3 (A), 2.4.7 (AA), 2.4.11 (AA), 2.4.13 (AAA)
Screen readersNames, roles and states are announced correctly, and status changes are announced without moving focus.1.3.1 (A), 4.1.2 (A), 4.1.3 (AA)
ColorMeaning never depends on color alone; your own colors meet contrast in both modes.1.4.1 (A), 1.4.3 (AA), 1.4.11 (AA), 1.4.6 (AAA)
Zoom and reflowAt 200% text size and at 320px wide (400% zoom), nothing is cut off and no sideways scrolling is needed.1.4.4 (AA), 1.4.10 (AA), 1.4.12 (AA)
Pointer targetsClick and tap targets are at least 24×24px (44×44px for AAA), or spaced so they don't overlap.2.5.8 (AA), 2.5.5 (AAA)
MotionAnimations respect the reduced-motion setting.2.3.3 (AAA)