calendar-presets.tsx — ui Source File
Architecture documentation for calendar-presets.tsx, a tsx file in the ui codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 92d2efdf_d940_a734_a276_5b4b268d08b2["calendar-presets.tsx"] 1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"] 92d2efdf_d940_a734_a276_5b4b268d08b2 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2 4544fa74_9b37_0912_c55e_f4ff161b8e83["button"] 92d2efdf_d940_a734_a276_5b4b268d08b2 --> 4544fa74_9b37_0912_c55e_f4ff161b8e83 a8023de3_411c_8d95_59e9_37549a0c2d75["calendar"] 92d2efdf_d940_a734_a276_5b4b268d08b2 --> a8023de3_411c_8d95_59e9_37549a0c2d75 a66f2388_87f1_5188_51e6_9a4b91cfd618["card"] 92d2efdf_d940_a734_a276_5b4b268d08b2 --> a66f2388_87f1_5188_51e6_9a4b91cfd618 f9e8c1ea_9de4_3e04_ca27_b15cada2e81e["date-fns"] 92d2efdf_d940_a734_a276_5b4b268d08b2 --> f9e8c1ea_9de4_3e04_ca27_b15cada2e81e style 92d2efdf_d940_a734_a276_5b4b268d08b2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"use client"
import * as React from "react"
import { Button } from "@/examples/base/ui/button"
import { Calendar } from "@/examples/base/ui/calendar"
import { Card, CardContent, CardFooter } from "@/examples/base/ui/card"
import { addDays } from "date-fns"
export function CalendarWithPresets() {
const [date, setDate] = React.useState<Date | undefined>(
new Date(new Date().getFullYear(), 1, 12)
)
const [currentMonth, setCurrentMonth] = React.useState<Date>(
new Date(new Date().getFullYear(), new Date().getMonth(), 1)
)
return (
<Card className="mx-auto w-fit max-w-[300px]" size="sm">
<CardContent>
<Calendar
mode="single"
selected={date}
onSelect={setDate}
month={currentMonth}
onMonthChange={setCurrentMonth}
fixedWeeks
className="p-0 [--cell-size:--spacing(9.5)]"
/>
</CardContent>
<CardFooter className="flex flex-wrap gap-2 border-t">
{[
{ label: "Today", value: 0 },
{ label: "Tomorrow", value: 1 },
{ label: "In 3 days", value: 3 },
{ label: "In a week", value: 7 },
{ label: "In 2 weeks", value: 14 },
].map((preset) => (
<Button
key={preset.value}
variant="outline"
size="sm"
className="flex-1"
onClick={() => {
const newDate = addDays(new Date(), preset.value)
setDate(newDate)
setCurrentMonth(
new Date(newDate.getFullYear(), newDate.getMonth(), 1)
)
}}
>
{preset.label}
</Button>
))}
</CardFooter>
</Card>
)
}
Domain
Subdomains
Functions
Dependencies
- button
- calendar
- card
- date-fns
- react
Source
Frequently Asked Questions
What does calendar-presets.tsx do?
calendar-presets.tsx is a source file in the ui codebase, written in tsx. It belongs to the DocumentationAtlas domain, Changelog subdomain.
What functions are defined in calendar-presets.tsx?
calendar-presets.tsx defines 1 function(s): CalendarWithPresets.
What does calendar-presets.tsx depend on?
calendar-presets.tsx imports 5 module(s): button, calendar, card, date-fns, react.
Where is calendar-presets.tsx in the architecture?
calendar-presets.tsx is located at apps/v4/examples/base/calendar-presets.tsx (domain: DocumentationAtlas, subdomain: Changelog, directory: apps/v4/examples/base).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free