CLI
Use the Shim CLI to initialize and install components.
Overview
Use the Shim CLI to initialize configuration and install components with their dependencies directly into your project.
Usage
Run commands on demand via pnpm dlx (no local install required):
pnpm dlx @kkga/shim init
pnpm dlx @kkga/shim add button dialog formTip: Add a script to your package.json for shorter commands:
{
"scripts": {
"shim": "pnpm dlx @kkga/shim"
}
}pnpm shim init
pnpm shim add button dialog formCommands
shim init
Initialize Shim in your project.
- Checks if Tailwind CSS is installed (required prerequisite)
- Installs dependencies (react-aria-components, tailwind-variants, tailwind-merge, @radix-ui/colors, @phosphor-icons/react)
- Creates a shim.config.json configuration file
- Downloads utility files (style.ts, theme.tsx) to your utils directory
- Downloads CSS theme file (theme.css) to your styles directory
shim init [options]Option | Description |
|---|---|
--components-path <path> | Destination for components (default: |
--utils-path <path> | Destination for utility files (default: |
--css-path <path> | Destination for CSS files (default: |
-f, --force | Overwrite existing config and installed files. |
shim add
Install one or more components by name.
- Dependency resolution: any required peer components are installed automatically
- Import transforms: imports inside installed components are rewritten to match the configured paths
shim add <components...> [options]Option | Description |
|---|---|
<components...> | One or more component names (e.g. |
-p, --path <path> | Destination for installed components (overrides config |
-f, --overwrite | Overwrite files that already exist. |
Examples
pnpm dlx @kkga/shim initpnpm dlx @kkga/shim init \
--components-path src/ui \
--utils-path src/lib \
--css-path src/stylespnpm dlx @kkga/shim add button dialog formpnpm dlx @kkga/shim add button --path src/features/uipnpm dlx @kkga/shim add dialog --overwrite# package.json: { "scripts": { "shim": "pnpm dlx @kkga/shim" } }
pnpm shim add buttonConfiguration File
Running init creates a configuration file in your project root:
{
"componentsPath": "components",
"utilsPath": "utils",
"cssPath": "styles"
}Paths are relative to your project root (where package.json is).
Option | Description |
|---|---|
componentsPath | Default destination for installed components. |
utilsPath | Destination for downloaded utility files. |
cssPath | Destination for downloaded CSS files. |
Troubleshooting
Tailwind CSS is not installed
shim init requires Tailwind CSS to be installed. See the
Tailwind installation guide for
framework-specific setup.
Component not found
If you get a "component not found" error, check your spelling. To see available components, visit the components section, see the registry API endpoint, or check the registry source.
Files already exist
Use --overwrite (for add) or --force (for init) to replace existing
files:
pnpm dlx @kkga/shim add button --overwrite
pnpm dlx @kkga/shim init --forceInvalid path error
Paths should be relative to your project root (where package.json is):
# ✓ Good
pnpm dlx @kkga/shim init --components-path src/components
# ✗ Bad (absolute filesystem path)
pnpm dlx @kkga/shim init --components-path /Users/name/project/src/components