NextUI CLI
Here's the API reference for the NextUI CLI
.
Once the CLI
is installed, run the following command to display available commands:
To get a list of the available CLI commands, run the following command inside your project directory:
This will produce the following help output:
Commands
Init
Initialize a new NextUI project with official templates.
Init Options
-t --template [string]
The template to use for the new project e.g. app, pages, vite-p --package [string]
The package manager to use for the new project (default:npm
)
Example
output:
Add
Add NextUI components to your project.
Features
- Auto add the missing required
dependencies
to your project- Auto add the required
tailwindcss.config.js
configuration to your project- Detect whether using pnpm, if so, add the required configuration to your
.npmrc
file
Add Options
-a --all
[boolean] Add all the NextUI components (default:false
)-p --packagePath
[string] The path to the package.json file-tw --tailwindPath
[string] The path to the tailwind.config file file-app --appPath
[string] The path to the App.tsx file--prettier
[boolean] Add prettier format in the add content which required installed prettier - (default:false
)--addApp
[boolean] Add App.tsx file content which required provider (default:false
)-b --beta
[boolean] Add beta components (default:false
)
Example
Without setting a specific component, the add
command will show a list of available components.
Output:
If you want to add a specific component, you can specify the component name.
Output:
Upgrade
Upgrade the NextUI components to the latest version.
Upgrade Options
-p --packagePath
[string] The path to the package.json file-a --all
[boolean] Upgrade all the NextUI components (default:false
)-w --write
[boolean] Write the upgrade version to package.json file (default:false
)-b --beta
[boolean] Upgrade beta components (default:false
)-h --help
Display help for command
Example
Upgrade the Button component to the latest version.
Output:
Remove
Remove NextUI components from your project.
Note: If there are no NextUI components after removing, the required content will also be removed
Remove Options
-p --packagePath
[string] The path to the package.json file-a --all
[boolean] Remove all the NextUI components (default:false
)-tw --tailwindPath
[string] The path to the tailwind.config file file--prettier
[boolean] Add prettier format in the add content which required installed prettier - (default:false
)
Example
Remove the Button component from your project.
Output:
List
List all the current installed components.
List Options
-p --packagePath
[string] The path to the package.json file-r --remote
List all components available remotely
Example
Output:
Doctor
Check whether exist problem in your project by using the doctor
command.
Features
- Check whether have
redundant dependencies
in the project- Check whether the NextUI components
required dependencies are installed
in the project- Check the required
tailwind.config.js
file and the content is correct- Check
.npmrc
is correct when usingpnpm
- Check
peerDependencies with required version
are installed in the project
Doctor Options
-p
--packagePath
[string] The path to the package.json file-tw
--tailwindPath
[string] The path to the tailwind.config file file-app
--appPath
[string] The path to the App.tsx file-ca
--checkApp
[boolean] Open check App (default:true
)-ct
--checkTailwind
[boolean] Open check tailwind.config file (default:true
)-cp
--checkPnpm
[boolean] Open check Pnpm (default:true
)
Example
Output:
If there is a problem in your project, the doctor
command will display the problem information.
Otherwise, the doctor
command will display the following message.
Env
Display debug information about the local environment.
Env Options
-p --packagePath
[string] The path to the package.json file
Example
Display the local environment Information by using the env
command.
Output: