Home / Function/ CalendarDateRangePicker() — ui Function Reference

CalendarDateRangePicker() — ui Function Reference

Architecture documentation for the CalendarDateRangePicker() function in date-range-picker.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  50e2b54d_1b7c_cfe6_10dc_65af1993c7d3["CalendarDateRangePicker()"]
  99dce298_83a0_3c97_3c3e_8ee344ed6f05["date-range-picker.tsx"]
  50e2b54d_1b7c_cfe6_10dc_65af1993c7d3 -->|defined in| 99dce298_83a0_3c97_3c3e_8ee344ed6f05
  style 50e2b54d_1b7c_cfe6_10dc_65af1993c7d3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

deprecated/www/app/(app)/examples/dashboard/components/date-range-picker.tsx lines 17–65

export function CalendarDateRangePicker({
  className,
}: React.HTMLAttributes<HTMLDivElement>) {
  const [date, setDate] = React.useState<DateRange | undefined>({
    from: new Date(2023, 0, 20),
    to: addDays(new Date(2023, 0, 20), 20),
  })

  return (
    <div className={cn("grid gap-2", className)}>
      <Popover>
        <PopoverTrigger asChild>
          <Button
            id="date"
            variant={"outline"}
            className={cn(
              "w-[260px] justify-start text-left font-normal",
              !date && "text-muted-foreground"
            )}
          >
            <CalendarIcon className="mr-2 h-4 w-4" />
            {date?.from ? (
              date.to ? (
                <>
                  {format(date.from, "LLL dd, y")} -{" "}
                  {format(date.to, "LLL dd, y")}
                </>
              ) : (
                format(date.from, "LLL dd, y")
              )
            ) : (
              <span>Pick a date</span>
            )}
          </Button>
        </PopoverTrigger>
        <PopoverContent className="w-auto p-0" align="end">
          <Calendar
            initialFocus
            mode="range"
            defaultMonth={date?.from}
            selected={date}
            onSelect={setDate}
            numberOfMonths={2}
          />
        </PopoverContent>
      </Popover>
    </div>
  )
}

Subdomains

Frequently Asked Questions

What does CalendarDateRangePicker() do?
CalendarDateRangePicker() is a function in the ui codebase, defined in deprecated/www/app/(app)/examples/dashboard/components/date-range-picker.tsx.
Where is CalendarDateRangePicker() defined?
CalendarDateRangePicker() is defined in deprecated/www/app/(app)/examples/dashboard/components/date-range-picker.tsx at line 17.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free