Skip to main content
Version: latest
Works everywhere

DatePicker works in both server and client environments. Always use the standard import (e.g. @prokodo/ui/date-picker) — the library detects the runtime automatically.

DatePicker

DatePicker renders a text input that opens an accessible calendar popup for date selection. Supports single date, range, and time selection modes with full localization.

Live demo →

Overview

import { DatePicker } from "@prokodo/ui/date-picker"
;<DatePicker
label="Appointment date"
name="date"
value={date}
onChange={setDate}
locale="de"
/>

Import

import { DatePicker } from "@prokodo/ui/date-picker"

Styling is handled via design tokens — no additional CSS import required.


Props

PropTypeDefaultRequiredDescription
idstringHTML id forwarded to the input.
labelstringInput label text.
valueDayjs | string | nullControlled date value (Dayjs instance, ISO string, or null).
defaultValueDayjs | string | nullUncontrolled initial date value.
withTimebooleanfalseEnable time selection alongside date.
minuteStepnumber1Minute step increment in the time picker.
disabledbooleanfalseDisable the date picker.
requiredbooleanfalseMark field as required.
fullWidthbooleanfalseStretch to container width.
colorVariantsAccent color variant.
errorTextstringError message (also sets error state).
helperTextstringHelper text shown below the input.
todayLabelstringLabel for the "Today" button.
clearLabelstringLabel for the "Clear" button.
applyLabelstringLabel for the "Apply" button.
timeLabelstringLabel for the time section heading.
onChange(value: Dayjs | null) => voidCalled when the selected date changes.
classNamestringCSS class on root element.

See src/components/date-picker/DatePicker.model.ts for the full DatePickerProps type.


Design Tokens

Customise DatePicker via CSS custom properties on :root or a scoped ancestor.

TokenDefaultDescription
--pk-dp-trigger-bgvar(--pk-color-surface)Trigger input background
--pk-dp-trigger-fgvar(--pk-color-fg)Trigger text colour
--pk-dp-trigger-radiusvar(--pk-radius-pill)Trigger corner radius
--pk-dp-trigger-label-float-fgvar(--pk-color-brand)Floating label colour
--pk-dp-dialog-bgvar(--pk-color-surface)Calendar dialog background
--pk-dp-dialog-radiusvar(--pk-radius-lg)Calendar dialog corner radius
--pk-dp-dialog-shadowvar(--pk-shadow-lg)Calendar dialog shadow
--pk-dp-day-radiusvar(--pk-radius-circle)Day-cell corner radius
--pk-dp-day-today-ringvar(--pk-color-brand)Today indicator ring colour
--pk-dp-gradient-fromvar(--pk-color-brand)Selected-day gradient start
--pk-dp-gradient-tovar(--pk-color-accent)Selected-day gradient end
--pk-dp-time-select-bgvar(--pk-color-surface)Time select background
--pk-dp-time-select-radiusvar(--pk-radius-md)Time select corner radius

AIC Note

Use the standard import path in application code:

import { DatePicker } from "@prokodo/ui/date-picker"

No separate /client or /lazy import selection is required in consumer code.

AIC components also support a priority flag for critical above-the-fold elements. This is most visible on Image (native preloading via <link rel="preload"> for above-the-fold content).


WCAG 2.2 Status

CriterionNameStatusNote
1.3.1Info and Relationships (A)✅ FulfilledSemantic structure (headings, lists, labels, landmarks) must be conveyed programmatically via HTML or ARIA.
1.3.5Identify Input Purpose (AA)🔍 Manual reviewForm fields collecting personal data must expose their purpose via the HTML autocomplete attribute.
2.1.1Keyboard (A)🔍 Manual reviewAll functionality must be operable via keyboard alone, without requiring specific timing.
2.1.2No Keyboard Trap (A)🔍 Manual reviewKeyboard focus must never become trapped inside a component; users must always be able to navigate away using standard keys.
2.4.3Focus Order (A)🔍 Manual reviewThe keyboard focus sequence must preserve meaning and operability in the complete page integration context.
2.4.7Focus Visible (AA)🔍 Manual reviewA visible keyboard focus indicator must be present on every interactive element. Verify against the applied product theme.
2.4.11Focus Not Obscured (Min.) (AA)🔍 Manual reviewThe focused component must not be fully hidden by sticky headers, overlays, or other positioned page elements.
3.3.1Error Identification (A)🔍 Manual reviewInput errors must be identified and described to the user in text, not by colour alone.
3.3.2Labels or Instructions (A)🔍 Manual reviewEvery form input requires a programmatically associated label or a visible instruction.
4.1.2Name, Role, Value (A)🔍 Manual reviewName, role, and state of all interactive UI components must be programmatically determinable via native HTML semantics or ARIA.
4.1.3Status Messages (AA)🔍 Manual reviewStatus messages (loading, success, error, progress) must reach assistive technologies without a focus change (aria-live or role='status').

Test coverage: 3 jest-axe assertion(s) across 4 test file(s) · 0 ARIA attribute occurrence(s) in source scan. Criteria marked 🔍 require manual verification in the final product integration and theme context.

Storybook

👉 Open DatePicker in Storybook


Source

src/components/date-picker/DatePicker.model.ts