BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/sidcn/date-time-input

Date Time Input

sidcn/date-time-input
FreeComponent

A beautiful date time input component (form compatible)

Live preview

live · rendered by the registry
Rendered by sidcn on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://ui.siddhesh.cc/r/date-time-input.json

Source

registry/new-york/components/date-time-input.tsxui.siddhesh.cc/r/date-time-input.json
1"use client";
2
3import { format } from "date-fns";
4import { CalendarIcon } from "lucide-react";
5import React from "react";
6import { Calendar } from "@/components/ui/calendar";
7import { Input } from "@/components/ui/input";
8import {
9 Popover,
10 PopoverContent,
11 PopoverTrigger,
12} from "@/components/ui/popover";
13import { cn } from "@/lib/utils";
14import { Button } from "@/registry/new-york/components/button";
15
16interface DateTimeInputProps {
17 value?: Date;
18 onChange?: (date: Date) => void;
19 disabled?: boolean;
20 name?: string;
21 className?: string;
22}
23
24function DateTimeInput({
25 value,
26 onChange,
27 disabled = false,
28 name,
29 className,
30}: DateTimeInputProps) {
31 const [open, setOpen] = React.useState(false);
32 const [selectedDate, setSelectedDate] = React.useState<Date | undefined>(
33 value,
34 );
35 const [timeValue, setTimeValue] = React.useState(() => {
36 if (value) {
37 const hours = value.getHours().toString().padStart(2, "0");
38 const minutes = value.getMinutes().toString().padStart(2, "0");
39 return `${hours}:${minutes}`;
40 }
41 return "12:00";
42 });
43
44 const handleDateSelect = (date: Date | undefined) => {
45 if (date) {
46 const [hours, minutes] = timeValue.split(":").map(Number);
47 const newDateTime = new Date(date);
48 newDateTime.setHours(hours, minutes, 0, 0);
49 setSelectedDate(newDateTime);
50 onChange?.(newDateTime);
51 }
52 setOpen(false);
53 };
54
55 const handleTimeChange = (time: string) => {
56 setTimeValue(time);
57 if (selectedDate) {
58 const [hours, minutes] = time.split(":").map(Number);
59 const newDateTime = new Date(selectedDate);
60 newDateTime.setHours(hours, minutes, 0, 0);
61 setSelectedDate(newDateTime);
62 onChange?.(newDateTime);
63 }
64 };
65
66 return (
67 <div className={cn("space-y-2", className)}>
68 <div className="flex gap-2">
69 <Popover open={open} onOpenChange={setOpen}>
70 <PopoverTrigger asChild>
71 <Button
72 id={name}
73 variant="outline"
74 className={cn(
75 "flex-1 justify-start text-left font-normal",
76 !selectedDate && "text-muted-foreground",
77 )}
78 disabled={disabled}
79 >
80 <CalendarIcon className="mr-2 h-4 w-4" />
81 {selectedDate ? format(selectedDate, "PPP") : "Pick a date"}
82 </Button>
83 </PopoverTrigger>
84 <PopoverContent className="w-auto p-0" align="start">
85 <Calendar
86// … truncated

What it pulls in

npm packages

  • date-fns
  • lucide-react

Other registry items

  • https://ui.siddhesh.cc/r/button.json
  • calendar
  • input
  • popover

Files it writes

  • registry/new-york/components/date-time-input.tsx

Facts

Registry
sidcn
Type
registry:ui
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-01
Last confirmed
today

Go to the source

Docs on sidcn ui.siddhesh.cc Siddhesh-Agarwal/sid-cn on GitHub Raw registry item This item as JSON

More from sidcn

All 14 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
BadgebadgesidcnComponentsFree3 deps
ButtonbuttonsidcnComponentsFree2 deps
Data Tabledata-tablesidcnComponentsFree2 deps
Date Inputdate-inputsidcnComponentsFree1 dep
IconsiconssidcnComponentsFreeno deps
Package Manager Commandpackage-manager-commandsidcnComponentsFreeno deps
SidebarsidebarsidcnComponentsFree3 deps
SonnersonnersidcnComponentsFree2 deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex