date-picker-form.tsx — ui Source File
Architecture documentation for date-picker-form.tsx, a tsx file in the ui codebase. 11 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 97dd71bf_8ba4_3142_07d9_6d906a225cab["date-picker-form.tsx"] 3d40a3bf_c062_4304_329a_00b1b72e8523["zod"] 97dd71bf_8ba4_3142_07d9_6d906a225cab --> 3d40a3bf_c062_4304_329a_00b1b72e8523 f9e8c1ea_9de4_3e04_ca27_b15cada2e81e["date-fns"] 97dd71bf_8ba4_3142_07d9_6d906a225cab --> f9e8c1ea_9de4_3e04_ca27_b15cada2e81e d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3["lucide-react"] 97dd71bf_8ba4_3142_07d9_6d906a225cab --> d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3 6d65354d_8f59_2cfc_4783_24b2eb870bc4["react-hook-form"] 97dd71bf_8ba4_3142_07d9_6d906a225cab --> 6d65354d_8f59_2cfc_4783_24b2eb870bc4 6802ce19_522d_e5fb_e458_8826d9f6952e["zod"] 97dd71bf_8ba4_3142_07d9_6d906a225cab --> 6802ce19_522d_e5fb_e458_8826d9f6952e 79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"] 97dd71bf_8ba4_3142_07d9_6d906a225cab --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81 64d95022_f8e1_3e94_bb97_22b3ebca757e["use-toast"] 97dd71bf_8ba4_3142_07d9_6d906a225cab --> 64d95022_f8e1_3e94_bb97_22b3ebca757e aa2f3ec6_f291_3763_88ec_65a3f5ad5939["button"] 97dd71bf_8ba4_3142_07d9_6d906a225cab --> aa2f3ec6_f291_3763_88ec_65a3f5ad5939 5000e233_363d_e409_8b5c_7e80d38646fe["calendar"] 97dd71bf_8ba4_3142_07d9_6d906a225cab --> 5000e233_363d_e409_8b5c_7e80d38646fe 7a6b0be4_eca5_4970_1a93_79d670ef529e["form"] 97dd71bf_8ba4_3142_07d9_6d906a225cab --> 7a6b0be4_eca5_4970_1a93_79d670ef529e e33b0d79_0534_28ec_a112_ac16ee736e09["popover"] 97dd71bf_8ba4_3142_07d9_6d906a225cab --> e33b0d79_0534_28ec_a112_ac16ee736e09 style 97dd71bf_8ba4_3142_07d9_6d906a225cab fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"use client"
import { zodResolver } from "@hookform/resolvers/zod"
import { format } from "date-fns"
import { CalendarIcon } from "lucide-react"
import { useForm } from "react-hook-form"
import { z } from "zod"
import { cn } from "@/lib/utils"
import { toast } from "@/registry/new-york/hooks/use-toast"
import { Button } from "@/registry/new-york/ui/button"
import { Calendar } from "@/registry/new-york/ui/calendar"
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
FormMessage,
} from "@/registry/new-york/ui/form"
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/registry/new-york/ui/popover"
const FormSchema = z.object({
dob: z.date({
required_error: "A date of birth is required.",
}),
})
export default function DatePickerForm() {
const form = useForm<z.infer<typeof FormSchema>>({
resolver: zodResolver(FormSchema),
})
function onSubmit(data: z.infer<typeof FormSchema>) {
toast({
title: "You submitted the following values:",
description: (
<pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
<code className="text-white">{JSON.stringify(data, null, 2)}</code>
</pre>
),
})
}
return (
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
<FormField
control={form.control}
name="dob"
render={({ field }) => (
<FormItem className="flex flex-col">
<FormLabel>Date of birth</FormLabel>
<Popover>
<PopoverTrigger asChild>
<FormControl>
<Button
variant={"outline"}
className={cn(
"w-[240px] pl-3 text-left font-normal",
!field.value && "text-muted-foreground"
)}
>
{field.value ? (
format(field.value, "PPP")
) : (
<span>Pick a date</span>
)}
<CalendarIcon className="ml-auto h-4 w-4 opacity-50" />
</Button>
</FormControl>
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
<Calendar
mode="single"
selected={field.value}
onSelect={field.onChange}
disabled={(date) =>
date > new Date() || date < new Date("1900-01-01")
}
initialFocus
/>
</PopoverContent>
</Popover>
<FormDescription>
Your date of birth is used to calculate your age.
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
<Button type="submit">Submit</Button>
</form>
</Form>
)
}
Domain
Subdomains
Functions
Dependencies
- button
- calendar
- date-fns
- form
- lucide-react
- popover
- react-hook-form
- use-toast
- utils
- zod
- zod
Source
Frequently Asked Questions
What does date-picker-form.tsx do?
date-picker-form.tsx is a source file in the ui codebase, written in tsx. It belongs to the ComponentRegistry domain, ChartRegistry subdomain.
What functions are defined in date-picker-form.tsx?
date-picker-form.tsx defines 1 function(s): DatePickerForm.
What does date-picker-form.tsx depend on?
date-picker-form.tsx imports 11 module(s): button, calendar, date-fns, form, lucide-react, popover, react-hook-form, use-toast, and 3 more.
Where is date-picker-form.tsx in the architecture?
date-picker-form.tsx is located at deprecated/www/registry/new-york/examples/date-picker-form.tsx (domain: ComponentRegistry, subdomain: ChartRegistry, directory: deprecated/www/registry/new-york/examples).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free