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.
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
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
id | string | — | — | HTML id forwarded to the input. |
label | string | — | — | Input label text. |
value | Dayjs | string | null | — | — | Controlled date value (Dayjs instance, ISO string, or null). |
defaultValue | Dayjs | string | null | — | — | Uncontrolled initial date value. |
withTime | boolean | false | — | Enable time selection alongside date. |
minuteStep | number | 1 | — | Minute step increment in the time picker. |
disabled | boolean | false | — | Disable the date picker. |
required | boolean | false | — | Mark field as required. |
fullWidth | boolean | false | — | Stretch to container width. |
color | Variants | — | — | Accent color variant. |
errorText | string | — | — | Error message (also sets error state). |
helperText | string | — | — | Helper text shown below the input. |
todayLabel | string | — | — | Label for the "Today" button. |
clearLabel | string | — | — | Label for the "Clear" button. |
applyLabel | string | — | — | Label for the "Apply" button. |
timeLabel | string | — | — | Label for the time section heading. |
onChange | (value: Dayjs | null) => void | — | — | Called when the selected date changes. |
className | string | — | — | CSS class on root element. |
See
src/components/date-picker/DatePicker.model.tsfor the fullDatePickerPropstype.
Design Tokens
Customise DatePicker via CSS custom properties on :root or a scoped ancestor.
| Token | Default | Description |
|---|---|---|
--pk-dp-trigger-bg | var(--pk-color-surface) | Trigger input background |
--pk-dp-trigger-fg | var(--pk-color-fg) | Trigger text colour |
--pk-dp-trigger-radius | var(--pk-radius-pill) | Trigger corner radius |
--pk-dp-trigger-label-float-fg | var(--pk-color-brand) | Floating label colour |
--pk-dp-dialog-bg | var(--pk-color-surface) | Calendar dialog background |
--pk-dp-dialog-radius | var(--pk-radius-lg) | Calendar dialog corner radius |
--pk-dp-dialog-shadow | var(--pk-shadow-lg) | Calendar dialog shadow |
--pk-dp-day-radius | var(--pk-radius-circle) | Day-cell corner radius |
--pk-dp-day-today-ring | var(--pk-color-brand) | Today indicator ring colour |
--pk-dp-gradient-from | var(--pk-color-brand) | Selected-day gradient start |
--pk-dp-gradient-to | var(--pk-color-accent) | Selected-day gradient end |
--pk-dp-time-select-bg | var(--pk-color-surface) | Time select background |
--pk-dp-time-select-radius | var(--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
| Criterion | Name | Status | Note |
|---|---|---|---|
| 1.3.1 | Info and Relationships (A) | ✅ Fulfilled | Semantic structure (headings, lists, labels, landmarks) must be conveyed programmatically via HTML or ARIA. |
| 1.3.5 | Identify Input Purpose (AA) | 🔍 Manual review | Form fields collecting personal data must expose their purpose via the HTML autocomplete attribute. |
| 2.1.1 | Keyboard (A) | 🔍 Manual review | All functionality must be operable via keyboard alone, without requiring specific timing. |
| 2.1.2 | No Keyboard Trap (A) | 🔍 Manual review | Keyboard focus must never become trapped inside a component; users must always be able to navigate away using standard keys. |
| 2.4.3 | Focus Order (A) | 🔍 Manual review | The keyboard focus sequence must preserve meaning and operability in the complete page integration context. |
| 2.4.7 | Focus Visible (AA) | 🔍 Manual review | A visible keyboard focus indicator must be present on every interactive element. Verify against the applied product theme. |
| 2.4.11 | Focus Not Obscured (Min.) (AA) | 🔍 Manual review | The focused component must not be fully hidden by sticky headers, overlays, or other positioned page elements. |
| 3.3.1 | Error Identification (A) | 🔍 Manual review | Input errors must be identified and described to the user in text, not by colour alone. |
| 3.3.2 | Labels or Instructions (A) | 🔍 Manual review | Every form input requires a programmatically associated label or a visible instruction. |
| 4.1.2 | Name, Role, Value (A) | 🔍 Manual review | Name, role, and state of all interactive UI components must be programmatically determinable via native HTML semantics or ARIA. |
| 4.1.3 | Status Messages (AA) | 🔍 Manual review | Status 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