FormDemo() — ui Function Reference
Architecture documentation for the FormDemo() function in form-demo.tsx from the ui codebase.
Entity Profile
Dependency Diagram
graph TD c091bab8_9403_ea22_44b7_d881c715376f["FormDemo()"] ad895872_0b65_ec90_967d_07da41fe7e95["form-demo.tsx"] c091bab8_9403_ea22_44b7_d881c715376f -->|defined in| ad895872_0b65_ec90_967d_07da41fe7e95 style c091bab8_9403_ea22_44b7_d881c715376f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/v4/app/(internal)/sink/components/form-demo.tsx lines 101–399
export function FormDemo() {
const form = useForm<z.infer<typeof FormSchema>>({
resolver: zodResolver(FormSchema),
defaultValues: {
username: "",
items: ["recents", "home"],
},
})
function onSubmit(data: z.infer<typeof FormSchema>) {
toast("You submitted the following values:", {
description: (
<pre className="mt-2 w-[320px] rounded-md bg-neutral-950 p-4">
<code className="text-white">{JSON.stringify(data, null, 2)}</code>
</pre>
),
})
}
return (
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className="grid w-full max-w-sm gap-6"
>
<FormField
control={form.control}
name="username"
render={({ field }) => (
<FormItem>
<FormLabel>Username</FormLabel>
<FormControl>
<Input placeholder="shadcn" {...field} />
</FormControl>
<FormDescription>
This is your public display name.
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="email"
render={({ field }) => (
<FormItem>
<FormLabel>Email</FormLabel>
<Select onValueChange={field.onChange} defaultValue={field.value}>
<FormControl>
<SelectTrigger>
<SelectValue placeholder="Select a verified email to display" />
</SelectTrigger>
</FormControl>
<SelectContent>
<SelectItem value="m@example.com">m@example.com</SelectItem>
<SelectItem value="m@google.com">m@google.com</SelectItem>
<SelectItem value="m@support.com">m@support.com</SelectItem>
</SelectContent>
</Select>
<FormDescription>
You can manage email addresses in your email settings.
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="bio"
render={({ field }) => (
<FormItem>
<FormLabel>Bio</FormLabel>
<FormControl>
<Textarea
placeholder="Tell us a little bit about yourself"
className="resize-none"
{...field}
/>
</FormControl>
<FormDescription>
You can <span>@mention</span> other users and organizations.
Domain
Subdomains
Source
Frequently Asked Questions
What does FormDemo() do?
FormDemo() is a function in the ui codebase, defined in apps/v4/app/(internal)/sink/components/form-demo.tsx.
Where is FormDemo() defined?
FormDemo() is defined in apps/v4/app/(internal)/sink/components/form-demo.tsx at line 101.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free