Home / File/ theme-selector.tsx — ui Source File

theme-selector.tsx — ui Source File

Architecture documentation for theme-selector.tsx, a tsx file in the ui codebase. 7 imports, 0 dependents.

File tsx Internationalization RTLLayout 7 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  f19a4ce1_eb06_8b0a_2bc4_7548c2e53c57["theme-selector.tsx"]
  99c48ee8_09f0_5ee4_48c9_597d941f294c["theme-customizer.tsx"]
  f19a4ce1_eb06_8b0a_2bc4_7548c2e53c57 --> 99c48ee8_09f0_5ee4_48c9_597d941f294c
  50663817_a4b6_a826_0390_b36b4bcaa110["CopyCodeButton"]
  f19a4ce1_eb06_8b0a_2bc4_7548c2e53c57 --> 50663817_a4b6_a826_0390_b36b4bcaa110
  e632ae84_c5fb_40c9_7b9d_82d10e757faf["label"]
  f19a4ce1_eb06_8b0a_2bc4_7548c2e53c57 --> e632ae84_c5fb_40c9_7b9d_82d10e757faf
  9e04de79_0b92_db17_84ad_a529f1990b55["select"]
  f19a4ce1_eb06_8b0a_2bc4_7548c2e53c57 --> 9e04de79_0b92_db17_84ad_a529f1990b55
  051af7df_a60b_d4df_95ed_ca045420060f["themes"]
  f19a4ce1_eb06_8b0a_2bc4_7548c2e53c57 --> 051af7df_a60b_d4df_95ed_ca045420060f
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  f19a4ce1_eb06_8b0a_2bc4_7548c2e53c57 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  100b413d_51e5_56e4_1d60_2d6768e7fd5c["active-theme"]
  f19a4ce1_eb06_8b0a_2bc4_7548c2e53c57 --> 100b413d_51e5_56e4_1d60_2d6768e7fd5c
  style f19a4ce1_eb06_8b0a_2bc4_7548c2e53c57 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import { Label } from "@/examples/base/ui/label"
import {
  Select,
  SelectContent,
  SelectGroup,
  SelectItem,
  SelectLabel,
  SelectTrigger,
  SelectValue,
} from "@/examples/base/ui/select"

import { THEMES } from "@/lib/themes"
import { cn } from "@/lib/utils"
import { useThemeConfig } from "@/components/active-theme"

import { CopyCodeButton } from "./theme-customizer"

export function ThemeSelector({ className }: React.ComponentProps<"div">) {
  const { activeTheme, setActiveTheme } = useThemeConfig()

  const value = activeTheme === "default" ? "neutral" : activeTheme

  const items = THEMES.map((theme) => ({
    label: theme.label,
    value: theme.name,
  }))

  return (
    <div className={cn("flex items-center gap-2", className)}>
      <Label htmlFor="theme-selector" className="sr-only">
        Theme
      </Label>
      <Select
        items={items}
        value={value}
        onValueChange={(value) => value && setActiveTheme(value)}
      >
        <SelectTrigger id="theme-selector" className="w-36">
          <SelectValue placeholder="Select a theme" />
        </SelectTrigger>
        <SelectContent>
          <SelectGroup>
            <SelectLabel>Theme</SelectLabel>
            {items.map((item) => (
              <SelectItem
                key={item.value}
                value={item.value}
                className="data-[state=checked]:opacity-50"
              >
                {item.label}
              </SelectItem>
            ))}
          </SelectGroup>
        </SelectContent>
      </Select>
      <CopyCodeButton
        variant="secondary"
        size="icon-sm"
        className="rounded-lg border bg-transparent"
      />
    </div>
  )
}

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does theme-selector.tsx do?
theme-selector.tsx is a source file in the ui codebase, written in tsx. It belongs to the Internationalization domain, RTLLayout subdomain.
What functions are defined in theme-selector.tsx?
theme-selector.tsx defines 1 function(s): ThemeSelector.
What does theme-selector.tsx depend on?
theme-selector.tsx imports 7 module(s): CopyCodeButton, active-theme, label, select, theme-customizer.tsx, themes, utils.
Where is theme-selector.tsx in the architecture?
theme-selector.tsx is located at apps/v4/components/theme-selector.tsx (domain: Internationalization, subdomain: RTLLayout, directory: apps/v4/components).

Analyze Your Own Codebase

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

Try Supermodel Free