Import
Copy code
import { DatePicker } from '@k8ordo/ui';Usage
Copy code
<DatePicker aria-label="Check-in" defaultValue="2026-09-25" name="checkIn" />Firefox draws its own calendar button inside every date input and offers no way to hide it. So in Firefox the field shows two calendar buttons.
Controlled
onChange receives the value: YYYY-MM-DD, or '' when empty. It is the same whether the date was picked from the calendar or typed.
2026-09-25
Copy code
const [value, setValue] = useState('2026-09-25');
<DatePicker aria-label="Check-in" onChange={setValue} value={value} />Min and max
Copy code
<DatePicker
aria-label="Check-in"
defaultValue="2026-09-25"
max="2026-10-15"
min="2026-09-20"
/>Disabled
Copy code
<DatePicker aria-label="Check-in" defaultValue="2026-09-25" disabled />With @k8ordo/form
A date picked from the calendar is written into the input, and an input event fires. The form sees it just as if it had been typed, so dirty state, rules and clearing an error all work.
Copy code
// schema.ts
export const bookingSchema = z.object({ checkIn: z.iso.date() });
// booking-form.tsx
const checkIn = form.field('checkIn');
<FormControl
errorText={checkIn.error}
invalid={checkIn.invalid}
label="Check-in"
required={checkIn.required}
renderInput={(props) => <DatePicker {...props} {...checkIn.input} />}
/>Props
defaultValue?- Type:
string - Default: -
invalid?- Type:
boolean - Default:
false onChange?- Type:
(value: string) => void - Default: -
ref?- Type:
Ref<HTMLInputElement> - Default: -
value?- Type:
string - Default: -
| Prop | Type | Default |
|---|---|---|
defaultValue? | string | - |
invalid? | boolean | false |
onChange? | (value: string) => void | - |
ref? | Ref<HTMLInputElement> | - |
value? | string | - |
Inherited attributes (except the ones set internally): InputHTMLAttributes<HTMLInputElement>
The wording this component draws (labels, placeholders, and so on) comes from the message dictionary unless a prop sets it. To replace it, see: i18n