Home / Function/ CheckboxReactHookFormSingle() — ui Function Reference

CheckboxReactHookFormSingle() — ui Function Reference

Architecture documentation for the CheckboxReactHookFormSingle() function in checkbox-form-single.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  31a4c519_c7a2_223b_6cf9_e9723788820d["CheckboxReactHookFormSingle()"]
  6c90799c_841d_83e6_9937_a0f8cb1870a6["checkbox-form-single.tsx"]
  31a4c519_c7a2_223b_6cf9_e9723788820d -->|defined in| 6c90799c_841d_83e6_9937_a0f8cb1870a6
  style 31a4c519_c7a2_223b_6cf9_e9723788820d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

deprecated/www/registry/default/examples/checkbox-form-single.tsx lines 24–73

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">
              <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>
  )
}

Subdomains

Frequently Asked Questions

What does CheckboxReactHookFormSingle() do?
CheckboxReactHookFormSingle() is a function in the ui codebase, defined in deprecated/www/registry/default/examples/checkbox-form-single.tsx.
Where is CheckboxReactHookFormSingle() defined?
CheckboxReactHookFormSingle() is defined in deprecated/www/registry/default/examples/checkbox-form-single.tsx at line 24.

Analyze Your Own Codebase

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

Try Supermodel Free