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

theme-picker.tsx — ui Source File

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

File tsx DesignEngine PreviewSystem 7 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  6748eb18_47f8_3637_a6fc_8e2e48228b8a["theme-picker.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  6748eb18_47f8_3637_a6fc_8e2e48228b8a --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  75d25ec8_fe84_91a4_54c6_20dabb286f91["next-themes"]
  6748eb18_47f8_3637_a6fc_8e2e48228b8a --> 75d25ec8_fe84_91a4_54c6_20dabb286f91
  47758573_16e6_4808_88b2_8dba3780ae24["use-mounted"]
  6748eb18_47f8_3637_a6fc_8e2e48228b8a --> 47758573_16e6_4808_88b2_8dba3780ae24
  f14cf7ca_f213_afc2_bc66_ebc0fb7d9834["config"]
  6748eb18_47f8_3637_a6fc_8e2e48228b8a --> f14cf7ca_f213_afc2_bc66_ebc0fb7d9834
  000a4c85_90c9_57be_0014_4c8e8762dcff["lock-button"]
  6748eb18_47f8_3637_a6fc_8e2e48228b8a --> 000a4c85_90c9_57be_0014_4c8e8762dcff
  c97cebd0_0d39_fa69_4337_d0c1787c0b11["picker"]
  6748eb18_47f8_3637_a6fc_8e2e48228b8a --> c97cebd0_0d39_fa69_4337_d0c1787c0b11
  c27c6e95_5daf_4dd4_dc3a_add496837570["search-params"]
  6748eb18_47f8_3637_a6fc_8e2e48228b8a --> c27c6e95_5daf_4dd4_dc3a_add496837570
  style 6748eb18_47f8_3637_a6fc_8e2e48228b8a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import { useTheme } from "next-themes"

import { useMounted } from "@/hooks/use-mounted"
import { BASE_COLORS, type Theme, type ThemeName } from "@/registry/config"
import { LockButton } from "@/app/(create)/components/lock-button"
import {
  Picker,
  PickerContent,
  PickerGroup,
  PickerRadioGroup,
  PickerRadioItem,
  PickerSeparator,
  PickerTrigger,
} from "@/app/(create)/components/picker"
import { useDesignSystemSearchParams } from "@/app/(create)/lib/search-params"

export function ThemePicker({
  themes,
  isMobile,
  anchorRef,
}: {
  themes: readonly Theme[]
  isMobile: boolean
  anchorRef: React.RefObject<HTMLDivElement | null>
}) {
  const { resolvedTheme } = useTheme()
  const mounted = useMounted()
  const [params, setParams] = useDesignSystemSearchParams()

  const currentTheme = React.useMemo(
    () => themes.find((theme) => theme.name === params.theme),
    [themes, params.theme]
  )

  const currentThemeIsBaseColor = React.useMemo(
    () => BASE_COLORS.find((baseColor) => baseColor.name === params.theme),
    [params.theme]
  )

  React.useEffect(() => {
    if (!currentTheme && themes.length > 0) {
      setParams({ theme: themes[0].name })
    }
  }, [currentTheme, themes, setParams])

  return (
    <div className="group/picker relative">
      <Picker>
        <PickerTrigger>
          <div className="flex flex-col justify-start text-left">
            <div className="text-muted-foreground text-xs">Theme</div>
            <div className="text-foreground text-sm font-medium">
              {currentTheme?.title}
            </div>
          </div>
          {mounted && resolvedTheme && (
            <div
// ... (107 more lines)

Domain

Subdomains

Functions

Dependencies

  • config
  • lock-button
  • next-themes
  • picker
  • react
  • search-params
  • use-mounted

Frequently Asked Questions

What does theme-picker.tsx do?
theme-picker.tsx is a source file in the ui codebase, written in tsx. It belongs to the DesignEngine domain, PreviewSystem subdomain.
What functions are defined in theme-picker.tsx?
theme-picker.tsx defines 1 function(s): ThemePicker.
What does theme-picker.tsx depend on?
theme-picker.tsx imports 7 module(s): config, lock-button, next-themes, picker, react, search-params, use-mounted.
Where is theme-picker.tsx in the architecture?
theme-picker.tsx is located at apps/v4/app/(create)/components/theme-picker.tsx (domain: DesignEngine, subdomain: PreviewSystem, directory: apps/v4/app/(create)/components).

Analyze Your Own Codebase

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

Try Supermodel Free