Home / File/ sidebar.tsx — ui Source File

sidebar.tsx — ui Source File

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

File tsx ComponentRegistry ChartRegistry 12 imports 25 functions

Entity Profile

Dependency Diagram

graph LR
  9d6532a9_426f_ea68_5d06_31eaecadb210["sidebar.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  9d6532a9_426f_ea68_5d06_31eaecadb210 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  45bdba50_501d_4bbb_e6ef_5f033d29cffe["react-slot"]
  9d6532a9_426f_ea68_5d06_31eaecadb210 --> 45bdba50_501d_4bbb_e6ef_5f033d29cffe
  25383e8d_ca91_a50e_c3a8_5f228d02e1df["class-variance-authority"]
  9d6532a9_426f_ea68_5d06_31eaecadb210 --> 25383e8d_ca91_a50e_c3a8_5f228d02e1df
  d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3["lucide-react"]
  9d6532a9_426f_ea68_5d06_31eaecadb210 --> d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3
  473b3225_a64d_362c_8209_f99c5b1b6d81["use-mobile"]
  9d6532a9_426f_ea68_5d06_31eaecadb210 --> 473b3225_a64d_362c_8209_f99c5b1b6d81
  388bdfe2_9bdf_d785_f943_9f13b5518a0b["utils"]
  9d6532a9_426f_ea68_5d06_31eaecadb210 --> 388bdfe2_9bdf_d785_f943_9f13b5518a0b
  aa2f3ec6_f291_3763_88ec_65a3f5ad5939["button"]
  9d6532a9_426f_ea68_5d06_31eaecadb210 --> aa2f3ec6_f291_3763_88ec_65a3f5ad5939
  2de1d0e1_ab37_e1b0_4ef3_da8c8fa66107["input"]
  9d6532a9_426f_ea68_5d06_31eaecadb210 --> 2de1d0e1_ab37_e1b0_4ef3_da8c8fa66107
  0ef877d6_b768_4222_bd20_50d875ac5e58["separator"]
  9d6532a9_426f_ea68_5d06_31eaecadb210 --> 0ef877d6_b768_4222_bd20_50d875ac5e58
  80ae0a6d_36b4_7c16_76aa_95005b3b164f["sheet"]
  9d6532a9_426f_ea68_5d06_31eaecadb210 --> 80ae0a6d_36b4_7c16_76aa_95005b3b164f
  3119ffb8_7316_4004_c2c7_61f58afcb2f8["skeleton"]
  9d6532a9_426f_ea68_5d06_31eaecadb210 --> 3119ffb8_7316_4004_c2c7_61f58afcb2f8
  4ad968a1_2bd7_248c_f5ed_f80d5b5f7417["tooltip"]
  9d6532a9_426f_ea68_5d06_31eaecadb210 --> 4ad968a1_2bd7_248c_f5ed_f80d5b5f7417
  style 9d6532a9_426f_ea68_5d06_31eaecadb210 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"
import { PanelLeft } from "lucide-react"

import { useIsMobile } from "@/registry/new-york/hooks/use-mobile"
import { cn } from "@/registry/new-york/lib/utils"
import { Button } from "@/registry/new-york/ui/button"
import { Input } from "@/registry/new-york/ui/input"
import { Separator } from "@/registry/new-york/ui/separator"
import {
  Sheet,
  SheetContent,
  SheetDescription,
  SheetHeader,
  SheetTitle,
} from "@/registry/new-york/ui/sheet"
import { Skeleton } from "@/registry/new-york/ui/skeleton"
import {
  Tooltip,
  TooltipContent,
  TooltipProvider,
  TooltipTrigger,
} from "@/registry/new-york/ui/tooltip"

const SIDEBAR_COOKIE_NAME = "sidebar_state"
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
const SIDEBAR_WIDTH = "16rem"
const SIDEBAR_WIDTH_MOBILE = "18rem"
const SIDEBAR_WIDTH_ICON = "3rem"
const SIDEBAR_KEYBOARD_SHORTCUT = "b"

type SidebarContextProps = {
  state: "expanded" | "collapsed"
  open: boolean
  setOpen: (open: boolean) => void
  openMobile: boolean
  setOpenMobile: (open: boolean) => void
  isMobile: boolean
  toggleSidebar: () => void
}

const SidebarContext = React.createContext<SidebarContextProps | null>(null)

function useSidebar() {
  const context = React.useContext(SidebarContext)
  if (!context) {
    throw new Error("useSidebar must be used within a SidebarProvider.")
  }

  return context
}

const SidebarProvider = React.forwardRef<
  HTMLDivElement,
  React.ComponentProps<"div"> & {
    defaultOpen?: boolean
    open?: boolean
// ... (714 more lines)

Subdomains

Dependencies

  • button
  • class-variance-authority
  • input
  • lucide-react
  • react
  • react-slot
  • separator
  • sheet
  • skeleton
  • tooltip
  • use-mobile
  • utils

Frequently Asked Questions

What does sidebar.tsx do?
sidebar.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 sidebar.tsx?
sidebar.tsx defines 25 function(s): Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, and 15 more.
What does sidebar.tsx depend on?
sidebar.tsx imports 12 module(s): button, class-variance-authority, input, lucide-react, react, react-slot, separator, sheet, and 4 more.
Where is sidebar.tsx in the architecture?
sidebar.tsx is located at deprecated/www/registry/new-york/ui/sidebar.tsx (domain: ComponentRegistry, subdomain: ChartRegistry, directory: deprecated/www/registry/new-york/ui).

Analyze Your Own Codebase

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

Try Supermodel Free