DisplayForm() — ui Function Reference
Architecture documentation for the DisplayForm() function in display-form.tsx from the ui codebase.
Entity Profile
Dependency Diagram
graph TD e80adaa3_cbcd_1caf_898e_6c0d3fa415f8["DisplayForm()"] 1dce8e38_6e82_ba24_61e4_d678d129991b["display-form.tsx"] e80adaa3_cbcd_1caf_898e_6c0d3fa415f8 -->|defined in| 1dce8e38_6e82_ba24_61e4_d678d129991b style e80adaa3_cbcd_1caf_898e_6c0d3fa415f8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
deprecated/www/app/(app)/examples/forms/display/display-form.tsx lines 60–132
export function DisplayForm() {
const form = useForm<DisplayFormValues>({
resolver: zodResolver(displayFormSchema),
defaultValues,
})
function onSubmit(data: DisplayFormValues) {
toast({
title: "You submitted the following values:",
description: (
<pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
<code className="text-white">{JSON.stringify(data, null, 2)}</code>
</pre>
),
})
}
return (
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
<FormField
control={form.control}
name="items"
render={() => (
<FormItem>
<div className="mb-4">
<FormLabel className="text-base">Sidebar</FormLabel>
<FormDescription>
Select the items you want to display in the sidebar.
</FormDescription>
</div>
{items.map((item) => (
<FormField
key={item.id}
control={form.control}
name="items"
render={({ field }) => {
return (
<FormItem
key={item.id}
className="flex flex-row items-start space-x-3 space-y-0"
>
<FormControl>
<Checkbox
checked={field.value?.includes(item.id)}
onCheckedChange={(checked) => {
return checked
? field.onChange([...field.value, item.id])
: field.onChange(
field.value?.filter(
(value) => value !== item.id
)
)
}}
/>
</FormControl>
<FormLabel className="font-normal">
{item.label}
</FormLabel>
</FormItem>
)
}}
/>
))}
<FormMessage />
</FormItem>
)}
/>
<Button type="submit">Update display</Button>
</form>
</Form>
)
}
Domain
Subdomains
Source
Frequently Asked Questions
What does DisplayForm() do?
DisplayForm() is a function in the ui codebase, defined in deprecated/www/app/(app)/examples/forms/display/display-form.tsx.
Where is DisplayForm() defined?
DisplayForm() is defined in deprecated/www/app/(app)/examples/forms/display/display-form.tsx at line 60.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free