Home / Function/ RadioGroupForm() — supabase Function Reference

RadioGroupForm() — supabase Function Reference

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

Entity Profile

Relationship Graph

Source Code

apps/design-system/registry/default/example/radio-group-form.tsx lines 25–85

export default function RadioGroupForm() {
  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="w-2/3 space-y-6">
        <FormField_Shadcn_
          control={form.control}
          name="type"
          render={({ field }) => (
            <FormItem_Shadcn_ className="space-y-3">
              <FormLabel_Shadcn_>Notify me about...</FormLabel_Shadcn_>
              <FormControl_Shadcn_>
                <RadioGroup_Shadcn_
                  onValueChange={field.onChange}
                  defaultValue={field.value}
                  className="flex flex-col space-y-1"
                >
                  <FormItem_Shadcn_ className="flex items-center space-x-3 space-y-0">
                    <FormControl_Shadcn_>
                      <RadioGroupItem_Shadcn_ value="all" />
                    </FormControl_Shadcn_>
                    <FormLabel_Shadcn_ className="font-normal">All new messages</FormLabel_Shadcn_>
                  </FormItem_Shadcn_>
                  <FormItem_Shadcn_ className="flex items-center space-x-3 space-y-0">
                    <FormControl_Shadcn_>
                      <RadioGroupItem_Shadcn_ value="mentions" />
                    </FormControl_Shadcn_>
                    <FormLabel_Shadcn_ className="font-normal">
                      Direct messages and mentions
                    </FormLabel_Shadcn_>
                  </FormItem_Shadcn_>
                  <FormItem_Shadcn_ className="flex items-center space-x-3 space-y-0">
                    <FormControl_Shadcn_>
                      <RadioGroupItem_Shadcn_ value="none" />
                    </FormControl_Shadcn_>
                    <FormLabel_Shadcn_ className="font-normal">Nothing</FormLabel_Shadcn_>
                  </FormItem_Shadcn_>
                </RadioGroup_Shadcn_>
              </FormControl_Shadcn_>
              <FormMessage_Shadcn_ />
            </FormItem_Shadcn_>
          )}
        />
        <Button htmlType="submit">Submit</Button>
      </form>
    </Form_Shadcn_>
  )
}

Domain

Subdomains

Analyze Your Own Codebase

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

Try Supermodel Free