FormRhfRadioGroup() — ui Function Reference
Architecture documentation for the FormRhfRadioGroup() function in form-rhf-radiogroup.tsx from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 0e0441e4_fdb2_6d5c_74a8_848d3f578f65["FormRhfRadioGroup()"] c6ed155c_34b0_735c_9a68_b734c0059cad["form-rhf-radiogroup.tsx"] 0e0441e4_fdb2_6d5c_74a8_848d3f578f65 -->|defined in| c6ed155c_34b0_735c_9a68_b734c0059cad style 0e0441e4_fdb2_6d5c_74a8_848d3f578f65 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/v4/registry/new-york-v4/examples/form-rhf-radiogroup.tsx lines 56–152
export default function FormRhfRadioGroup() {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
plan: "",
},
})
function onSubmit(data: z.infer<typeof formSchema>) {
toast("You submitted the following values:", {
description: (
<pre className="bg-code text-code-foreground mt-2 w-[320px] overflow-x-auto rounded-md p-4">
<code>{JSON.stringify(data, null, 2)}</code>
</pre>
),
position: "bottom-right",
classNames: {
content: "flex flex-col gap-2",
},
style: {
"--border-radius": "calc(var(--radius) + 4px)",
} as React.CSSProperties,
})
}
return (
<Card className="w-full sm:max-w-md">
<CardHeader>
<CardTitle>Subscription Plan</CardTitle>
<CardDescription>
See pricing and features for each plan.
</CardDescription>
</CardHeader>
<CardContent>
<form id="form-rhf-radiogroup" onSubmit={form.handleSubmit(onSubmit)}>
<FieldGroup>
<Controller
name="plan"
control={form.control}
render={({ field, fieldState }) => (
<FieldSet data-invalid={fieldState.invalid}>
<FieldLegend>Plan</FieldLegend>
<FieldDescription>
You can upgrade or downgrade your plan at any time.
</FieldDescription>
<RadioGroup
name={field.name}
value={field.value}
onValueChange={field.onChange}
aria-invalid={fieldState.invalid}
>
{plans.map((plan) => (
<FieldLabel
key={plan.id}
htmlFor={`form-rhf-radiogroup-${plan.id}`}
>
<Field
orientation="horizontal"
data-invalid={fieldState.invalid}
>
<FieldContent>
<FieldTitle>{plan.title}</FieldTitle>
<FieldDescription>
{plan.description}
</FieldDescription>
</FieldContent>
<RadioGroupItem
value={plan.id}
id={`form-rhf-radiogroup-${plan.id}`}
aria-invalid={fieldState.invalid}
/>
</Field>
</FieldLabel>
))}
</RadioGroup>
{fieldState.invalid && (
<FieldError errors={[fieldState.error]} />
)}
</FieldSet>
)}
/>
Domain
Subdomains
Source
Frequently Asked Questions
What does FormRhfRadioGroup() do?
FormRhfRadioGroup() is a function in the ui codebase, defined in apps/v4/registry/new-york-v4/examples/form-rhf-radiogroup.tsx.
Where is FormRhfRadioGroup() defined?
FormRhfRadioGroup() is defined in apps/v4/registry/new-york-v4/examples/form-rhf-radiogroup.tsx at line 56.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free