Browse docs
Browse docs
DatePicker is a form-connected single-date field: a read-only text input
paired with a Calendar popup. It integrates with
DashForm, RBAC, and the Dashforge field layout automatically — registration,
validation, error gating, reactive visibility, and access control are handled
internally. The name prop connects the field to the form schema.
The stored value is a plain ISO calendar date — YYYY-MM-DD — or null.
Unlike the native DateTimePicker, a pure date carries no time and no time
zone, which removes the whole class of DST round-trip hazards.
import { DashForm } from '@dashforge/forms';
import { DatePicker } from '@dashforge/ui';
<DashForm onSubmit={(data) => console.log(data)}>
<DatePicker
name="startDate"
label="Start date"
rules={{ required: 'Please pick a date' }}
/>
</DashForm>A basic field — click the input or the calendar icon to open the popup.
<DatePicker name="startDate" label="Start date" />minDate / maxDate bound the selectable range; disabledDates and the
isDateDisabled predicate block specific days.
May 2026 only
<DatePicker
name="bookingDate"
label="Booking date"
defaultValue="2026-05-15"
minDate="2026-05-01"
maxDate="2026-05-31"
helperText="May 2026 only"
/>Pass required and rules — the field reports errors through the form bridge,
gated on touch / submit.
Required field
<DatePicker
name="deadline"
label="Deadline"
required
rules={{ required: 'Please pick a deadline' }}
helperText="Required field"
/>locale drives both the calendar names and the input's display format;
weekStartDay sets the popup calendar's first column.
<DatePicker
name="dateDebut"
label="Date de début"
defaultValue="2026-05-20"
locale="fr-FR"
weekStartDay={1}
/>| Prop | Type | Default | Description |
|---|---|---|---|
name | string | — | Field name — the bridge registration key. Required. |
label | ReactNode | — | Field label. |
helperText | ReactNode | — | Hint text below the control. |
rules | RegisterOptions | — | Validation rules forwarded to the form bridge. |
required | boolean | false | Adds the label asterisk. |
error | boolean | — | Explicit error state (overrides the bridge's auto error). |
disabled | boolean | false | Disables the field. |
placeholder | string | — | Shown when no date is selected. |
layout | 'stacked' | 'inline' | 'floating' | 'stacked' | Label / control layout. floating is downgraded to stacked. |
value | ISODate | null | — | Controlled value. |
defaultValue | ISODate | null | — | Uncontrolled initial value. |
onChange | (value: ISODate | null) => void | — | Fired with the new date. |
minDate / maxDate | ISODate | — | Selectable range bounds (inclusive). |
disabledDates | ISODate[] | — | Explicit list of disabled dates. |
isDateDisabled | (date: ISODate) => boolean | — | Predicate disabling arbitrary dates. |
weekStartDay | WeekDay | 0 | First-column weekday of the popup calendar. |
locale | string | 'en-US' | BCP-47 locale for the calendar + display format. |
visibleWhen | (engine: Engine) => boolean | — | Reactive visibility predicate. |
access | AccessRequirement | — | RBAC access requirement. |
fullWidth | boolean | false | Stretches the field to its container width. |
testId | string | — | Test id applied to the field root. |
YYYY-MM-DD storage. The bridge value is a plain calendar date or
null — no time, no offset. Read it directly; no parsing needed.layout="floating" is not supported (the end-adornment icon would
collide with a floating label) — it falls back to stacked.DateTimePicker.DatePicker works as a standard controlled component with ISO date storage.
<DatePicker
value={startDate}
onChange={(iso) => setStartDate(iso)}
label="Start date"
/>Inside DashForm the field registers automatically — validation, error gating,
and touch tracking flow through the bridge.
<DashForm>
<DatePicker
name="deadline"
label="Deadline"
rules={{ required: 'Please pick a deadline' }}
/>
</DashForm>visibleWhen shows / hides the field from engine-driven form state.
<DatePicker
name="scheduledDate"
label="Scheduled date"
visibleWhen={(engine) => engine.getNode('schedule')?.value === true}
/>The access prop maps an RBAC decision to one of three field states — no
manual checks in the parent.
<DatePicker
name="overrideDate"
label="Override date"
access={{ resource: 'invoice', action: 'update', onUnauthorized: 'disable' }}
/>| Field | Type | Description |
|---|---|---|
resource | string | The resource being protected. |
action | string | The action being checked. |
onUnauthorized | 'hide' | 'disable' | 'readonly' | What to render when the user lacks permission. Defaults to 'hide'. |