react-thaizip

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 --help

Prefix a command with npx when running it, for example npx react-thaizip add autocomplete.

init

npx react-thaizip init

init performs these steps in order:

  1. 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.
  2. Lets you confirm or change componentDir unless --yes is present.
  3. Adds design tokens to a global stylesheet, if one was found.
  4. Offers to install thaizip when it is missing.
  5. Writes thaizip.config.json.
  6. If any manual follow-up steps are needed (the Tailwind v3 theme.extend snippet, or the design-token block when no global CSS was found), prints all of them together at the very end, under === Manual steps required ===.
  7. 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 autocomplete

Add multiple targets by separating their names with spaces:

npx react-thaizip add autocomplete cascade-select

With no targets, add opens an interactive multiselect containing all five public components:

npx react-thaizip add

Public names and aliases

Name matching is case-insensitive.

ComponentAccepted names and aliases
ThaiAddressAutocompleteautocomplete, thai-address-autocomplete, ThaiAddressAutocomplete
ThaiAddressCascadeSelectcascade, cascade-select, thai-address-cascade-select, ThaiAddressCascadeSelect
ThaiAddressFormaddress-form, thai-address-form, ThaiAddressForm
ThaiAddressDisplayaddress-display, thai-address-display, ThaiAddressDisplay
ThaiAddressFormFieldaddress-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

FlagEffect
--yes, -ySkips confirmation prompts and uses each prompt's default answer.
--overwriteReplaces existing component files without asking, and unlocks replacing lib/hook files that are otherwise protected. Applies only to add.
--help, -hPrints help; place it after init or add for command-scoped help.
--version, -vPrints 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.

On this page