Calendar
uiable/calendarFreeComponent
Calendar component.
Live preview
live · rendered by the registry
Rendered by uiable on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://uiable.com/r/calendar.jsonSource
1"use client";23import { ComponentProps, useEffect, useRef } from "react";45import {6 DayPicker,7 getDefaultClassNames,8 type DayButton,9 type Locale10} from "react-day-picker";1112import { cn } from "@/lib/utils";13import { Button, buttonVariants } from "@/components/ui/button";14import {15 ChevronLeftIcon,16 ChevronRightIcon,17 ChevronDownIcon18} from "lucide-react";1920function Calendar({21 className,22 classNames,23 showOutsideDays = true,24 captionLayout = "label",25 buttonVariant = "ghost",26 locale,27 formatters,28 components,29 ...props30}: ComponentProps<typeof DayPicker> & {31 buttonVariant?: ComponentProps<typeof Button>["variant"];32}) {33 const defaultClassNames = getDefaultClassNames();3435 return (36 <DayPicker37 showOutsideDays={showOutsideDays}38 className={cn(39 "bg-card group/calendar p-2 [--cell-radius:calc(var(--radius)+4px)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent",40 String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,41 String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,42 className43 )}44 captionLayout={captionLayout}45 locale={locale}46 formatters={{47 formatMonthDropdown: (date) =>48 date.toLocaleString(locale?.code, { month: "short" }),49 ...formatters50 }}51 classNames={{52 root: cn("w-fit", defaultClassNames.root),53 months: cn(54 "flex gap-4 flex-col md:flex-row relative",55 defaultClassNames.months56 ),57 month: cn("flex flex-col w-full gap-4", defaultClassNames.month),58 nav: cn(59 "flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",60 defaultClassNames.nav61 ),62 button_previous: cn(63 buttonVariants({ variant: buttonVariant }),64 "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",65 defaultClassNames.button_previous66 ),67 button_next: cn(68 buttonVariants({ variant: buttonVariant }),69 "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",70 defaultClassNames.button_next71 ),72 month_caption: cn(73 "flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",74 defaultClassNames.month_caption75 ),76 dropdowns: cn(77// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from uiable
All 712 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | uiable | Components | Free | 2 deps | |
| Alertalert | uiable | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | uiable | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | uiable | Components | Free | no deps | |
| Attachmentattachment | uiable | Components | Free | 2 deps | |
| Avataravatar | uiable | Components | Free | 1 dep | |
| Badgebadge | uiable | Components | Free | 2 deps | |
| Breadcrumbbreadcrumb | uiable | Components | Free | 2 deps |
