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

combobox-popover.tsx — ui Source File

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

File tsx ComponentRegistry ChartRegistry 4 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  fb8d4fe2_1311_2441_d1d8_08eff53b6816["combobox-popover.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  fb8d4fe2_1311_2441_d1d8_08eff53b6816 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  57e86e45_ac6e_7278_be08_9092724e8401["button"]
  fb8d4fe2_1311_2441_d1d8_08eff53b6816 --> 57e86e45_ac6e_7278_be08_9092724e8401
  ea5fe791_bf71_2e59_8da4_433dcd06ee7b["command"]
  fb8d4fe2_1311_2441_d1d8_08eff53b6816 --> ea5fe791_bf71_2e59_8da4_433dcd06ee7b
  64a3481c_a85b_fe79_409a_cb7f3f4bb871["popover"]
  fb8d4fe2_1311_2441_d1d8_08eff53b6816 --> 64a3481c_a85b_fe79_409a_cb7f3f4bb871
  style fb8d4fe2_1311_2441_d1d8_08eff53b6816 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"

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"

type Status = {
  value: string
  label: string
}

const statuses: Status[] = [
  {
    value: "backlog",
    label: "Backlog",
  },
  {
    value: "todo",
    label: "Todo",
  },
  {
    value: "in progress",
    label: "In Progress",
  },
  {
    value: "done",
    label: "Done",
  },
  {
    value: "canceled",
    label: "Canceled",
  },
]

export default function ComboboxPopover() {
  const [open, setOpen] = React.useState(false)
  const [selectedStatus, setSelectedStatus] = React.useState<Status | null>(
    null
  )

  return (
    <div className="flex items-center space-x-4">
      <p className="text-muted-foreground text-sm">Status</p>
      <Popover open={open} onOpenChange={setOpen}>
        <PopoverTrigger asChild>
          <Button variant="outline" className="w-[150px] justify-start">
            {selectedStatus ? <>{selectedStatus.label}</> : <>+ Set status</>}
          </Button>
        </PopoverTrigger>
        <PopoverContent className="p-0" side="right" align="start">
          <Command>
            <CommandInput placeholder="Change status..." />
            <CommandList>
              <CommandEmpty>No results found.</CommandEmpty>
              <CommandGroup>
                {statuses.map((status) => (
                  <CommandItem
                    key={status.value}
                    value={status.value}
                    onSelect={(value) => {
                      setSelectedStatus(
                        statuses.find((priority) => priority.value === value) ||
                          null
                      )
                      setOpen(false)
                    }}
                  >
                    {status.label}
                  </CommandItem>
                ))}
              </CommandGroup>
            </CommandList>
          </Command>
        </PopoverContent>
      </Popover>
    </div>
  )
}

Subdomains

Functions

Types

Dependencies

  • button
  • command
  • popover
  • react

Frequently Asked Questions

What does combobox-popover.tsx do?
combobox-popover.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-popover.tsx?
combobox-popover.tsx defines 1 function(s): ComboboxPopover.
What does combobox-popover.tsx depend on?
combobox-popover.tsx imports 4 module(s): button, command, popover, react.
Where is combobox-popover.tsx in the architecture?
combobox-popover.tsx is located at apps/v4/registry/new-york-v4/examples/combobox-popover.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