CLI reference
react-thaizip command syntax, flags, aliases, and component selection
Run the CLI through npx react-thaizip from the root of the React or Next.js project you want to scaffold.
Command syntax
react-thaizip init [--yes]
react-thaizip add [component...] [--yes] [--overwrite]
react-thaizip --help
react-thaizip --version
react-thaizip init --help
react-thaizip add --helpPrefix a command with npx when running it, for example npx react-thaizip add autocomplete.
init
npx react-thaizip initinit performs these steps in order:
- Detects the package manager, project structure, TypeScript, shadcn/ui style, and Tailwind CSS v3 or v4 (which must already be installed), then prints a detection summary before asking anything.
- Lets you confirm or change
componentDirunless--yesis present. - Adds design tokens to a global stylesheet, if one was found.
- Offers to install
thaizipwhen it is missing. - Writes
thaizip.config.json. - If any manual follow-up steps are needed (the Tailwind v3
theme.extendsnippet, or the design-token block when no global CSS was found), prints all of them together at the very end, under=== Manual steps required ===. - Prints the next step:
Next: run \npx react-thaizip add autocomplete` to add your first component.`
Sample output at the start of a run:
Detected project settings:
Components directory: app/components
Lib directory: lib
Hooks directory: hooks
Package manager: npm
Language: TypeScript
Tailwind: v4 (app/globals.css)
Component style: vanilla Tailwind (no components.json found)Tailwind is always detected before the componentDir prompt, so a project without Tailwind installed stops immediately, before any question is asked.
See the configuration reference for the file shape and detection rules.
add
Add one component:
npx react-thaizip add autocompleteAdd multiple targets by separating their names with spaces:
npx react-thaizip add autocomplete cascade-selectWith no targets, add opens an interactive multiselect containing all five public components:
npx react-thaizip addPublic names and aliases
Name matching is case-insensitive.
| Component | Accepted names and aliases |
|---|---|
ThaiAddressAutocomplete | autocomplete, thai-address-autocomplete, ThaiAddressAutocomplete |
ThaiAddressCascadeSelect | cascade, cascade-select, thai-address-cascade-select, ThaiAddressCascadeSelect |
ThaiAddressForm | address-form, thai-address-form, ThaiAddressForm |
ThaiAddressDisplay | address-display, thai-address-display, ThaiAddressDisplay |
ThaiAddressFormField | address-form-field, thai-address-form-field, ThaiAddressFormField |
add pulls in each target's shared files automatically: all components use utils; address-index consumers also use the index hook, and cascade-based components use the cascade hook and select. These internal dependencies are not shown in the multiselect or --help, and you do not need to name them.
Before writing files, add checks that an existing thaizip is at least 0.7.5, offers to install missing dependencies, and writes files to the directories in thaizip.config.json. The selected component style comes from init: vanilla interactive components use Base UI; supported shadcn/ui projects use their Base, Radix, or React Aria primitives, with missing primitives installed by the shadcn CLI.
Flags
| Flag | Effect |
|---|---|
--yes, -y | Skips confirmation prompts and uses each prompt's default answer. |
--overwrite | Replaces existing component files without asking, and unlocks replacing lib/hook files that are otherwise protected. Applies only to add. |
--help, -h | Prints help; place it after init or add for command-scoped help. |
--version, -v | Prints the CLI version. |
Recognized flags can appear anywhere in the argument list. If help and version are both present, help always wins, and neither init nor add runs.
--yes does not mean “overwrite everything.” The default answer to component and config overwrite prompts is no, so existing files remain skipped. Use --overwrite separately when you intentionally want to replace a component. Existing hook and lib files stay protected by default even with --yes, since you're expected to hand-edit them; only an explicit --overwrite replaces them.
An unknown flag exits with an error before the command runs. See Troubleshooting for installation and existing-file recovery.