checkbox-form-single.tsx — ui Source File
Architecture documentation for checkbox-form-single.tsx, a tsx file in the ui codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR b979fe27_5368_2446_6f6f_98476ed91cc3["checkbox-form-single.tsx"] ba3d44f3_7b34_f9cc_6283_44817785c0df["link"] b979fe27_5368_2446_6f6f_98476ed91cc3 --> ba3d44f3_7b34_f9cc_6283_44817785c0df 3d40a3bf_c062_4304_329a_00b1b72e8523["zod"] b979fe27_5368_2446_6f6f_98476ed91cc3 --> 3d40a3bf_c062_4304_329a_00b1b72e8523 6d65354d_8f59_2cfc_4783_24b2eb870bc4["react-hook-form"] b979fe27_5368_2446_6f6f_98476ed91cc3 --> 6d65354d_8f59_2cfc_4783_24b2eb870bc4 6802ce19_522d_e5fb_e458_8826d9f6952e["zod"] b979fe27_5368_2446_6f6f_98476ed91cc3 --> 6802ce19_522d_e5fb_e458_8826d9f6952e 64d95022_f8e1_3e94_bb97_22b3ebca757e["use-toast"] b979fe27_5368_2446_6f6f_98476ed91cc3 --> 64d95022_f8e1_3e94_bb97_22b3ebca757e aa2f3ec6_f291_3763_88ec_65a3f5ad5939["button"] b979fe27_5368_2446_6f6f_98476ed91cc3 --> aa2f3ec6_f291_3763_88ec_65a3f5ad5939 fe882581_4266_6b26_b40f_462b3a19ebd0["checkbox"] b979fe27_5368_2446_6f6f_98476ed91cc3 --> fe882581_4266_6b26_b40f_462b3a19ebd0 7a6b0be4_eca5_4970_1a93_79d670ef529e["form"] b979fe27_5368_2446_6f6f_98476ed91cc3 --> 7a6b0be4_eca5_4970_1a93_79d670ef529e style b979fe27_5368_2446_6f6f_98476ed91cc3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"use client"
import Link from "next/link"
import { zodResolver } from "@hookform/resolvers/zod"
import { useForm } from "react-hook-form"
import { z } from "zod"
import { toast } from "@/registry/new-york/hooks/use-toast"
import { Button } from "@/registry/new-york/ui/button"
import { Checkbox } from "@/registry/new-york/ui/checkbox"
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
} from "@/registry/new-york/ui/form"
const FormSchema = z.object({
mobile: z.boolean().default(false).optional(),
})
export default function CheckboxReactHookFormSingle() {
const form = useForm<z.infer<typeof FormSchema>>({
resolver: zodResolver(FormSchema),
defaultValues: {
mobile: true,
},
})
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-6">
<FormField
control={form.control}
name="mobile"
render={({ field }) => (
<FormItem className="flex flex-row items-start space-x-3 space-y-0 rounded-md border p-4 shadow">
<FormControl>
<Checkbox
checked={field.value}
onCheckedChange={field.onChange}
/>
</FormControl>
<div className="space-y-1 leading-none">
<FormLabel>
Use different settings for my mobile devices
</FormLabel>
<FormDescription>
You can manage your mobile notifications in the{" "}
<Link href="/examples/forms">mobile settings</Link> page.
</FormDescription>
</div>
</FormItem>
)}
/>
<Button type="submit">Submit</Button>
</form>
</Form>
)
}
Domain
Subdomains
Functions
Dependencies
- button
- checkbox
- form
- link
- react-hook-form
- use-toast
- zod
- zod
Source
Frequently Asked Questions
What does checkbox-form-single.tsx do?
checkbox-form-single.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 checkbox-form-single.tsx?
checkbox-form-single.tsx defines 1 function(s): CheckboxReactHookFormSingle.
What does checkbox-form-single.tsx depend on?
checkbox-form-single.tsx imports 8 module(s): button, checkbox, form, link, react-hook-form, use-toast, zod, zod.
Where is checkbox-form-single.tsx in the architecture?
checkbox-form-single.tsx is located at deprecated/www/registry/new-york/examples/checkbox-form-single.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