Installation
The one-line install, installing by hand, and what lands in your project.
Every component installs the same way: one command with the shadcn CLI, or a few files copied by hand. Both end with the same source files in your project. This page uses the bar chart as the example; each component page shows its own command.
Install with the CLI
Run the command for your package manager in the root of a project that has a components.json file:
npx shadcn@latest add https://thrumui.dev/r/bar-chart.jsonpnpm dlx shadcn@latest add https://thrumui.dev/r/bar-chart.jsonyarn dlx shadcn@latest add https://thrumui.dev/r/bar-chart.jsonbunx --bun shadcn@latest add https://thrumui.dev/r/bar-chart.jsonThe command does three things:
- Writes the component to
components/ui/bar-chart.tsx. - Writes the foundation files it imports to
lib/:thrum-chart.ts,thrum-motion.ts,thrum-sound.ts. They are shared, so the next component reuses them. - Installs the npm packages it needs:
motion.
Free components need no account and no configuration. The address in the command is the whole registry entry: open it in a browser to read exactly what will be written.
You should see
The CLI names each file it wrote. Import the component and it renders:
import { BarChart } from "@/components/ui/bar-chart";Pro components use a shorter command and a licence key. Pro setup has the three steps.
Install by hand
Use this when you cannot run the CLI, or want to read every line before it enters your project.
1. Install the packages
npm install motionpnpm add motionyarn add motionbun add motion2. Check the cn helper
Components merge class names with cn from @/lib/utils. Every shadcn project has it. If yours does not, install clsx and tailwind-merge and create the file:
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}3. Copy the foundation files
Each component page lists what it needs under “Files and dependencies”. The bar chart needs:
- Chart foundations into
lib/thrum-chart.ts - Motion tokens into
lib/thrum-motion.ts - Sound engine into
lib/thrum-sound.ts
Copy each one once. A component needs only the files it imports: the sparkline, for example, needs 3 of the 5.
4. Copy the component
Copy the code under Source on the component page into components/ui/bar-chart.tsx. The source on this site already uses the installed import paths (@/lib/… and @/components/ui/…), so it works as pasted when @/ points at your source folder.
For a Pro component, the Source section shows the code once you are signed in with a Pro licence.
What the foundation files are
Shared code that components import. You rarely install these on their own: the CLI brings them along when a component needs them.
| File | What it is |
|---|---|
lib/thrum-chart.ts | Scales, ticks, smooth paths, colour slots, number formatting, and the size and keyboard-cursor hooks every Thrum chart draws through. No dependencies beyond React. |
lib/thrum-dashboard.tsxPro | Shared frame, section panels, KPI strip and currency formatters used across the Pro dashboard blocks. Needs motion. |
lib/thrum-motion.ts | Shared durations, easings and springs, plus a reduced-motion hook. Data marks settle without overshoot; only chrome may spring. Needs motion. |
lib/thrum-sound.ts | Sixteen short interface sounds in one key, synthesised in the browser with no audio files, levelled and limited. Off until the visitor turns it on. |
lib/thrum-material.tsx | Crisp frosted glass for every surface in the library. Set data-material="frosted" on the page and menus, dialogs and cards turn translucent, with tunable transparency and blur and accessible solid fallbacks. |
Strict CSP apps
If your Content Security Policy blocks inline <style> elements (style-src without 'unsafe-inline'), two @base-ui/react primitives (ScrollArea and Select) inject a tiny inline scrollbar stylesheet by default. Wrap your app root in CSPProvider with disableStyleElements:
import { CSPProvider } from "@base-ui/react/csp-provider";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return <CSPProvider disableStyleElements>{children}</CSPProvider>;
}Then add the equivalent rule to your external global stylesheet so hidden scrollbars keep working without an inline style tag:
.base-ui-disable-scrollbar {
scrollbar-width: none;
}
.base-ui-disable-scrollbar::-webkit-scrollbar {
display: none;
}Update a component
Installed components are files in your repository, so nothing updates by itself. To take a newer version, run the install command again with --overwrite:
npx shadcn@latest add https://thrumui.dev/r/bar-chart.json --overwrite- Commit your work first. The command replaces the component file and the foundation files it depends on, including any edits you made to them.
- Add
--dry-runto preview the changes without writing files. - Read the changelog before you update. Each component page also lists its own versions. A patch version is a fix, a minor version adds a prop, and a major version changes or removes one.
- Afterwards, review the result with
git diff.
Troubleshooting
An import cannot be found
The message is usually Cannot find module '@/lib/thrum-chart' or '@/components/ui/…'. The CLI writes files and import paths from the aliases in your components.json. The standard values are:
{
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib"
}
}Check that these match the paths in your tsconfig.json, and that the files landed in the folders those aliases point at (in a project with a src folder, src/lib and src/components/ui). If you installed by hand with a different alias, change the import lines at the top of each copied file to match.
The cn helper is missing
Cannot find module '@/lib/utils' means the project was never initialised with shadcn. Run npx shadcn@latest init, or create the file from step 2 of the manual install.
The project uses Tailwind v3
The sign is a chart with no colour: black or invisible lines. Components read theme variables as complete colours, for example var(--chart-1). Tailwind v3 shadcn themes store bare HSL numbers in those variables, which is not a colour by itself. Thrum is built and tested for Tailwind v4 only. Move the project to v4 with the shadcn Tailwind v4 guide, which also converts the theme variables.
The registry address cannot be reached
- Open the address from the command in a browser. You should get JSON with the component's name near the top. A “not found” page means the name is misspelled: copy the command again from the component page.
- If the browser works and the CLI does not, a proxy or firewall is blocking the terminal. Set your proxy variables for the shell, or install by hand.
- For a Pro component, the CLI prints the reason. Pro setup explains each message.
React Server Components and “use client”
- Every component file starts with
"use client". Import one into a server component and pass it data: no wrapper is needed. - “Functions cannot be passed directly to Client Components” means a server component is passing a callback such as
onActiveChange. Move that chart into a client component of your own. - The files in
lib/use React hooks, so import them from client components only.useSound()in particular belongs in a client component of your own.