{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"shadcn-studio/form-01","type":"registry:component","title":"Form 1","description":"Form with radio group selection and alert notifications for user feedback","dependencies":["@hookform/resolvers","lucide-react","react-hook-form","sonner","zod@3.25.76"],"registryDependencies":["alert","button","field","radio-group"],"files":[{"path":"src/registry/new-york/components/form/form-01.tsx","content":"'use client'\n\nimport * as React from 'react'\n\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { Controller, useForm } from 'react-hook-form'\nimport { toast } from 'sonner'\nimport * as z from 'zod'\n\nimport { CheckCheckIcon } from 'lucide-react'\n\nimport { Alert, AlertTitle } from '@/registry/new-york/ui/alert'\nimport { Button } from '@/registry/new-york/ui/button'\nimport { Field, FieldDescription, FieldError, FieldLabel, FieldLegend, FieldSet } from '@/registry/new-york/ui/field'\nimport { RadioGroup, RadioGroupItem } from '@/registry/new-york/ui/radio-group'\n\n// Define the form schema\nconst formSchema = z.object({\n  selectedOption: z.enum(['share-data', 'do-not-share', 'customize'], {\n    required_error: 'You must select an option.'\n  })\n})\n\ntype FormValues = z.infer<typeof formSchema>\n\nconst RadioGroupFormDemo = () => {\n  const form = useForm<FormValues>({\n    resolver: zodResolver(formSchema),\n    defaultValues: {\n      selectedOption: undefined\n    }\n  })\n\n  function onSubmit(data: z.infer<typeof formSchema>) {\n    toast.custom(() => (\n      <Alert className='border-green-600 text-green-600 dark:border-green-400 dark:text-green-400'>\n        <CheckCheckIcon />\n        <AlertTitle>Selected Option: {data.selectedOption}</AlertTitle>\n      </Alert>\n    ))\n  }\n\n  return (\n    <form onSubmit={form.handleSubmit(onSubmit)} className='w-full max-w-xs space-y-6'>\n      <Controller\n        name='selectedOption'\n        control={form.control}\n        render={({ field, fieldState }) => (\n          <FieldSet>\n            <FieldLegend variant='label' className='mb-4'>\n              Manage data sharing preferences\n            </FieldLegend>\n            <RadioGroup name={field.name} value={field.value} onValueChange={field.onChange} className='mb-3'>\n              <Field orientation='horizontal' data-invalid={fieldState.invalid}>\n                <RadioGroupItem value='share-data' id='share-option' aria-invalid={fieldState.invalid} />\n                <FieldLabel htmlFor='share-option' className='font-normal'>\n                  Share Data for Personalized Experience\n                </FieldLabel>\n              </Field>\n              <Field orientation='horizontal' data-invalid={fieldState.invalid}>\n                <RadioGroupItem value='do-not-share' id='no-share-option' aria-invalid={fieldState.invalid} />\n                <FieldLabel htmlFor='no-share-option' className='font-normal'>\n                  Do Not Share Any Data\n                </FieldLabel>\n              </Field>\n              <Field orientation='horizontal' data-invalid={fieldState.invalid}>\n                <RadioGroupItem value='customize' id='customize-option' aria-invalid={fieldState.invalid} />\n                <FieldLabel htmlFor='customize-option' className='font-normal'>\n                  Customize Data Sharing Preferences\n                </FieldLabel>\n              </Field>\n            </RadioGroup>\n            <FieldDescription className='mt-0'>Please select one of the options to proceed.</FieldDescription>\n            {fieldState.invalid && <FieldError errors={[fieldState.error]} />}\n          </FieldSet>\n        )}\n      />\n      <Button type='submit'>Update Preferences</Button>\n    </form>\n  )\n}\n\nexport default RadioGroupFormDemo\n","type":"registry:component","target":"components/shadcn-studio/form/form-01.tsx"}]}