Skip to content
Plotcnbeta
DocsChartsBlocksPlaygroundThemesExamples
Get started
Guide
  • Introduction
  • System Design
  • Engine Strategy
  • Installation
  • Project Setup
  • shadcn/ui Setup
  • Plotcn Registry
Fundamentals
  • Usage
  • Theming
  • Accessibility
  • Motion & Animation
  • Performance
  • TypeScript & I18n
Google Charts
  • Google Charts
  • Google GeoChart
REGISTRY CONFIGURATIONSTEP 03 OF GETTING STARTED
CLI Source Delivery

shadcn/ui Setup

Configure the source pipeline behind Plotcn. Plotcn uses the shadcn Registry model to install visualization source directly into your application. This page explains the configuration that controls where those files go and how their imports are resolved.

TOPICS:components.jsonRegistryAliasesTypeScriptSource ownership
Delivery Pipeline

Registry Source Delivery Pipeline

How components.json configuration, the shadcn CLI resolver, and Plotcn remote registries deliver 100% owned source files directly into your workspace.

HOST MANIFEST
CONFIG
components.json
Declares import aliases, CSS paths, RSC mode, and registered namespaces.
Configuration File · JSON
CLI resolution
TOOLCHAIN
ActiveRESOLVER
shadcn CLI Resolver
Resolves @plotcn namespace URL, installs required dependencies, and rewrites imports to project aliases.
npx shadcn add @plotcn/... · Zero Lock-In
fetches catalog manifest
REMOTE REGISTRY
REMOTE
Plotcn Registry Endpoint
Supplies uncompiled TypeScript source files, metadata, and engine dependencies.
plotcn.vercel.app/r · JSON Catalog
writes source directly
DESTINATION PATH
Ready100% OWNED
Your Codebase: components/charts/
Raw React component files placed in your project. Full inspection, editing, and evolution.
Full Code Ownership · TypeScript · 0 Blackbox

How Plotcn uses shadcn/ui

Plotcn uses the shadcn Registry model as its installation and distribution layer. Instead of importing every visualization from a single opaque, monolithic npm package, you install individual chart source files directly into your own codebase.

The official shadcn CLI resolves the registry item, installs its specific dependencies, writes the TypeScript source files to your configured aliases, and rewrites imports to match your project structure.

shadcn/ui is the delivery mechanism, not the visualization engine. Recharts, D3.js, and Google Charts remain the underlying visualization engines. The shadcn Registry only handles distribution, dependency management, and source code placement.

Why registry distribution matters

  • 100% Source Ownership: The code lives in your repository. You can customize SVG paths, alter animations, or tweak layout logic without waiting for upstream package releases.
  • Dependency Isolation: Installing a Recharts line chart installs recharts only. It does not force you to install D3 or Google Charts dependencies.
  • Unified Design Tokens: Charts inherit your project's existing shadcn CSS variables, typography, and border radii automatically.

components.json

The components.json file at the root of your project is the manifest read by the shadcn CLI. It instructs the CLI where to install files, how to rewrite import statements, what CSS entrypoint to update, and which remote registries to query.

Interactive components.json Inspector

Click any section below to understand how it affects Plotcn installation and runtime behavior.

Clickable Property Map
// components.json
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "base-nova",
"rsc": true,
"tsx": true,
"tailwind": {
"css": "app/globals.css",
"cssVariables": true
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"registries": {
"@plotcn": "https://plotcn.vercel.app/r/{name}.json"
}
}
aliases
Property Details

Maps logical import aliases (@/components, @/components/ui, @/lib/utils) to real folders.

Role in Plotcn

The CLI uses these to write files directly into components/charts and rewrite imports to use your project's aliases instead of fragile relative paths.

Must resolve in your tsconfig.json compilerOptions.paths.
Do not overwrite existing configuration. If components.json already exists in your project, keep your existing file and simply verify your aliases, tailwind.css path, and add the Plotcn registry namespace.

Core configuration

The following properties in components.json define the CLI environment and file generation rules:

Property Purpose Plotcn Recommendation
PropertyPurposePlotcn Recommendation
$schemaEnables schema validation & IDE autocompletehttps://ui.shadcn.com/schema.json
styleControls shadcn component style (base-nova or default)Keep existing host project style
rscControls React Server Component directivestrue for Next.js; false for Vite / SPA
tsxControls TypeScript (.tsx) vs JavaScript outputtrue (strongly recommended)
tailwindConfigures CSS entrypoint and theme variable modecssVariables: true pointing to active CSS
aliasesMaps import prefixes to physical project directoriesStandard @/* root mapping
registriesConfigures external namespaced registriesMaps @plotcn remote namespace

Style immutability

In shadcn/ui, the selected style cannot simply be changed after project initialization without breaking existing component primitives. Plotcn is designed to adapt to whatever style your project uses. We do not require a specific shadcn style, base color, or border radius.

Path aliases

The shadcn CLI uses aliases to determine where files are written and how imports are rewritten inside generated components.

Alias Resolution

Path Alias Destination Hierarchy

How the shadcn CLI maps logical import statements in registry components to your local codebase directory structure.

IMPORT ALIAS
components/
@/components
Base destination for all installed visualization files
Base Components
IMPORT ALIAS
components/ui/
@/components/ui
Shared shadcn primitives (Button, Tooltip, Card, Dialog)
UI Primitives
IMPORT ALIAS
lib/utils.ts
@/lib/utils
Exports the cn() class merger for conditional Tailwind classes
Class Merger
IMPORT ALIAS
lib/
@/lib
Engine math helpers and theme adapters (e.g. Google Charts options)
Utilities

Import stability rule

Registry items should resolve through stable path aliases, not fragile relative import chains:

TypeScript
// ✅ RECOMMENDED: Stable root-relative aliasimport { cn } from "@/lib/utils"import { ChartContainer } from "@/components/charts/shared/chart-container"// ❌ FRAGILE: Brittle relative pathimport { cn } from "../../../lib/utils"

Modern package imports

Current shadcn versions also support Node.js subpath imports configured in package.json#imports alongside TypeScript path mappings. Standard path aliases (@/*) remain the recommended default for most React projects.

React Server Components

The rsc field in components.json informs the CLI whether your application environment supports React Server Components.

Leaf Isolation

React Server Component (RSC) Directives

Plotcn minimizes client bundle footprint by isolating 'use client' directives strictly to interactive chart rendering leaves.

SERVER (RSC)Server-Safe Layer (No directive)
SSR ENABLED
  • Metadata & title formatting
  • D3 math scales & geometry calculations
  • Dataset slicing & aggregation
  • Static dashboard cards and layout shells
CLIENT (ISOLATED)Client-Only Leaf ('use client')
INTERACTIVE
  • ResizeObserver dimension measurement
  • Recharts interactive tooltips & legends
  • D3 zoom, drag, and brush interactions
  • Google Charts runtime script execution

Framework-specific RSC behavior

  • Next.js App Router (rsc: true): Plotcn keeps data math, layout shells, and static utilities server-safe, while isolating interactive charts behind "use client" leaf boundaries.
  • Vite & Client SPAs (rsc: false): The CLI omits redundant "use client" directives from generated component files.

TypeScript output

Plotcn is architected TypeScript-first with strict interfaces for chart props, datum schemas, and layout configurations:

JSON
{  "tsx": true}
Recommended: tsx: true Visualization components rely on accurate coordinate math and strongly-typed data structures. Strict typing prevents common runtime rendering errors such as NaN values in SVG path definitions and missing axis fields.

Tailwind and CSS variables

Plotcn charts inherit colors directly from your existing design system using CSS variables:

JSON
{  "tailwind": {    "config": "",    "css": "app/globals.css",    "baseColor": "neutral",    "cssVariables": true  }}

Inherit, do not repaint

Plotcn adapts to your existing application palette (background, foreground, muted, border, card, primary). Visualization components reference categorical variables (--chart-1 through --chart-5) defined in your stylesheet, ensuring charts automatically transition between light and dark modes.

Configure the Plotcn registry

Because @plotcn is officially included in the shadcn/ui community registry directory, simply running an add command (like npx shadcn@latest add @plotcn/line-basic) works out of the box and registers the entry in your components.json automatically.

You can also explicitly define the registry in your components.json:

components.json
{  "registries": {    "@plotcn": "https://plotcn.vercel.app/r/{name}.json"  }}
Registry Resolution

Namespace Resolution Workflow

How the shadcn CLI maps @plotcn prefixes to remote registries and injects code into your workspace.

  1. 01
    Command Trigger

    Developer runs add @plotcn/line-basic in terminal.

    CLI Trigger
  2. 02
    Namespace Lookup

    CLI reads components.json and extracts registries["@plotcn"].

    components.json
  3. 03
    Item Schema Fetch

    CLI queries /r/line-basic.json for source files and engine packages.

    line-basic.json
  4. 04
    Local Injection

    Files written directly into components/charts/ with rewritten import aliases.

    components/charts/*

Registering via CLI

You can also add the Plotcn registry namespace using the shadcn CLI:

pnpm dlx shadcn@latest registry add @plotcn=https://plotcn.vercel.app/r/{name}.json

GitHub source registries

Modern shadcn also supports installing components directly from public GitHub repositories that provide a root registry.json. During local development or experimental releases, you can install components directly from the Plotcn repository address.

Add a Plotcn component

You install visualization components using the @plotcn namespace just like standard shadcn primitives:

PLOTCN/REGISTRY/LINE-BASIC/SOURCE
pnpm dlx shadcn@latest add @plotcn/line-basic

Checking public registry…

View local registry JSON
REGISTRY direct URL·ENGINE Recharts·FILES 1·DEPENDENCIES 6

Copied as source into your project (requires recharts).

Install with pnpm:
pnpm
pnpm dlx shadcn@latest add @plotcn/line-basic

This command uses your active pnpm package manager to download the line chart component, install recharts if not already installed, and place the component into your components/charts/ folder.

What happens during installation

When you execute an add command, the shadcn CLI performs a structured 7-step sequence:

  1. Resolve Namespace: Checks components.json to map @plotcn to the remote registry URL.
  2. Fetch Schema: Downloads the component JSON manifest containing source files and dependencies.
  3. Resolve Registry Dependencies: Identifies shared Plotcn primitives (e.g. chart-container) needed by the component.
  4. Install Package Dependencies: Installs only the engine needed (e.g. recharts for a Recharts line chart).
  5. Copy Source Files: Injects the component files directly into your components/charts/ folder.
  6. Rewrite Imports: Rewrites import statements inside the new files to match your project's configured aliases.
  7. Verify CSS Tokens: Checks that required theme tokens are present in your stylesheet.

Package vs registry dependencies

  • dependencies: Standard npm packages installed into node_modules (e.g. recharts, d3-shape).
  • registryDependencies: Reusable component primitives copied as editable source code (e.g. chart-container, chart-state).

What gets added

Installing a component places readable, editable source code into your repository:

Before InstallationStandard shadcn
components/
└── ui/
├── button.tsx
├── card.tsx
└── tooltip.tsx
After @plotcn InstallationSource Injected
components/
├── ui/
└── charts/
├── + recharts/line-basic.tsx
└── shared/
├── + chart-container.tsx
└── + chart-theme.ts

You own the installed source

After installation, Plotcn component source becomes an integral part of your application. You can freely inspect SVG rendering, adjust responsive breakpoints, change tooltip styling, or extend interaction handlers.

Google Charts Distinction: For Google Charts components, you own the React wrapper and theme adapter source code. However, Google's chart rendering engine loads from Google's external CDN runtime.

Common setup mistakes

Review these common configuration mismatches and their solutions:

Alias Mismatch

CAUSE:components.json points to @/components but tsconfig.json lacks paths mappings.

FIX:
Ensure tsconfig.json compilerOptions.paths contains "@/*": ["./*"] (or "./src/*").

Wrong CSS Path

CAUSE:tailwind.css in components.json points to a non-existent or inactive stylesheet.

FIX:
Set tailwind.css to your active Tailwind entrypoint (e.g. app/globals.css or src/index.css).

Incorrect RSC Setting

CAUSE:rsc is set to true in a Vite SPA, or set to false in a Next.js App Router project.

FIX:
Set rsc: true for Next.js App Router. Set rsc: false for Vite, React Router, or Astro SPAs.

Overwriting components.json

CAUSE:Running shadcn init from scratch in an already configured, customized codebase.

FIX:
Do not recreate components.json. Simply add the @plotcn registry entry under 'registries'.

Monolithic Dependencies

CAUSE:Manually installing Recharts, D3, and Google Charts globally at once.

FIX:
Let the shadcn CLI install only the engine needed for each specific chart component.

Malformed Registry URL

CAUSE:Missing the required {name} template variable in custom registry URLs.

FIX:
Ensure remote registry URLs end with /{name}.json or follow the provider's specification.

Verify setup

Verify your shadcn/ui and registry configuration before installing your first visualization:

shadcn/ui Configuration Checklist

Confirm your shadcn and registry settings before installing Plotcn charts.

8 of 8 Verified

Next steps

Now that your configuration pipeline is ready, explore the component registry and theming:

  • Plotcn Registry: Learn how source components are packaged and distributed.
  • Usage Guide: General conventions, imports, and responsive container guidelines.
  • Theming Guide: Customize categorical color tokens and light/dark mode palettes.
PreviousProject SetupNextPlotcn Registry

On this page

  • How Plotcn uses shadcn/ui
  • components.json
  • Core configuration
  • Path aliases
  • React Server Components
  • TypeScript output
  • Tailwind and CSS variables
  • Configure the Plotcn registry
  • Add a Plotcn component
  • What happens during installation
  • What gets added
  • You own the installed source
  • Common setup mistakes
  • Verify setup
  • Next steps