Home / File/ version-switcher.tsx — ui Source File

version-switcher.tsx — ui Source File

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

File tsx ComponentRegistry ChartRegistry 4 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  5538ef6a_2e9e_5223_fe44_7118c4ec2f2d["version-switcher.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  5538ef6a_2e9e_5223_fe44_7118c4ec2f2d --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3["lucide-react"]
  5538ef6a_2e9e_5223_fe44_7118c4ec2f2d --> d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3
  f16f43cb_04fd_5f33_2140_7eafce119350["dropdown-menu"]
  5538ef6a_2e9e_5223_fe44_7118c4ec2f2d --> f16f43cb_04fd_5f33_2140_7eafce119350
  742f06fb_c1e8_243e_1fc4_8b1cf11704c2["sidebar"]
  5538ef6a_2e9e_5223_fe44_7118c4ec2f2d --> 742f06fb_c1e8_243e_1fc4_8b1cf11704c2
  style 5538ef6a_2e9e_5223_fe44_7118c4ec2f2d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import { Check, ChevronsUpDown, GalleryVerticalEnd } from "lucide-react"

import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuTrigger,
} from "@/registry/default/ui/dropdown-menu"
import {
  SidebarMenu,
  SidebarMenuButton,
  SidebarMenuItem,
} from "@/registry/default/ui/sidebar"

export function VersionSwitcher({
  versions,
  defaultVersion,
}: {
  versions: string[]
  defaultVersion: string
}) {
  const [selectedVersion, setSelectedVersion] = React.useState(defaultVersion)

  return (
    <SidebarMenu>
      <SidebarMenuItem>
        <DropdownMenu>
          <DropdownMenuTrigger asChild>
            <SidebarMenuButton
              size="lg"
              className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
            >
              <div className="flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground">
                <GalleryVerticalEnd className="size-4" />
              </div>
              <div className="flex flex-col gap-0.5 leading-none">
                <span className="font-semibold">Documentation</span>
                <span className="">v{selectedVersion}</span>
              </div>
              <ChevronsUpDown className="ml-auto" />
            </SidebarMenuButton>
          </DropdownMenuTrigger>
          <DropdownMenuContent
            className="w-[--radix-dropdown-menu-trigger-width]"
            align="start"
          >
            {versions.map((version) => (
              <DropdownMenuItem
                key={version}
                onSelect={() => setSelectedVersion(version)}
              >
                v{version}{" "}
                {version === selectedVersion && <Check className="ml-auto" />}
              </DropdownMenuItem>
            ))}
          </DropdownMenuContent>
        </DropdownMenu>
      </SidebarMenuItem>
    </SidebarMenu>
  )
}

Subdomains

Functions

Dependencies

  • dropdown-menu
  • lucide-react
  • react
  • sidebar

Frequently Asked Questions

What does version-switcher.tsx do?
version-switcher.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 version-switcher.tsx?
version-switcher.tsx defines 1 function(s): VersionSwitcher.
What does version-switcher.tsx depend on?
version-switcher.tsx imports 4 module(s): dropdown-menu, lucide-react, react, sidebar.
Where is version-switcher.tsx in the architecture?
version-switcher.tsx is located at deprecated/www/registry/default/blocks/sidebar-02/components/version-switcher.tsx (domain: ComponentRegistry, subdomain: ChartRegistry, directory: deprecated/www/registry/default/blocks/sidebar-02/components).

Analyze Your Own Codebase

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

Try Supermodel Free