Browse docs
Browse docs
DatePicker is a form-connected single-date field: a read-only trigger button
paired with a Calendar popover. It integrates
with DashForm and RBAC 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/tw';
<DashForm onSubmit={(data) => console.log(data)}>
<DatePicker
name="startDate"
label="Start date"
rules={{ required: 'Please pick a date' }}
/>
</DashForm>A basic field — click the trigger to open the calendar popover.
import { DatePicker } from '@dashforge/tw';
<DatePicker name="startDate" label="Start date" />minDate / maxDate bound the selectable range; disabledDates and the
isDateDisabled predicate block specific days.
May 2026 only
import { DatePicker } from '@dashforge/tw';
<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
import { DatePicker } from '@dashforge/tw';
<DatePicker
name="deadline"
label="Deadline"
required
rules={{ required: 'Please pick a deadline' }}
helperText="Required field"
/>locale drives both the calendar names and the trigger's display format;
weekStartDay sets the popover calendar's first column.
import { DatePicker } from '@dashforge/tw';
<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' | 'stacked' | Label / control layout. |
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 popover 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. |
sx | string | — | Tailwind class override for the root element. |
slotProps | DatePickerSlotProps | — | Per-slot className overrides. |
testId | string | — | Test id applied to the field root. |
sx overrides the root element's Tailwind classes; slotProps targets the
inner slots — root, label, requiredMark, trigger, helperText,
errorText.
<DatePicker
name="startDate"
label="Start date"
sx="max-w-xs"
slotProps={{ trigger: { className: 'rounded-lg' } }}
/>YYYY-MM-DD storage. The bridge value is a plain calendar date or
null — no time, no offset. Read it directly; no parsing needed.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'. |