Skip to content
React UI

Mekai UI · · 5 min read

Install React components with the shadcn CLI and a custom registry

Install any component from a custom shadcn registry with one URL: what the CLI writes, the @namespace shortcut, theme tokens, updates and errors.

The text ONE URL. ONE FILE. above a command line with a component address, and an arrow to a file card that shows a before and after slider.

How do you install a component from a custom shadcn registry?

Run npx shadcn@latest add followed by the URL of the component's JSON file. The CLI downloads that file, writes the source into your project, installs the npm packages it lists and merges any CSS variables it needs. For the free Mekai UI components the whole job is one command, and the result is a file you own.

The commands below were run in a new Vite project with shadcn CLI 4.23.0 in November 2026. The first creates the project and components.json, the second adds a before and after slider. The animation shows the real output, then the component running in the project.

The short version for Mekai UI alone is the registry install guide on the Mekai UI site. This article explains how custom registries work and what to do when an install fails.

npx shadcn@latest init -t vite -n shop -y --defaults
cd shop
npx shadcn@latest add https://ui.mekaigames.com/r/before-after.json
A terminal types the shadcn add command and prints a green check for each step. A file tree on the right gains a new file named before-after.tsx, and below it a before and after slider appears and moves.
The real output of the add command, then the installed component running in the test project.

What does the CLI download from that URL?

One JSON file per component. The shadcn registry documentation calls it a registry item: a name, a type, the files with their source, and what the item depends on. Three keys decide what happens in your project.

  • files: the source code itself, with the path it should be written to. Nothing is cloned from GitHub; the code travels inside the JSON.
  • dependencies: npm packages to install. Most Mekai UI components that animate with Motion list motion. The before and after slider lists none.
  • registryDependencies: other registry items to install first. Every Mekai UI item points at theme.json by full URL, which is why the colors arrive with the first component. The docs list URLs as one valid form of this key.
A URL at the top leads to a card showing three keys of a registry item: files, dependencies and registryDependencies. An arrow from each key leads to where it ends up: a component file, package.json and the CSS file.
Each key of the JSON ends up in a different place. Values from constellation.json.

What changes in your project?

Compare the project before and after the first install and three things differ. The component file appears under the ui alias from components.json. package.json gains any npm package the item listed: after adding Constellation it gained "motion": "^14.10.1", and after the slider it gained nothing. And src/index.css gained the theme: 30 CSS variables (14 colors, repeated in the light and the dark block, plus two fonts) and three small utilities.

The theme is added once. Installing two more components did not duplicate the variables. Edit the variables in your own CSS if you want a different palette, since the components read them through classes such as bg-ink-900 and text-ember.

The mistake to avoid is expecting fonts. The theme sets --font-display to Montserrat and --font-pixel to Silkscreen, but the CLI does not download font files. Load them the way your project loads fonts, or point the two variables at fonts you already use.

A diff of src/index.css with green added lines for color variables, font variables and three utilities, next to six color swatches from near black to orange and gold.
The change to src/index.css after the first install: variables and utilities, nothing removed.

Can you type @mekai instead of the full URL?

Yes. The CLI supports namespaced registries: a registries entry in components.json maps a name that starts with @ to a URL template, and the template must contain {name}. Mekai UI serves each item at /r/<slug>.json, so the template includes the extension.

After that, npx shadcn@latest add @mekai/before-after installs the same file, and npx shadcn@latest search @mekai lists what is available. Against the local build the search returned all 53 free components with their descriptions, from an index file at /r/registry.json. Only free components are in it.

{
  "registries": {
    "@mekai": "https://ui.mekaigames.com/r/{name}.json"
  }
}

How do you update a component you already edited?

Run the same add command again. The CLI finds the file, asks whether to overwrite it, and replaces your copy if you say yes. Two flags make this safe: --dry-run previews what would change without writing, and --diff <path> prints a unified diff for one file. In the test, one extra line added to the end of the slider showed up in the diff as a removed line, so you see your own edits before they are lost.

Commit before you overwrite. Your edits live in a file the registry knows nothing about, so the CLI cannot merge them. If you changed a lot, keep your version and read the diff for the fixes you want. The what is new page lists releases, so you can see whether an update is worth the diff. The trade-off of owning the file is covered in copy-paste components vs a UI library.

One detail from the test: -y did not skip the overwrite question. Use --overwrite in scripts and CI.

Why does the install fail?

Three failures came up while testing, and each has a plain cause.

  • [Not found] undefined: the URL answered with a 404. A typo gives this, and so does a Pro component, because only free components are served at /r. Open the URL in a browser: a JSON file means the name is right.
  • Select a component library: there is no components.json in the folder you ran the command in, so the CLI starts its setup questions. Run it from the project root, or run init first.
  • already exists: the file is there already. Answer the prompt, or pass --overwrite.
Three rows. Each shows a cause, the CLI message it produces in red, gold or blue, and a short fix in green: check the slug, run init first, use overwrite.
The three failures seen in testing, with the message the CLI printed.

What about the Pro components?

They are not in the registry. Mekai UI Pro is delivered as a private GitHub repository after checkout, so there is no URL for the CLI to read. You copy the files you need from the repo into the same components/ui folder, and the repository also holds the theme as a CSS file.

The free components are MIT licensed and live in the Mekai UI repository on GitHub. A star there is the simplest way to tell us this registry is worth maintaining, and it helps other developers find it.

Related reading: the 50 new components in this release, how to keep animated heroes fast and how to respect reduced motion in React.

Questions people ask

Does a shadcn custom registry work with Next.js and Vite?
The CLI can create projects for Next.js, Vite, React Router, Astro and others. The test here was run in Vite only. Mekai UI documents Next.js, Vite and React Router, as long as the @/ alias in components.json points at your source folder.
Do I need Tailwind CSS to use the components?
Yes. The components are styled with Tailwind classes and the theme is added as Tailwind CSS 4 variables and utilities. The Vite template that init creates already has Tailwind set up.
How do I change the colors of installed components?
Edit the CSS variables the theme added to your src/index.css, such as --ember and --ink-900. Every installed component reads them through Tailwind classes, so one change restyles all of them.

Sources and further reading