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

nav-user.tsx — ui Source File

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

Entity Profile

Dependency Diagram

graph LR
  7a3a5317_10a1_3cbb_5406_e532242ba0c5["nav-user.tsx"]
  39a0d62e_8e7d_d097_eb95_91d2bca361f7["icons-react"]
  7a3a5317_10a1_3cbb_5406_e532242ba0c5 --> 39a0d62e_8e7d_d097_eb95_91d2bca361f7
  550576ca_32fe_8288_72d6_10281189833b["avatar"]
  7a3a5317_10a1_3cbb_5406_e532242ba0c5 --> 550576ca_32fe_8288_72d6_10281189833b
  d1cb37f2_0d1d_01bc_0d60_a15219afac51["dropdown-menu"]
  7a3a5317_10a1_3cbb_5406_e532242ba0c5 --> d1cb37f2_0d1d_01bc_0d60_a15219afac51
  12632a83_ef01_5f03_4110_ed33d49893b7["sidebar"]
  7a3a5317_10a1_3cbb_5406_e532242ba0c5 --> 12632a83_ef01_5f03_4110_ed33d49893b7
  style 7a3a5317_10a1_3cbb_5406_e532242ba0c5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import {
  IconCreditCard,
  IconDotsVertical,
  IconLogout,
  IconNotification,
  IconUserCircle,
} from "@tabler/icons-react"

import {
  Avatar,
  AvatarFallback,
  AvatarImage,
} from "@/registry/new-york-v4/ui/avatar"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuGroup,
  DropdownMenuItem,
  DropdownMenuLabel,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@/registry/new-york-v4/ui/dropdown-menu"
import {
  SidebarMenu,
  SidebarMenuButton,
  SidebarMenuItem,
  useSidebar,
} from "@/registry/new-york-v4/ui/sidebar"

export function NavUser({
  user,
}: {
  user: {
    name: string
    email: string
    avatar: string
  }
}) {
  const { isMobile } = useSidebar()

  return (
    <SidebarMenu>
      <SidebarMenuItem>
        <DropdownMenu>
          <DropdownMenuTrigger asChild>
            <SidebarMenuButton
              size="lg"
              className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
            >
              <Avatar className="h-8 w-8 rounded-lg grayscale">
                <AvatarImage src={user.avatar} alt={user.name} />
                <AvatarFallback className="rounded-lg">CN</AvatarFallback>
              </Avatar>
              <div className="grid flex-1 text-left text-sm leading-tight">
                <span className="truncate font-medium">{user.name}</span>
                <span className="text-muted-foreground truncate text-xs">
                  {user.email}
                </span>
              </div>
              <IconDotsVertical className="ml-auto size-4" />
            </SidebarMenuButton>
          </DropdownMenuTrigger>
          <DropdownMenuContent
            className="w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg"
            side={isMobile ? "bottom" : "right"}
            align="end"
            sideOffset={4}
          >
            <DropdownMenuLabel className="p-0 font-normal">
              <div className="flex items-center gap-2 px-1 py-1.5 text-left text-sm">
                <Avatar className="h-8 w-8 rounded-lg">
                  <AvatarImage src={user.avatar} alt={user.name} />
                  <AvatarFallback className="rounded-lg">CN</AvatarFallback>
                </Avatar>
                <div className="grid flex-1 text-left text-sm leading-tight">
                  <span className="truncate font-medium">{user.name}</span>
                  <span className="text-muted-foreground truncate text-xs">
                    {user.email}
                  </span>
                </div>
              </div>
            </DropdownMenuLabel>
            <DropdownMenuSeparator />
            <DropdownMenuGroup>
              <DropdownMenuItem>
                <IconUserCircle />
                Account
              </DropdownMenuItem>
              <DropdownMenuItem>
                <IconCreditCard />
                Billing
              </DropdownMenuItem>
              <DropdownMenuItem>
                <IconNotification />
                Notifications
              </DropdownMenuItem>
            </DropdownMenuGroup>
            <DropdownMenuSeparator />
            <DropdownMenuItem>
              <IconLogout />
              Log out
            </DropdownMenuItem>
          </DropdownMenuContent>
        </DropdownMenu>
      </SidebarMenuItem>
    </SidebarMenu>
  )
}

Subdomains

Functions

Dependencies

  • avatar
  • dropdown-menu
  • icons-react
  • sidebar

Frequently Asked Questions

What does nav-user.tsx do?
nav-user.tsx is a source file in the ui codebase, written in tsx. It belongs to the ApplicationExhibition domain, Authentication subdomain.
What functions are defined in nav-user.tsx?
nav-user.tsx defines 1 function(s): NavUser.
What does nav-user.tsx depend on?
nav-user.tsx imports 4 module(s): avatar, dropdown-menu, icons-react, sidebar.
Where is nav-user.tsx in the architecture?
nav-user.tsx is located at apps/v4/app/(app)/examples/dashboard/components/nav-user.tsx (domain: ApplicationExhibition, subdomain: Authentication, directory: apps/v4/app/(app)/examples/dashboard/components).

Analyze Your Own Codebase

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

Try Supermodel Free