Home / Function/ ComboboxForm() — ui Function Reference

ComboboxForm() — ui Function Reference

Architecture documentation for the ComboboxForm() function in combobox-form.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  b5b02a71_7fb4_65cc_dec1_a1bb27fef57c["ComboboxForm()"]
  dfbbd46c_2934_a6bf_9966_795e56a39933["combobox-form.tsx"]
  b5b02a71_7fb4_65cc_dec1_a1bb27fef57c -->|defined in| dfbbd46c_2934_a6bf_9966_795e56a39933
  style b5b02a71_7fb4_65cc_dec1_a1bb27fef57c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

deprecated/www/registry/default/examples/combobox-form.tsx lines 52–138

export default function ComboboxForm() {
  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="space-y-6">
        <FormField
          control={form.control}
          name="language"
          render={({ field }) => (
            <FormItem className="flex flex-col">
              <FormLabel>Language</FormLabel>
              <Popover>
                <PopoverTrigger asChild>
                  <FormControl>
                    <Button
                      variant="outline"
                      role="combobox"
                      className={cn(
                        "w-[200px] justify-between",
                        !field.value && "text-muted-foreground"
                      )}
                    >
                      {field.value
                        ? languages.find(
                            (language) => language.value === field.value
                          )?.label
                        : "Select language"}
                      <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
                    </Button>
                  </FormControl>
                </PopoverTrigger>
                <PopoverContent className="w-[200px] p-0">
                  <Command>
                    <CommandInput placeholder="Search language..." />
                    <CommandList>
                      <CommandEmpty>No language found.</CommandEmpty>
                      <CommandGroup>
                        {languages.map((language) => (
                          <CommandItem
                            value={language.label}
                            key={language.value}
                            onSelect={() => {
                              form.setValue("language", language.value)
                            }}
                          >
                            {language.label}
                            <Check
                              className={cn(
                                "ml-auto",
                                language.value === field.value
                                  ? "opacity-100"
                                  : "opacity-0"
                              )}
                            />
                          </CommandItem>
                        ))}
                      </CommandGroup>
                    </CommandList>
                  </Command>
                </PopoverContent>
              </Popover>
              <FormDescription>
                This is the language that will be used in the dashboard.
              </FormDescription>
              <FormMessage />
            </FormItem>
          )}

Subdomains

Frequently Asked Questions

What does ComboboxForm() do?
ComboboxForm() is a function in the ui codebase, defined in deprecated/www/registry/default/examples/combobox-form.tsx.
Where is ComboboxForm() defined?
ComboboxForm() is defined in deprecated/www/registry/default/examples/combobox-form.tsx at line 52.

Analyze Your Own Codebase

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

Try Supermodel Free