Home / File/ combobox-demo.tsx — ui Source File

combobox-demo.tsx — ui Source File

Architecture documentation for combobox-demo.tsx, a tsx file in the ui codebase. 6 imports, 0 dependents.

File tsx ComponentRegistry ChartRegistry 6 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  9249313b_1eca_cce6_1946_e62725545b1e["combobox-demo.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  9249313b_1eca_cce6_1946_e62725545b1e --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3["lucide-react"]
  9249313b_1eca_cce6_1946_e62725545b1e --> d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  9249313b_1eca_cce6_1946_e62725545b1e --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  57e86e45_ac6e_7278_be08_9092724e8401["button"]
  9249313b_1eca_cce6_1946_e62725545b1e --> 57e86e45_ac6e_7278_be08_9092724e8401
  ea5fe791_bf71_2e59_8da4_433dcd06ee7b["command"]
  9249313b_1eca_cce6_1946_e62725545b1e --> ea5fe791_bf71_2e59_8da4_433dcd06ee7b
  64a3481c_a85b_fe79_409a_cb7f3f4bb871["popover"]
  9249313b_1eca_cce6_1946_e62725545b1e --> 64a3481c_a85b_fe79_409a_cb7f3f4bb871
  style 9249313b_1eca_cce6_1946_e62725545b1e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import { Check, ChevronsUpDown } from "lucide-react"

import { cn } from "@/lib/utils"
import { Button } from "@/registry/new-york-v4/ui/button"
import {
  Command,
  CommandEmpty,
  CommandGroup,
  CommandInput,
  CommandItem,
  CommandList,
} from "@/registry/new-york-v4/ui/command"
import {
  Popover,
  PopoverContent,
  PopoverTrigger,
} from "@/registry/new-york-v4/ui/popover"

const frameworks = [
  {
    value: "next.js",
    label: "Next.js",
  },
  {
    value: "sveltekit",
    label: "SvelteKit",
  },
  {
    value: "nuxt.js",
    label: "Nuxt.js",
  },
  {
    value: "remix",
    label: "Remix",
  },
  {
    value: "astro",
    label: "Astro",
  },
]

export default function ComboboxDemo() {
  const [open, setOpen] = React.useState(false)
  const [value, setValue] = React.useState("")

  return (
    <Popover open={open} onOpenChange={setOpen}>
      <PopoverTrigger asChild>
        <Button
          variant="outline"
          role="combobox"
          aria-expanded={open}
          className="w-[200px] justify-between"
        >
          {value
            ? frameworks.find((framework) => framework.value === value)?.label
            : "Select framework..."}
          <ChevronsUpDown className="opacity-50" />
        </Button>
      </PopoverTrigger>
      <PopoverContent className="w-[200px] p-0">
        <Command>
          <CommandInput placeholder="Search framework..." className="h-9" />
          <CommandList>
            <CommandEmpty>No framework found.</CommandEmpty>
            <CommandGroup>
              {frameworks.map((framework) => (
                <CommandItem
                  key={framework.value}
                  value={framework.value}
                  onSelect={(currentValue) => {
                    setValue(currentValue === value ? "" : currentValue)
                    setOpen(false)
                  }}
                >
                  {framework.label}
                  <Check
                    className={cn(
                      "ml-auto",
                      value === framework.value ? "opacity-100" : "opacity-0"
                    )}
                  />
                </CommandItem>
              ))}
            </CommandGroup>
          </CommandList>
        </Command>
      </PopoverContent>
    </Popover>
  )
}

Subdomains

Functions

Dependencies

  • button
  • command
  • lucide-react
  • popover
  • react
  • utils

Frequently Asked Questions

What does combobox-demo.tsx do?
combobox-demo.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 combobox-demo.tsx?
combobox-demo.tsx defines 1 function(s): ComboboxDemo.
What does combobox-demo.tsx depend on?
combobox-demo.tsx imports 6 module(s): button, command, lucide-react, popover, react, utils.
Where is combobox-demo.tsx in the architecture?
combobox-demo.tsx is located at apps/v4/registry/new-york-v4/examples/combobox-demo.tsx (domain: ComponentRegistry, subdomain: ChartRegistry, directory: apps/v4/registry/new-york-v4/examples).

Analyze Your Own Codebase

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

Try Supermodel Free