Skip to content

Installation

CK-UI has its own command-line tool, the CK-UI CLI (ck-ui-cli on npm). Run it in your project to set CK-UI up once, then add the components you need. Each component is copied into your project as source code, so you can read it and change it.

Requirements

Projects the CK-UI CLI supports
ProjectTailwind CSSStatus
Next.js (App Router), TypeScriptv4Supported
Next.js (App Router), TypeScriptv3.4.1 or laterSupported
React + Vite, TypeScriptv4Supported
React + Vite, TypeScriptv3Not supported: upgrade to v4 with npx @tailwindcss/upgrade
  • Node.js 18.17 or later and React 18 or later.
  • A tsconfig.json: the components are TypeScript (.tsx) files.
  • Tailwind CSS set up in the project, with a stylesheet that loads it.
  • npm and pnpm are supported. Yarn and Bun are detected (from the packageManager field or the lockfile) and used, but are not part of the tested setups yet.

Quick Start

Run these commands in your project's folder. The CLI detects the framework, the Tailwind CSS version and the package manager.

1

Set up CK-UI

Terminal
npx ck-ui-cli@latest init

Run this once per project. It changes only what CK-UI needs:

  • Adds CK-UI's design tokens, utilities and dark mode to the stylesheet that loads Tailwind CSS (for example src/app/globals.css), inside a block marked /* ck-ui:start … */ … /* ck-ui:end */. The rest of the file stays as it is.
  • Writes the cn() helper to src/components/ck-ui/lib/utils.ts.
  • Installs clsx, tailwind-merge and tw-animate-css (Tailwind CSS v4), or clsx, tailwind-merge, tailwindcss-animate and @tailwindcss/forms (v3). Packages you already have are not reinstalled or upgraded.
  • With Tailwind CSS v3, adds ck-ui.tailwind-preset.js and adds it to the presets in your tailwind.config.
  • Records the setup in ck-ui.json.

CK-UI's CSS variables are prefixed (--ck-primary, …), so yours keep their values. If your stylesheet already defines theme colours CK-UI uses (for example from another design system), init stops and names them; --allow-theme-overrides lets CK-UI's colours win for those names. Running init again changes nothing, unless CK-UI's setup has changed since (see Update Components).

2

Add a component

Terminal
npx ck-ui-cli@latest add button

This copies Button.tsx into src/components/ck-ui (components/ck-ui in a project without a src folder), together with every CK-UI component it uses, points its imports at that folder and installs the npm packages it needs. Each component's page shows its command in its Installation section.

Components are namespaces:

src/app/page.tsx
import * as Button from "@/components/ck-ui/Button";

export function Save() {
    return <Button.Root>Save</Button.Root>;
}

The import path follows your project's alias (@/* here); the CLI prints it after adding a component.

3

Add several components

Terminal
npx ck-ui-cli@latest add button input modal

Components they share are added once. dialog is another name for modal.

4

See the available components

Terminal
npx ck-ui-cli@latest list

Lists the 54 components you can add. --json prints them for scripts, and --all also shows the files installed only as dependencies of other components.

5

Check your setup

Terminal
npx ck-ui-cli@latest doctor

Checks Node.js, the framework, Tailwind CSS, your stylesheet, the Tailwind CSS v3 preset, the packages and the installed components, and prints a fix for each problem. It never changes anything, and exits with code 1 when something needs fixing.

Project Files

Files the CK-UI CLI writes
FileWhat it is
src/components/ck-ui/The components you add (components/ck-ui/ without a src folder). Choose another folder with init --dir <folder>.
src/components/ck-ui/lib/utils.tsThe cn() helper the components use (clsx + tailwind-merge).
Your stylesheetCK-UI's block, between /* ck-ui:start … */ and /* ck-ui:end */.
ck-ui.jsonWhere things are, and a checksum of every file the CLI wrote. add and doctor read it, so keep it with your project.
ck-ui.tailwind-preset.jsTailwind CSS v3 only: CK-UI's theme, used through presets in your tailwind.config.

Update Components

Components are copied into your project, so they stay as they are until you update them. To get the current version of the components you use, run add again with their names. To get CK-UI's current design tokens (its colours, for example), run init again.

Terminal
npx ck-ui-cli@latest add badge button
Terminal
npx ck-ui-cli@latest init
  • add updates each file it wrote that you have not edited since, adds any component the new versions use, and installs their packages. A component you name that is not in the project yet is added too.
  • init updates CK-UI's block in your stylesheet (and, with Tailwind CSS v3, its preset) when CK-UI's setup has changed.
  • Files you edited are kept, as described below. Add --dry-run to see what would change first.
  • The changelog says which components and tokens changed in each release.

Your Changes Are Kept

  • A file you have not changed since the CLI wrote it is updated in place.
  • A file you edited, or any file the CLI did not write, is never replaced unless you pass --overwrite (or answer "y" in an interactive terminal). The previous version is kept as <file>.ck-ui-backup.
  • Running add again with nothing new changes nothing.
  • In your stylesheet, init only replaces its own block. If you edited that block, it is kept as well (in an interactive terminal, init asks first).
  • Add --dry-run to init or add to see what would change without changing anything.

Options

CK-UI CLI options
CommandOptions
init--css <file> your stylesheet, --dir <folder> the components folder, --dry-run, --no-install, --allow-theme-overrides
add--dry-run, --overwrite, --no-install
list--all, --json
Every command--cwd <dir> runs it for another project folder, --help shows its usage

Dark Mode

CK-UI's components follow a dark class on <html> (or any ancestor), as set by next-themes with attribute="class". They use their own ck-dark: variant, so the dark: classes in your project keep their meaning.

Known Limitations

  • React + Vite needs Tailwind CSS v4, and Tailwind CSS before 3.4.1 is not supported. Projects without TypeScript are not supported.
  • Next.js support is tested with the App Router.
  • Yarn and Bun are detected and used, but are not part of the tested setups yet.
  • In React + Vite projects, components that render links (Button, Link Button and Navs Vertical with href) use a plain <a> instead of Next.js' <Link>. For client-side routing, render your router's link through asChild.
  • With Tailwind CSS v4, utilities that v4 renamed are installed under their v4 names with the same look. Two v4 defaults still apply: buttons show the default cursor, and palette colours chosen by props (for example Badge color="green") use v4's palette. To restore the pointer cursor, add @layer base { button:not(:disabled), [role="button"]:not(:disabled) { cursor: pointer; } } to your stylesheet.
  • The CLI installs the free components. Premium blocks and templates are not available through it.

Troubleshooting

"Could not find the stylesheet that loads Tailwind CSS"
Name it: npx ck-ui-cli@latest init --css src/styles/app.css.
"… already defines theme colours CK-UI would override"
Another design system is probably set up in that stylesheet. Run init with --allow-theme-overrides to let CK-UI's colours win for the names it lists.
"Tailwind CSS is not installed" or "… is too old"
Set up Tailwind CSS v4 (or v3.4.1 or later with Next.js) first, then run init again.
Components look restyled in a React + Vite project
Vite's starter src/index.css styles button and a outside a cascade layer, which with Tailwind CSS v4 overrides every utility class. Remove those starter rules (Tailwind's reset replaces them); init and doctor point them out. The CLI never deletes your styles itself.
"edited — kept"
You changed that file since the CLI wrote it, so it was left as it is. Run the command again with --overwrite to replace it; a .ck-ui-backup copy is kept.
Anything else
Run npx ck-ui-cli@latest doctor: it checks the whole setup and prints a fix for each problem. The CLI downloads components from https://www.ck-ui.com/r, so it needs access to that address.

Security

  • The registry is fetched over HTTPS only, and redirects are refused.
  • Every response is validated: component and file names must match strict patterns, each file must match its SHA-256 checksum, and dependencies must be plain npm packages with a version range.
  • Files are only written inside your project.
  • Packages are installed without a shell, and npm and pnpm run with --ignore-scripts. Nothing downloaded is executed, and the CLI itself has no runtime dependencies.

Manual Installation

Prefer to set a project up by hand? Follow the Next.js guide (Tailwind CSS v3), then copy components from their pages: open Manual installation in a component's Installation section.

The same files are also in the CK-UI repository on GitHub (opens in a new tab): every free component in one folder per setup (Next.js or React + Vite with Tailwind CSS v4, Next.js with Tailwind CSS v3), with the design tokens and example apps.