form-rhf-textarea.tsx — ui Source File
Architecture documentation for form-rhf-textarea.tsx, a tsx file in the ui codebase. 9 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 73f7e05d_b6b4_cac6_b093_8894de7e20f5["form-rhf-textarea.tsx"] 1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"] 73f7e05d_b6b4_cac6_b093_8894de7e20f5 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2 3d40a3bf_c062_4304_329a_00b1b72e8523["zod"] 73f7e05d_b6b4_cac6_b093_8894de7e20f5 --> 3d40a3bf_c062_4304_329a_00b1b72e8523 6d65354d_8f59_2cfc_4783_24b2eb870bc4["react-hook-form"] 73f7e05d_b6b4_cac6_b093_8894de7e20f5 --> 6d65354d_8f59_2cfc_4783_24b2eb870bc4 e750d152_1191_1793_7244_99c7f9c595f4["sonner"] 73f7e05d_b6b4_cac6_b093_8894de7e20f5 --> e750d152_1191_1793_7244_99c7f9c595f4 6802ce19_522d_e5fb_e458_8826d9f6952e["zod"] 73f7e05d_b6b4_cac6_b093_8894de7e20f5 --> 6802ce19_522d_e5fb_e458_8826d9f6952e 57e86e45_ac6e_7278_be08_9092724e8401["button"] 73f7e05d_b6b4_cac6_b093_8894de7e20f5 --> 57e86e45_ac6e_7278_be08_9092724e8401 c6d6139d_ea69_3d79_5004_68419bae2ac0["card"] 73f7e05d_b6b4_cac6_b093_8894de7e20f5 --> c6d6139d_ea69_3d79_5004_68419bae2ac0 169af77a_46c3_8fec_4801_f34a0f1a3471["field"] 73f7e05d_b6b4_cac6_b093_8894de7e20f5 --> 169af77a_46c3_8fec_4801_f34a0f1a3471 a1802a9d_1c52_7ef5_709a_134c4400c1c3["textarea"] 73f7e05d_b6b4_cac6_b093_8894de7e20f5 --> a1802a9d_1c52_7ef5_709a_134c4400c1c3 style 73f7e05d_b6b4_cac6_b093_8894de7e20f5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"use client"
import * as React from "react"
import { zodResolver } from "@hookform/resolvers/zod"
import { Controller, useForm } from "react-hook-form"
import { toast } from "sonner"
import * as z from "zod"
import { Button } from "@/registry/new-york-v4/ui/button"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/registry/new-york-v4/ui/card"
import {
Field,
FieldDescription,
FieldError,
FieldGroup,
FieldLabel,
} from "@/registry/new-york-v4/ui/field"
import { Textarea } from "@/registry/new-york-v4/ui/textarea"
const formSchema = z.object({
about: z
.string()
.min(10, "Please provide at least 10 characters.")
.max(200, "Please keep it under 200 characters."),
})
export default function FormRhfTextarea() {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
about: "",
},
})
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>Personalization</CardTitle>
<CardDescription>
Customize your experience by telling us more about yourself.
</CardDescription>
</CardHeader>
<CardContent>
<form id="form-rhf-textarea" onSubmit={form.handleSubmit(onSubmit)}>
<FieldGroup>
<Controller
name="about"
control={form.control}
render={({ field, fieldState }) => (
<Field data-invalid={fieldState.invalid}>
<FieldLabel htmlFor="form-rhf-textarea-about">
More about you
</FieldLabel>
<Textarea
{...field}
id="form-rhf-textarea-about"
aria-invalid={fieldState.invalid}
placeholder="I'm a software engineer..."
className="min-h-[120px]"
/>
<FieldDescription>
Tell us more about yourself. This will be used to help us
personalize your experience.
</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-textarea">
Save
</Button>
</Field>
</CardFooter>
</Card>
)
}
Domain
Subdomains
Functions
Dependencies
- button
- card
- field
- react
- react-hook-form
- sonner
- textarea
- zod
- zod
Source
Frequently Asked Questions
What does form-rhf-textarea.tsx do?
form-rhf-textarea.tsx is a source file in the ui codebase, written in tsx. It belongs to the ComponentRegistry domain, ChartRegistry subdomain.
What functions are defined in form-rhf-textarea.tsx?
form-rhf-textarea.tsx defines 1 function(s): FormRhfTextarea.
What does form-rhf-textarea.tsx depend on?
form-rhf-textarea.tsx imports 9 module(s): button, card, field, react, react-hook-form, sonner, textarea, zod, and 1 more.
Where is form-rhf-textarea.tsx in the architecture?
form-rhf-textarea.tsx is located at apps/v4/registry/new-york-v4/examples/form-rhf-textarea.tsx (domain: ComponentRegistry, subdomain: ChartRegistry, directory: apps/v4/registry/new-york-v4/examples).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free