ComponentPreview() — ui Function Reference
Architecture documentation for the ComponentPreview() function in component-preview.tsx from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 2ec88fd7_0f44_e051_ceb5_b99f31f5e33b["ComponentPreview()"] 9a89a3db_1a52_0859_7037_9840e35b85b1["component-preview.tsx"] 2ec88fd7_0f44_e051_ceb5_b99f31f5e33b -->|defined in| 9a89a3db_1a52_0859_7037_9840e35b85b1 style 2ec88fd7_0f44_e051_ceb5_b99f31f5e33b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/v4/components/component-preview.tsx lines 8–127
export function ComponentPreview({
name,
type,
className,
previewClassName,
align = "center",
hideCode = false,
chromeLessOnMobile = false,
styleName = "new-york-v4",
direction = "ltr",
caption,
...props
}: React.ComponentProps<"div"> & {
name: string
styleName?: string
align?: "center" | "start" | "end"
description?: string
hideCode?: boolean
type?: "block" | "component" | "example"
chromeLessOnMobile?: boolean
previewClassName?: string
direction?: "ltr" | "rtl"
caption?: string
}) {
if (type === "block") {
const content = (
<div className="relative mt-6 aspect-[4/2.5] w-full overflow-hidden rounded-xl border md:-mx-1">
<Image
src={`/r/styles/new-york-v4/${name}-light.png`}
alt={name}
width={1440}
height={900}
className="bg-background absolute top-0 left-0 z-20 w-[970px] max-w-none sm:w-[1280px] md:hidden dark:hidden md:dark:hidden"
/>
<Image
src={`/r/styles/new-york-v4/${name}-dark.png`}
alt={name}
width={1440}
height={900}
className="bg-background absolute top-0 left-0 z-20 hidden w-[970px] max-w-none sm:w-[1280px] md:hidden dark:block md:dark:hidden"
/>
<div className="bg-background absolute inset-0 hidden w-[1600px] md:block">
<iframe src={`/view/${styleName}/${name}`} className="size-full" />
</div>
</div>
)
if (caption) {
return (
<figure className="flex flex-col gap-4">
{content}
<figcaption className="text-muted-foreground text-center text-sm">
{caption}
</figcaption>
</figure>
)
}
return content
}
const Component = getRegistryComponent(name, styleName)
if (!Component) {
return (
<p className="text-muted-foreground mt-6 text-sm">
Component{" "}
<code className="bg-muted relative rounded px-[0.3rem] py-[0.2rem] font-mono text-sm">
{name}
</code>{" "}
not found in registry.
</p>
)
}
const content = (
<ComponentPreviewTabs
className={className}
previewClassName={previewClassName}
align={align}
hideCode={hideCode}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does ComponentPreview() do?
ComponentPreview() is a function in the ui codebase, defined in apps/v4/components/component-preview.tsx.
Where is ComponentPreview() defined?
ComponentPreview() is defined in apps/v4/components/component-preview.tsx at line 8.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free