DateField
A field on the browser’s own date input (type="date"). The value is YYYY-MM-DD.
Import
import { DateField } from '@k8ordo/ui';Usage
<DateField aria-label="Date" defaultValue="2026-09-25" name="eventDate" />Min / Max
The browser checks the range itself: a date outside it reports rangeUnderflow / rangeOverflow.
<DateField
aria-label="Date"
defaultValue="2026-09-25"
max="2026-12-31"
min="2026-09-01"
/>Disabled
<DateField aria-label="Date" defaultValue="2026-09-25" disabled />Invalid
<DateField aria-label="Date" invalid />With @k8ordo/form
Spread the input derived from z.iso.date() as is. There is no need to take type out.
// 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: -
| Prop | Type | Default |
|---|---|---|
invalid? | boolean | false |
ref? | Ref<HTMLInputElement> | - |
Type base (some attrs are managed internally): InputHTMLAttributes<HTMLInputElement>