{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "radio-group-form", "type": "registry:example", "author": "shadcn (https://ui.shadcn.com)", "registryDependencies": [ "radio-group", "form" ], "files": [ { "path": "examples/radio-group-form.tsx", "content": "\"use client\"\n\nimport { zodResolver } from \"@hookform/resolvers/zod\"\nimport { useForm } from \"react-hook-form\"\nimport { z } from \"zod\"\n\nimport { toast } from \"@/registry/default/hooks/use-toast\"\nimport { Button } from \"@/registry/default/ui/button\"\nimport {\n Form,\n FormControl,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from \"@/registry/default/ui/form\"\nimport { RadioGroup, RadioGroupItem } from \"@/registry/default/ui/radio-group\"\n\nconst FormSchema = z.object({\n type: z.enum([\"all\", \"mentions\", \"none\"], {\n required_error: \"You need to select a notification type.\",\n }),\n})\n\nexport default function RadioGroupForm() {\n const form = useForm>({\n resolver: zodResolver(FormSchema),\n })\n\n function onSubmit(data: z.infer) {\n toast({\n title: \"You submitted the following values:\",\n description: (\n
\n          {JSON.stringify(data, null, 2)}\n        
\n ),\n })\n }\n\n return (\n
\n \n (\n \n Notify me about...\n \n \n \n \n \n \n \n All new messages\n \n \n \n \n \n \n \n Direct messages and mentions\n \n \n \n \n \n \n Nothing\n \n \n \n \n \n )}\n />\n \n \n \n )\n}\n", "type": "registry:example", "target": "" } ] }