Home / File/ select-form.tsx — ui Source File

select-form.tsx — ui Source File

Architecture documentation for select-form.tsx, a tsx file in the ui codebase. 8 imports, 0 dependents.

File tsx ComponentRegistry ChartRegistry 8 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  4d471315_ed70_2a06_ba7b_7158ae7473cb["select-form.tsx"]
  ba3d44f3_7b34_f9cc_6283_44817785c0df["link"]
  4d471315_ed70_2a06_ba7b_7158ae7473cb --> ba3d44f3_7b34_f9cc_6283_44817785c0df
  3d40a3bf_c062_4304_329a_00b1b72e8523["zod"]
  4d471315_ed70_2a06_ba7b_7158ae7473cb --> 3d40a3bf_c062_4304_329a_00b1b72e8523
  6d65354d_8f59_2cfc_4783_24b2eb870bc4["react-hook-form"]
  4d471315_ed70_2a06_ba7b_7158ae7473cb --> 6d65354d_8f59_2cfc_4783_24b2eb870bc4
  6802ce19_522d_e5fb_e458_8826d9f6952e["zod"]
  4d471315_ed70_2a06_ba7b_7158ae7473cb --> 6802ce19_522d_e5fb_e458_8826d9f6952e
  64d95022_f8e1_3e94_bb97_22b3ebca757e["use-toast"]
  4d471315_ed70_2a06_ba7b_7158ae7473cb --> 64d95022_f8e1_3e94_bb97_22b3ebca757e
  aa2f3ec6_f291_3763_88ec_65a3f5ad5939["button"]
  4d471315_ed70_2a06_ba7b_7158ae7473cb --> aa2f3ec6_f291_3763_88ec_65a3f5ad5939
  7a6b0be4_eca5_4970_1a93_79d670ef529e["form"]
  4d471315_ed70_2a06_ba7b_7158ae7473cb --> 7a6b0be4_eca5_4970_1a93_79d670ef529e
  d493776b_8734_5d8d_382d_0f77f309a72b["select"]
  4d471315_ed70_2a06_ba7b_7158ae7473cb --> d493776b_8734_5d8d_382d_0f77f309a72b
  style 4d471315_ed70_2a06_ba7b_7158ae7473cb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import Link from "next/link"
import { zodResolver } from "@hookform/resolvers/zod"
import { useForm } from "react-hook-form"
import { z } from "zod"

import { toast } from "@/registry/new-york/hooks/use-toast"
import { Button } from "@/registry/new-york/ui/button"
import {
  Form,
  FormControl,
  FormDescription,
  FormField,
  FormItem,
  FormLabel,
  FormMessage,
} from "@/registry/new-york/ui/form"
import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from "@/registry/new-york/ui/select"

const FormSchema = z.object({
  email: z
    .string({
      required_error: "Please select an email to display.",
    })
    .email(),
})

export default function SelectForm() {
  const form = useForm<z.infer<typeof FormSchema>>({
    resolver: zodResolver(FormSchema),
  })

  function onSubmit(data: z.infer<typeof FormSchema>) {
    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="w-2/3 space-y-6">
        <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{" "}
                <Link href="/examples/forms">email settings</Link>.
              </FormDescription>
              <FormMessage />
            </FormItem>
          )}
        />
        <Button type="submit">Submit</Button>
      </form>
    </Form>
  )
}

Subdomains

Functions

Dependencies

  • button
  • form
  • link
  • react-hook-form
  • select
  • use-toast
  • zod
  • zod

Frequently Asked Questions

What does select-form.tsx do?
select-form.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 select-form.tsx?
select-form.tsx defines 1 function(s): SelectForm.
What does select-form.tsx depend on?
select-form.tsx imports 8 module(s): button, form, link, react-hook-form, select, use-toast, zod, zod.
Where is select-form.tsx in the architecture?
select-form.tsx is located at deprecated/www/registry/new-york/examples/select-form.tsx (domain: ComponentRegistry, subdomain: ChartRegistry, directory: deprecated/www/registry/new-york/examples).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free