FormRhfInput() — ui Function Reference
Architecture documentation for the FormRhfInput() function in form-rhf-input.tsx from the ui codebase.
Entity Profile
Dependency Diagram
graph TD aa2e0935_08fb_f80f_2b57_3d4fdf5addf3["FormRhfInput()"] cf21a8b6_02d7_77d9_ce53_9929f75a997d["form-rhf-input.tsx"] aa2e0935_08fb_f80f_2b57_3d4fdf5addf3 -->|defined in| cf21a8b6_02d7_77d9_ce53_9929f75a997d style aa2e0935_08fb_f80f_2b57_3d4fdf5addf3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/v4/registry/new-york-v4/examples/form-rhf-input.tsx lines 37–114
export default function FormRhfInput() {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
username: "",
},
})
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>Profile Settings</CardTitle>
<CardDescription>
Update your profile information below.
</CardDescription>
</CardHeader>
<CardContent>
<form id="form-rhf-input" onSubmit={form.handleSubmit(onSubmit)}>
<FieldGroup>
<Controller
name="username"
control={form.control}
render={({ field, fieldState }) => (
<Field data-invalid={fieldState.invalid}>
<FieldLabel htmlFor="form-rhf-input-username">
Username
</FieldLabel>
<Input
{...field}
id="form-rhf-input-username"
aria-invalid={fieldState.invalid}
placeholder="shadcn"
autoComplete="username"
/>
<FieldDescription>
This is your public display name. Must be between 3 and 10
characters. Must only contain letters, numbers, and
underscores.
</FieldDescription>
{fieldState.invalid && (
<FieldError errors={[fieldState.error]} />
)}
</Field>
)}
/>
</FieldGroup>
</form>
</CardContent>
<CardFooter>
<Field orientation="horizontal">
<Button type="button" variant="outline" onClick={() => form.reset()}>
Reset
</Button>
<Button type="submit" form="form-rhf-input">
Save
</Button>
</Field>
</CardFooter>
</Card>
)
}
Domain
Subdomains
Source
Frequently Asked Questions
What does FormRhfInput() do?
FormRhfInput() is a function in the ui codebase, defined in apps/v4/registry/new-york-v4/examples/form-rhf-input.tsx.
Where is FormRhfInput() defined?
FormRhfInput() is defined in apps/v4/registry/new-york-v4/examples/form-rhf-input.tsx at line 37.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free