Components
Loading preview...
Calendar [React Day Picker]
npx shadcn@latest add https://21st.dev/r/originui/calendar"use client";
import { Calendar } from "@/components/ui/calendar";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Clock } from "lucide-react";
import { useId, useState } from "react";
function Component() {
const id = useId();
const [date, setDate] = useState<Date | undefined>(new Date());
return (
<div>
<div className="rounded-lg border border-border">
<Calendar mode="single" className="p-2 bg-background" selected={date} onSelect={setDate} />
<div className="border-t border-border p-3">
<div className="flex items-center gap-3">
<Label htmlFor={id} className="text-xs">
Enter time
</Label>
<div className="relative grow">
<Input
id={id}
type="time"
step="1"
defaultValue="12:00:00"
className="peer ps-9 [&::-webkit-calendar-picker-indicator]:hidden"
/>
<div className="pointer-events-none absolute inset-y-0 start-0 flex items-center justify-center ps-3 text-muted-foreground/80 peer-disabled:opacity-50">
<Clock size={16} strokeWidth={2} aria-hidden="true" />
</div>
</div>
</div>
</div>
</div>
<p
className="mt-4 text-center text-xs text-muted-foreground"
role="region"
aria-live="polite"
>
Time input -{" "}
<a
className="underline hover:text-foreground"
href="https://daypicker.dev/"
target="_blank"
rel="noopener nofollow"
>
React DayPicker
</a>
</p>
</div>
);
}
export { Component };