Date Time Picker
shadcn-htmx/date-time-pickerFreeComponent
Native <input type="date|time|datetime-local|month|week"> family styled like Input, with min/max/step constraints and normalized machine-readable values. The browser supplies the calendar/clock picker, segment editing, locale-aware display and constraint validation — no JS calendar library. Ships in five flavours.
Live preview
live · rendered by the registry
Rendered by shadcn-htmx on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://shadcn-htmx.productdevbook.com/r/date-time-picker.jsonSource
1/** @jsxImportSource hono/jsx */2import { cn, type ClassValue } from "@/registry/lib/cn"34// Date Time Picker — shadcn-htmx, htmx v4 + Tailwind v4.5//6// A family of native temporal fields. The control IS a real7// <input type="date|time|datetime-local|month|week"> — there is no JS calendar8// library and no userland popup. The browser ships the picker UI, the keyboard9// editing of each segment, locale-aware display, and constraint validation; we10// only restyle to match the rest of the form controls.11//12// Per MDN every variant normalises its submitted value to a fixed,13// machine-readable, locale-independent format regardless of how it is shown:14// - date → "yyyy-mm-dd" step is days (default 1)15// - time → "HH:mm" / "HH:mm:ss" step is seconds (default 60);16// min/max have a *periodic domain* (may cross midnight)17// - datetime-local → "yyyy-mm-ddTHH:mm" (a local date + time, no zone)18// - month → "YYYY-MM"19// - week → "yyyy-Www" (ISO 8601 week number)20//21// Sources read for this component:22// repos/mdn/files/en-us/web/html/reference/elements/input/date/index.md23// repos/mdn/files/en-us/web/html/reference/elements/input/time/index.md24// repos/mdn/files/en-us/web/html/reference/elements/input/datetime-local/index.md25// repos/mdn/files/en-us/web/html/reference/elements/input/month/index.md26// repos/mdn/files/en-us/web/html/reference/elements/input/week/index.md27// htmx attrs verified against repos/htmx/www/reference.md28// Style analogue: registry/ui/input.tsx (same base + tokens, kept in sync).2930export type DateTimeType = "date" | "time" | "datetime-local" | "month" | "week"3132// Shared <Input> base — kept byte-for-byte in sync with registry/ui/input.tsx33// so a temporal field looks identical to every other control. We append rules34// to tame the engine-specific picker affordances:35// - the calendar/clock indicator inherits the foreground colour and shows a36// pointer cursor (it is the only chrome the browser exposes to CSS);37// - the inner spin/edit fields drop their padding so the value sits flush.38const base =39 "flex h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none " +40 "selection:bg-primary selection:text-primary-foreground " +41 "placeholder:text-muted-foreground " +42// … truncated
More from shadcn-htmx
All 83 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | shadcn-htmx | Components | Free | no deps | |
| Active Searchactive-search | shadcn-htmx | Components | Free | no deps | |
| Alertalert | shadcn-htmx | Components | Free | no deps | |
| Alert Dialogalert-dialog | shadcn-htmx | Components | Free | no deps | |
| Aspect Ratioaspect-ratio | shadcn-htmx | Components | Free | no deps | |
| Auto Gridauto-grid | shadcn-htmx | Components | Free | no deps | |
| Autocompleteautocomplete | shadcn-htmx | Components | Free | no deps | |
| Autosize Textareaautosize-textarea | shadcn-htmx | Components | Free | no deps |
