CalendarForm() — supabase Function Reference
Architecture documentation for the CalendarForm() function in calendar-form.tsx from the supabase codebase.
Entity Profile
Relationship Graph
Source Code
apps/design-system/registry/default/example/calendar-form.tsx lines 32–93
export default function CalendarForm() {
const form = useForm<z.infer<typeof FormSchema>>({
resolver: zodResolver(FormSchema),
})
function onSubmit(data: z.infer<typeof FormSchema>) {
toast('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_Shadcn_ {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
<FormField_Shadcn_
control={form.control}
name="dob"
render={({ field }) => (
<FormItem_Shadcn_ className="flex flex-col">
<FormLabel_Shadcn_>Date of birth</FormLabel_Shadcn_>
<Popover_Shadcn_>
<PopoverTrigger_Shadcn_ asChild>
<FormControl_Shadcn_>
<Button
type={'default'}
size="small"
className={cn(
'w-[240px] justify-start',
!field.value && 'text-muted-foreground'
)}
icon={<CalendarIcon className="ml-auto opacity-50" />}
>
{field.value ? format(field.value, 'PPP') : <span>Pick a date</span>}
</Button>
</FormControl_Shadcn_>
</PopoverTrigger_Shadcn_>
<PopoverContent_Shadcn_ className="w-auto p-0" align="start" side="right">
<Calendar
mode="single"
selected={field.value}
onSelect={field.onChange}
disabled={(date) => date > new Date() || date < new Date('1900-01-01')}
initialFocus
/>
</PopoverContent_Shadcn_>
</Popover_Shadcn_>
<FormDescription_Shadcn_>
Your date of birth is used to calculate your age.
</FormDescription_Shadcn_>
<FormMessage_Shadcn_ />
</FormItem_Shadcn_>
)}
/>
<Button htmlType="submit">Submit</Button>
</form>
</Form_Shadcn_>
)
}
Domain
Subdomains
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free