@k8ordo/ui

DateField

The browser’s own date input (type="date"). The value is a YYYY-MM-DD string.

Import

ts
import { DateField } from '@k8ordo/ui';

Usage

tsx
<DateField aria-label="Date" defaultValue="2026-09-25" name="eventDate" />

Min and max

The browser checks the range. A date outside it reports rangeUnderflow or rangeOverflow.

tsx
<DateField
  aria-label="Date"
  defaultValue="2026-09-25"
  max="2026-12-31"
  min="2026-09-01"
/>

Disabled

tsx
<DateField aria-label="Date" defaultValue="2026-09-25" disabled />

Invalid

tsx
<DateField aria-label="Date" invalid />

With @k8ordo/form

Spread the input derived from z.iso.date() as it is. There is no need to take type out.

tsx
// schema.ts
export const eventSchema = z.object({ eventDate: z.iso.date() });

// event-form.tsx
const eventDate = form.field('eventDate');

<FormControl
  errorText={eventDate.error}
  invalid={eventDate.invalid}
  label="Date"
  required={eventDate.required}
  renderInput={(props) => <DateField {...props} {...eventDate.input} />}
/>

Props

invalid?
Type: boolean
Default: false
ref?
Type: Ref<HTMLInputElement>
Default: -
PropTypeDefault
invalid?booleanfalse
ref?Ref<HTMLInputElement>-

Inherited attributes (except the ones set internally): InputHTMLAttributes<HTMLInputElement>

k8ordo

React libraries that use Baseline features without holding back.