Skip to content
Klarhimmel UI

Date picker

npx shadcn add @klarhimmel/date-picker @klarhimmel/input

Examples

  • Basic

  • Preselected

  • Limits

  • Invalid, with an error message

  • Disabled

  • Form

DetailsAbout, usage, props and more

A date field you can type or pick: the text takes ISO or day-first, the button opens the calendar in a dialog.

When to use

  • Use for

    A date in a form: arrival, departure, a birthday, a due date.

  • Not for

    A time of day or a range in one control. Use two Date pickers.

  • Pairs with

    Field, Calendar, Button.

Preview

Type 2026-11-16 or 16/11/2026, or press the calendar button.

No date yet.

date-picker.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { DatePicker } from '@/components/klarhimmel/ui/date-picker';
import { Field } from '@/components/klarhimmel/ui/input';

export default function Example() {
  return (
    <Theme theme="brand">
      <Field label="Arrival">
        {(p) => <DatePicker {...p} defaultValue="2026-11-20" today="2026-11-16" />}
      </Field>
    </Theme>
  );
}

Import

Import

import { DatePicker } from '@/components/klarhimmel/ui/date-picker';
Files
date-picker.tsx, input.tsx, in components/klarhimmel/ui/. With it: button, calendar, editing, input-group and 3 more. npm: lucide-react.
Render in
Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.
Limit
Overlays render into the Theme root with position: fixed. A transform on an ancestor re-parents fixed (a dialog centres in the wrapper) and overflow: hidden clips menus. Render <Theme> at the app root, outside any transformed wrapper.

Props

PropTypeDefaultDescription
valuestring-The chosen day, "YYYY-MM-DD", or "" for none.
defaultValuestring''The day as 'YYYY-MM-DD'; '' means none. Typed text is read on Enter and when leaving the field.
onValueChange(value: string) => void-The day as 'YYYY-MM-DD'; '' means none. Typed text is read on Enter and when leaving the field.
namestring-Submits the chosen day, as "YYYY-MM-DD", with a form (a hidden input).
idstring-
placeholderstring'YYYY-MM-DD'Shown while the field is empty.
disabledboolean-Error styling; switches it off. Unreadable text is marked invalid on its own.
invalidboolean-Error styling; switches it off. Unreadable text is marked invalid on its own.
aria-labelstring-Needed when no Field or <label htmlFor> names it.
aria-labelledbystring-Needed when no Field or <label htmlFor> names it.
aria-describedbystring-
labels{ open: string; panel: string; previous: string; next: string; today: string;…-Words for the button, the panel, the calendar's buttons and the two messages. Pass them translated.
classNamestring-Extra classes, merged after the component's own.
minstring-The earliest and latest day that can be chosen. Other days are shown but cannot be picked.
maxstring-Days that cannot be chosen. Typing one is marked and explained in words.
isDisabled(iso: string) => boolean-Days that cannot be chosen. Typing one is marked and explained in words.
todaystring-Today, "YYYY-MM-DD". Marked with a ring and the word. Never read from the clock here, so it renders the same on the server.
firstDay'mon' | 'sun'-Passed to the calendar.
localestring-Passed to the calendar.

Accessibility

KeyDoes
Type2026-11-16 or day first, 16/11/2026
Enter / leaving the fieldReads the text; wrong text is marked and explained
Alt+Down on the fieldOpens the calendar
Enter / Space on the buttonOpens the calendar on the chosen day
EscapeCloses it and returns focus to the button
Arrow keys, Page Up / DownMove within the calendar (see Calendar)

The WAI-ARIA date picker dialog. Choosing a day closes it and puts the ISO text in the field. A form gets the day as YYYY-MM-DD.

Accessibility