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 { addDays, subDays } from "date-fns";
import { useState } from "react";
function Component() {
const today = new Date();
const [date, setDate] = useState<Date[] | undefined>([
subDays(today, 17),
addDays(today, 2),
addDays(today, 6),
addDays(today, 8),
]);
return (
<div>
<Calendar
mode="multiple"
selected={date}
onSelect={setDate}
className="rounded-lg border border-border p-2 bg-background"
/>
<p
className="mt-4 text-center text-xs text-muted-foreground"
role="region"
aria-live="polite"
>
Multiple day selection -{" "}
<a
className="underline hover:text-foreground"
href="https://daypicker.dev/"
target="_blank"
rel="noopener nofollow"
>
React DayPicker
</a>
</p>
</div>
);
}
export { Component };