CLI

Learn how to generate components and theme using CLI commands.

Installation

To use CLI, you need to install @yamada-ui/cli in your project.

pnpm add -D @yamada-ui/cli

Commands

init

When you run the init command, the necessary files and folders for your project will be created.

pnpm yamada-cli init
Usage: pnpm yamada-cli init [options]

initialize your project and install dependencies

Options:
  --cwd <path>         current working directory
  -c, --config <path>  path to the config file (default: "ui.json")
  -o, --overwrite      overwrite existing files. (default: false)
  -j, --jsx            use jsx instead of tsx (default: false)
  -h, --help           display help for command

After running the init command, you will see the following prompts.

Would you like to use monorepo? (recommended) … No / Yes
What is the path to the monorepo? … ./workspaces/ui
What is the package name? … @workspaces/ui
Would you like your code inside a `src/` directory? … No / Yes
Would you like to use Prettier? … No / Yes
Would you like to use ESLint? … No / Yes

After the prompts, the config and required dependencies will be installed.

add

When you run the add command, the specified component and its dependencies will be added to your project.

pnpm yamada-cli add box

If you don't specify a component, all available components will be added.

pnpm yamada-cli add
Usage: pnpm yamada-cli add [options] [components...]

add a component to your project

Arguments:
  components           components to add

Options:
  --cwd <path>         current working directory
  -c, --config <path>  path to the config file (default: "ui.json")
  -o, --overwrite      overwrite existing files. (default: false)
  -i, --install        install dependencies (default: false)
  -s, --sequential     run tasks sequentially. (default: false)
  -f, --format         format the output files.
  -l, --lint           lint the output files.
  -h, --help           display help for command

diff

When you run the diff command, you can check the difference between the local and remote components.

pnpm yamada-cli diff box

If you don't specify a component, you can check the difference for all components in your project.

pnpm yamada-cli diff
Usage: pnpm yamada-cli diff [options] [component]

check for updates against the registry

Arguments:
  component            component to check

Options:
  --cwd <path>         current working directory
  -c, --config <path>  path to the config file (default: "ui.json")
  -s, --sequential     run tasks sequentially. (default: false)
  -d, --detail         show detailed changes (default: false)
  -h, --help           display help for command

update

When you run the update command, the specified component will be updated.

pnpm yamada-cli update box

If you don't specify a component, all components in your project will be updated.

pnpm yamada-cli update
Usage: pnpm yamada-cli update [options] [components...]

update components in your project

Arguments:
  components           components to update

Options:
  --cwd <path>         current working directory
  -c, --config <path>  path to the config file (default: "ui.json")
  -i, --install        install dependencies (default: false)
  -s, --sequential     run tasks sequentially. (default: false)
  -f, --format         format the output files.
  -l, --lint           lint the output files.
  -h, --help           display help for command

theme

When you run the theme command, the theme will be generated at the specified path.

pnpm yamada-cli theme
Usage: pnpm yamada-cli theme [options] [path]

generate theme to your project

Arguments:
  path                 path to the theme directory

Options:
  --cwd <path>         current working directory
  -c, --config <path>  path to the config file (default: "ui.json")
  -o, --overwrite      overwrite existing directory. (default: false)
  -j, --js             use js instead of ts
  -f, --format         format the output files.
  -l, --lint           lint the output files.
  -h, --help           display help for command

tokens

When you run the tokens command, you can update the customized theme typings. This typings are used for Style Props.

pnpm yamada-cli tokens
Usage: pnpm yamada-cli tokens [options] [path]

generate theme typings

Arguments:
  path                 path to the theme file

Options:
  --cwd <path>         current working directory
  -c, --config <path>  path to the config file (default: "ui.json")
  -o, --out <path>     output path
  -f, --format         format the output file
  -l, --lint           lint the output file
  --internal           generate internal tokens (default: false)
  -h, --help           display help for command

Configuration

After running the init command, a ui.json will be generated in your project. You can customize it in various ways.

PropertyDefaultDescription
path./uiThe path to the workspace.
monorepofalseWhether to use a monorepo.
jsxfalseWhether to use JSX.
theme.path./themeThe path to the theme directory.
components.path./componentsThe path to the components directory.
components.overwritetrueWhether to update the local references of existing components when components are added.
components.dependentstrueWhether to add dependents of components when components are added.
components.dependenciesfalseWhether to add dependencies of components when components are added.
hooks.path./hooksThe path to the hooks directory.
hooks.overwritefalseWhether to update the local references of existing hooks when components are added.
hooks.dependentstrueWhether to add dependents of hooks when hooks are added.
hooks.dependenciesfalseWhether to add dependencies of hooks when hooks are added.
providers.path./providersThe path to the providers directory.
providers.overwritefalseWhether to update the local references of existing providers when components are added.
providers.dependentstrueWhether to add dependents of providers when providers are added.
providers.dependenciesfalseWhether to add dependencies of providers when providers are added.
format.configPath-The path to the config file for Prettier.
format.enabledfalseWhether to run the --write option of Prettier when components are added or updated.
lint.enabledfalseWhether to run the --fix option of ESLint when components are added or updated.