Home / File/ docs-toc.tsx — ui Source File

docs-toc.tsx — ui Source File

Architecture documentation for docs-toc.tsx, a tsx file in the ui codebase. 5 imports, 0 dependents.

File tsx Internationalization Dictionary 5 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  f778cd42_0f75_bcf6_65b6_85f12ec2ee89["docs-toc.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  f778cd42_0f75_bcf6_65b6_85f12ec2ee89 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  39a0d62e_8e7d_d097_eb95_91d2bca361f7["icons-react"]
  f778cd42_0f75_bcf6_65b6_85f12ec2ee89 --> 39a0d62e_8e7d_d097_eb95_91d2bca361f7
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  f778cd42_0f75_bcf6_65b6_85f12ec2ee89 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  57e86e45_ac6e_7278_be08_9092724e8401["button"]
  f778cd42_0f75_bcf6_65b6_85f12ec2ee89 --> 57e86e45_ac6e_7278_be08_9092724e8401
  d1cb37f2_0d1d_01bc_0d60_a15219afac51["dropdown-menu"]
  f778cd42_0f75_bcf6_65b6_85f12ec2ee89 --> d1cb37f2_0d1d_01bc_0d60_a15219afac51
  style f778cd42_0f75_bcf6_65b6_85f12ec2ee89 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import { IconMenu3 } from "@tabler/icons-react"

import { cn } from "@/lib/utils"
import { Button } from "@/registry/new-york-v4/ui/button"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuTrigger,
} from "@/registry/new-york-v4/ui/dropdown-menu"

function useActiveItem(itemIds: string[]) {
  const [activeId, setActiveId] = React.useState<string | null>(null)

  React.useEffect(() => {
    const observer = new IntersectionObserver(
      (entries) => {
        for (const entry of entries) {
          if (entry.isIntersecting) {
            setActiveId(entry.target.id)
          }
        }
      },
      { rootMargin: "0% 0% -80% 0%" }
    )

    for (const id of itemIds ?? []) {
      const element = document.getElementById(id)
      if (element) {
        observer.observe(element)
      }
    }

    return () => {
      for (const id of itemIds ?? []) {
        const element = document.getElementById(id)
        if (element) {
          observer.unobserve(element)
        }
      }
    }
  }, [itemIds])

  return activeId
}

export function DocsTableOfContents({
  toc,
  variant = "list",
  className,
}: {
  toc: {
    title?: React.ReactNode
    url: string
    depth: number
  }[]
  variant?: "dropdown" | "list"
// ... (67 more lines)

Subdomains

Dependencies

  • button
  • dropdown-menu
  • icons-react
  • react
  • utils

Frequently Asked Questions

What does docs-toc.tsx do?
docs-toc.tsx is a source file in the ui codebase, written in tsx. It belongs to the Internationalization domain, Dictionary subdomain.
What functions are defined in docs-toc.tsx?
docs-toc.tsx defines 2 function(s): DocsTableOfContents, useActiveItem.
What does docs-toc.tsx depend on?
docs-toc.tsx imports 5 module(s): button, dropdown-menu, icons-react, react, utils.
Where is docs-toc.tsx in the architecture?
docs-toc.tsx is located at apps/v4/components/docs-toc.tsx (domain: Internationalization, subdomain: Dictionary, directory: apps/v4/components).

Analyze Your Own Codebase

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

Try Supermodel Free