Home / File/ command-menu.tsx — ui Source File

command-menu.tsx — ui Source File

Architecture documentation for command-menu.tsx, a tsx file in the ui codebase. 9 imports, 0 dependents.

File tsx ComponentRegistry UIPrimitives 9 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  2ee73676_1587_6c8a_52a0_f472f7f4dadb["command-menu.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  2ee73676_1587_6c8a_52a0_f472f7f4dadb --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb["navigation"]
  2ee73676_1587_6c8a_52a0_f472f7f4dadb --> f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb
  ebff4254_a5ce_f52c_8b1c_5635efd1973d["react-dialog"]
  2ee73676_1587_6c8a_52a0_f472f7f4dadb --> ebff4254_a5ce_f52c_8b1c_5635efd1973d
  d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3["lucide-react"]
  2ee73676_1587_6c8a_52a0_f472f7f4dadb --> d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3
  75d25ec8_fe84_91a4_54c6_20dabb286f91["next-themes"]
  2ee73676_1587_6c8a_52a0_f472f7f4dadb --> 75d25ec8_fe84_91a4_54c6_20dabb286f91
  9416d7da_00df_60a8_615c_4b360d3b77f8["docs"]
  2ee73676_1587_6c8a_52a0_f472f7f4dadb --> 9416d7da_00df_60a8_615c_4b360d3b77f8
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  2ee73676_1587_6c8a_52a0_f472f7f4dadb --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  aa2f3ec6_f291_3763_88ec_65a3f5ad5939["button"]
  2ee73676_1587_6c8a_52a0_f472f7f4dadb --> aa2f3ec6_f291_3763_88ec_65a3f5ad5939
  64c05bed_da32_06a4_3b53_12b3830eb50b["command"]
  2ee73676_1587_6c8a_52a0_f472f7f4dadb --> 64c05bed_da32_06a4_3b53_12b3830eb50b
  style 2ee73676_1587_6c8a_52a0_f472f7f4dadb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import { useRouter } from "next/navigation"
import { type DialogProps } from "@radix-ui/react-dialog"
import { Circle, File, Laptop, Moon, Sun } from "lucide-react"
import { useTheme } from "next-themes"

import { docsConfig } from "@/config/docs"
import { cn } from "@/lib/utils"
import { Button } from "@/registry/new-york/ui/button"
import {
  CommandDialog,
  CommandEmpty,
  CommandGroup,
  CommandInput,
  CommandItem,
  CommandList,
  CommandSeparator,
} from "@/registry/new-york/ui/command"

export function CommandMenu({ ...props }: DialogProps) {
  const router = useRouter()
  const [open, setOpen] = React.useState(false)
  const { setTheme } = useTheme()

  React.useEffect(() => {
    const down = (e: KeyboardEvent) => {
      if ((e.key === "k" && (e.metaKey || e.ctrlKey)) || e.key === "/") {
        if (
          (e.target instanceof HTMLElement && e.target.isContentEditable) ||
          e.target instanceof HTMLInputElement ||
          e.target instanceof HTMLTextAreaElement ||
          e.target instanceof HTMLSelectElement
        ) {
          return
        }

        e.preventDefault()
        setOpen((open) => !open)
      }
    }

    document.addEventListener("keydown", down)
    return () => document.removeEventListener("keydown", down)
  }, [])

  const runCommand = React.useCallback((command: () => unknown) => {
    setOpen(false)
    command()
  }, [])

  return (
    <>
      <Button
        variant="outline"
        className={cn(
          "relative h-8 w-full justify-start rounded-[0.5rem] bg-muted/50 text-sm font-normal text-muted-foreground shadow-none sm:pr-12 md:w-40 lg:w-56 xl:w-64"
        )}
        onClick={() => setOpen(true)}
// ... (67 more lines)

Subdomains

Functions

Dependencies

  • button
  • command
  • docs
  • lucide-react
  • navigation
  • next-themes
  • react
  • react-dialog
  • utils

Frequently Asked Questions

What does command-menu.tsx do?
command-menu.tsx is a source file in the ui codebase, written in tsx. It belongs to the ComponentRegistry domain, UIPrimitives subdomain.
What functions are defined in command-menu.tsx?
command-menu.tsx defines 1 function(s): CommandMenu.
What does command-menu.tsx depend on?
command-menu.tsx imports 9 module(s): button, command, docs, lucide-react, navigation, next-themes, react, react-dialog, and 1 more.
Where is command-menu.tsx in the architecture?
command-menu.tsx is located at deprecated/www/components/command-menu.tsx (domain: ComponentRegistry, subdomain: UIPrimitives, directory: deprecated/www/components).

Analyze Your Own Codebase

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

Try Supermodel Free