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

theme-component.tsx — ui Source File

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

File tsx ComponentRegistry UIPrimitives 5 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  671cdfc4_30ba_8f54_70ac_5d4a2494b708["theme-component.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  671cdfc4_30ba_8f54_70ac_5d4a2494b708 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  f089de72_fa18_41f0_bbdc_dbd00aa24ef0["__registry__"]
  671cdfc4_30ba_8f54_70ac_5d4a2494b708 --> f089de72_fa18_41f0_bbdc_dbd00aa24ef0
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  671cdfc4_30ba_8f54_70ac_5d4a2494b708 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  8c6845ea_e0db_55db_4a65_df2f64d9e581["use-config"]
  671cdfc4_30ba_8f54_70ac_5d4a2494b708 --> 8c6845ea_e0db_55db_4a65_df2f64d9e581
  aae3c3f1_230a_9c11_a663_8bbc3f0ad054["icons"]
  671cdfc4_30ba_8f54_70ac_5d4a2494b708 --> aae3c3f1_230a_9c11_a663_8bbc3f0ad054
  style 671cdfc4_30ba_8f54_70ac_5d4a2494b708 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import { Index } from "@/__registry__"

import { cn } from "@/lib/utils"
import { useConfig } from "@/hooks/use-config"
import { Icons } from "@/components/icons"

interface ThemeComponentProps extends React.HTMLAttributes<HTMLDivElement> {
  name: string
  extractClassname?: boolean
  extractedClassNames?: string
  align?: "center" | "start" | "end"
}

export function ThemeComponent({ name, ...props }: ThemeComponentProps) {
  const [config] = useConfig()

  const Preview = React.useMemo(() => {
    const Component = Index[config.style][name]?.component

    if (!Component) {
      return (
        <p className="text-sm text-muted-foreground">
          Component{" "}
          <code className="relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm">
            {name}
          </code>{" "}
          not found in registry.
        </p>
      )
    }

    return <Component />
  }, [name, config.style])

  return (
    <div className={cn("relative")} {...props}>
      <React.Suspense
        fallback={
          <div className="flex items-center text-sm text-muted-foreground">
            <Icons.spinner className="mr-2 h-4 w-4 animate-spin" />
            Loading...
          </div>
        }
      >
        {Preview}
      </React.Suspense>
    </div>
  )
}

Subdomains

Functions

Dependencies

  • __registry__
  • icons
  • react
  • use-config
  • utils

Frequently Asked Questions

What does theme-component.tsx do?
theme-component.tsx is a source file in the ui codebase, written in tsx. It belongs to the ComponentRegistry domain, UIPrimitives subdomain.
What functions are defined in theme-component.tsx?
theme-component.tsx defines 1 function(s): ThemeComponent.
What does theme-component.tsx depend on?
theme-component.tsx imports 5 module(s): __registry__, icons, react, use-config, utils.
Where is theme-component.tsx in the architecture?
theme-component.tsx is located at deprecated/www/components/theme-component.tsx (domain: ComponentRegistry, subdomain: UIPrimitives, directory: deprecated/www/components).

Analyze Your Own Codebase

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

Try Supermodel Free