"use client" import { zodResolver } from "@hookform/resolvers/zod" import { Check, ChevronsUpDown } from "lucide-react" import { useForm } from "react-hook-form" import * as z from "zod" import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, } from "@/components/ui/command" import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover" import { toast } from "@/components/ui/use-toast" import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, } from "@/components/react-hook-form/form" const languages = [ { label: "English", value: "en" }, { label: "French", value: "fr" }, { label: "German", value: "de" }, { label: "Spanish", value: "es" }, { label: "Portuguese", value: "pt" }, { label: "Russian", value: "ru" }, { label: "Japanese", value: "ja" }, { label: "Korean", value: "ko" }, { label: "Chinese", value: "zh" }, ] as const const FormSchema = z.object({ language: z.string({ required_error: "Please select a language.", }), }) export function ComboboxReactHookForm() { const form = useForm>({ resolver: zodResolver(FormSchema), }) function onSubmit(data: z.infer) { toast({ title: "You submitted the following values:", description: (
          {JSON.stringify(data, null, 2)}
        
), }) } return (
( Language No framework found. {languages.map((language) => ( { form.setValue("language", value) }} > {language.label} ))} This is the language that will be used in the dashboard. )} /> ) }