Home / File/ sidebar-nav.tsx — ui Source File

sidebar-nav.tsx — ui Source File

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

File tsx ComponentRegistry UIPrimitives 4 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  4991b21a_7620_d5b8_e2fb_243a71be7282["sidebar-nav.tsx"]
  ba3d44f3_7b34_f9cc_6283_44817785c0df["link"]
  4991b21a_7620_d5b8_e2fb_243a71be7282 --> ba3d44f3_7b34_f9cc_6283_44817785c0df
  f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb["navigation"]
  4991b21a_7620_d5b8_e2fb_243a71be7282 --> f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  4991b21a_7620_d5b8_e2fb_243a71be7282 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  aa2f3ec6_f291_3763_88ec_65a3f5ad5939["button"]
  4991b21a_7620_d5b8_e2fb_243a71be7282 --> aa2f3ec6_f291_3763_88ec_65a3f5ad5939
  style 4991b21a_7620_d5b8_e2fb_243a71be7282 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import Link from "next/link"
import { usePathname } from "next/navigation"

import { cn } from "@/lib/utils"
import { buttonVariants } from "@/registry/new-york/ui/button"

interface SidebarNavProps extends React.HTMLAttributes<HTMLElement> {
  items: {
    href: string
    title: string
  }[]
}

export function SidebarNav({ className, items, ...props }: SidebarNavProps) {
  const pathname = usePathname()

  return (
    <nav
      className={cn(
        "flex space-x-2 lg:flex-col lg:space-x-0 lg:space-y-1",
        className
      )}
      {...props}
    >
      {items.map((item) => (
        <Link
          key={item.href}
          href={item.href}
          className={cn(
            buttonVariants({ variant: "ghost" }),
            pathname === item.href
              ? "bg-muted hover:bg-muted"
              : "hover:bg-transparent hover:underline",
            "justify-start"
          )}
        >
          {item.title}
        </Link>
      ))}
    </nav>
  )
}

Subdomains

Functions

Dependencies

  • button
  • link
  • navigation
  • utils

Frequently Asked Questions

What does sidebar-nav.tsx do?
sidebar-nav.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 sidebar-nav.tsx?
sidebar-nav.tsx defines 1 function(s): SidebarNav.
What does sidebar-nav.tsx depend on?
sidebar-nav.tsx imports 4 module(s): button, link, navigation, utils.
Where is sidebar-nav.tsx in the architecture?
sidebar-nav.tsx is located at deprecated/www/app/(app)/examples/forms/components/sidebar-nav.tsx (domain: ComponentRegistry, subdomain: UIPrimitives, directory: deprecated/www/app/(app)/examples/forms/components).

Analyze Your Own Codebase

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

Try Supermodel Free