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
  8258220b_6595_eaa7_d689_b981a71ace0e["combobox-popover.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  8258220b_6595_eaa7_d689_b981a71ace0e --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  aa2f3ec6_f291_3763_88ec_65a3f5ad5939["button"]
  8258220b_6595_eaa7_d689_b981a71ace0e --> aa2f3ec6_f291_3763_88ec_65a3f5ad5939
  64c05bed_da32_06a4_3b53_12b3830eb50b["command"]
  8258220b_6595_eaa7_d689_b981a71ace0e --> 64c05bed_da32_06a4_3b53_12b3830eb50b
  e33b0d79_0534_28ec_a112_ac16ee736e09["popover"]
  8258220b_6595_eaa7_d689_b981a71ace0e --> e33b0d79_0534_28ec_a112_ac16ee736e09
  style 8258220b_6595_eaa7_d689_b981a71ace0e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"

import { Button } from "@/registry/new-york/ui/button"
import {
  Command,
  CommandEmpty,
  CommandGroup,
  CommandInput,
  CommandItem,
  CommandList,
} from "@/registry/new-york/ui/command"
import {
  Popover,
  PopoverContent,
  PopoverTrigger,
} from "@/registry/new-york/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-sm text-muted-foreground">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 deprecated/www/registry/new-york/examples/combobox-popover.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