Home / Function/ RadioGroupForm() — ui Function Reference

RadioGroupForm() — ui Function Reference

Architecture documentation for the RadioGroupForm() function in radio-group-form.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  ecbaa04d_55c4_297e_8905_6ab8b07c8ccb["RadioGroupForm()"]
  45041995_803a_a7f0_adee_e2b20b8c7025["radio-group-form.tsx"]
  ecbaa04d_55c4_297e_8905_6ab8b07c8ccb -->|defined in| 45041995_803a_a7f0_adee_e2b20b8c7025
  style ecbaa04d_55c4_297e_8905_6ab8b07c8ccb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

deprecated/www/registry/default/examples/radio-group-form.tsx lines 25–88

export default function RadioGroupForm() {
  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="w-2/3 space-y-6">
        <FormField
          control={form.control}
          name="type"
          render={({ field }) => (
            <FormItem className="space-y-3">
              <FormLabel>Notify me about...</FormLabel>
              <FormControl>
                <RadioGroup
                  onValueChange={field.onChange}
                  defaultValue={field.value}
                  className="flex flex-col space-y-1"
                >
                  <FormItem className="flex items-center space-x-3 space-y-0">
                    <FormControl>
                      <RadioGroupItem value="all" />
                    </FormControl>
                    <FormLabel className="font-normal">
                      All new messages
                    </FormLabel>
                  </FormItem>
                  <FormItem className="flex items-center space-x-3 space-y-0">
                    <FormControl>
                      <RadioGroupItem value="mentions" />
                    </FormControl>
                    <FormLabel className="font-normal">
                      Direct messages and mentions
                    </FormLabel>
                  </FormItem>
                  <FormItem className="flex items-center space-x-3 space-y-0">
                    <FormControl>
                      <RadioGroupItem value="none" />
                    </FormControl>
                    <FormLabel className="font-normal">Nothing</FormLabel>
                  </FormItem>
                </RadioGroup>
              </FormControl>
              <FormMessage />
            </FormItem>
          )}
        />
        <Button type="submit">Submit</Button>
      </form>
    </Form>
  )
}

Subdomains

Frequently Asked Questions

What does RadioGroupForm() do?
RadioGroupForm() is a function in the ui codebase, defined in deprecated/www/registry/default/examples/radio-group-form.tsx.
Where is RadioGroupForm() defined?
RadioGroupForm() is defined in deprecated/www/registry/default/examples/radio-group-form.tsx at line 25.

Analyze Your Own Codebase

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

Try Supermodel Free