Loading...
Please waitLoading...
Please waitCommand-line tool for installing UseKit hooks into React projects, browsing the registry, and building hook JSON from a local registry file.
Requires Node.js 20+ (see the uselab package engines field).
pnpm add -g uselab
Or run directly without installation:
pnpm dlx uselab@latest --help
Initialize your project:
pnpm dlx uselab@latest init
Install a hook:
pnpm dlx uselab@latest add use-network-status
View available hooks:
pnpm dlx uselab@latest list
Commands at a glance: add (install hooks), init (project config), view (inspect before install), list / search (discover hooks), build (compile a local registry JSON into per-hook JSON files for publishing or tooling).
add - Install HooksInstall one or more hooks from the registry, URL, or local file path.
pnpm dlx uselab@latest add [options] [hooks...]
[hooks...] - Hook name(s), URL(s), or local path(s) (space-separated)
Registry names: Accepts kebab-case or camelCase format
use-network-status, useToggle, useCounterURLs: Full URL to a hook JSON file
https://example.com/hooks/use-custom.jsonLocal paths: Relative or absolute path to a local hook JSON file
./hooks/use-custom.json, ../shared/use-utils.json| Option | Description | Default |
|---|---|---|
-y, --yes | Skip confirmation prompts. Implies --overwrite when files exist | false |
--overwrite | Overwrite existing hook files if they already exist | false |
--js | Install the JavaScript variant when the hook defines TS/JS variants | Auto-detect |
--ts | Install the TypeScript variant | Auto-detect |
-c, --cwd <path> | Working directory for resolving package.json and hooks directory | Current directory |
-p, --path <path> | Custom installation path (overrides hooks config) | Uses config |
Do not pass --js and --ts together; the CLI will error if both are set.
Install a single hook:
pnpm dlx uselab@latest add use-network-status
pnpm dlx uselab@latest add useToggle
pnpm dlx uselab@latest add use-counter
Install multiple hooks:
pnpm dlx uselab@latest add use-counter use-toggle use-network-status
pnpm dlx uselab@latest add useBattery useCounter useToggle
Skip confirmation prompts:
pnpm dlx uselab@latest add use-counter --yes
pnpm dlx uselab@latest add use-toggle -y
Overwrite existing files:
pnpm dlx uselab@latest add use-network-status --overwrite
pnpm dlx uselab@latest add use-counter --overwrite --yes
Specify working directory:
pnpm dlx uselab@latest add use-toggle --cwd /path/to/project
pnpm dlx uselab@latest add use-counter -c ./my-project
Custom installation path:
pnpm dlx uselab@latest add use-counter --path src/custom/hooks
pnpm dlx uselab@latest add use-toggle -p lib/hooks
Force JavaScript or TypeScript variant (when the registry item ships both):
pnpm dlx uselab@latest add use-counter --js
pnpm dlx uselab@latest add use-counter --ts
Install from URL:
pnpm dlx uselab@latest add https://example.com/hooks/use-custom.json
pnpm dlx uselab@latest add https://cdn.example.com/hooks/use-utils.json
Install from local file:
pnpm dlx uselab@latest add ./local-hooks/use-custom.json
pnpm dlx uselab@latest add ../shared-hooks/use-utils.json
pnpm dlx uselab@latest add /absolute/path/to/hook.json
Combined options:
pnpm dlx uselab@latest add use-counter use-toggle --yes --path src/hooks
pnpm dlx uselab@latest add use-network-status --overwrite --cwd ./project
add without arguments displays usage instructions and examples--yes flag automatically overwrites existing files without prompting--js or --ts to overrideinit - Initialize ProjectInitialize uselab configuration in your project by creating a uselab.json file.
pnpm dlx uselab@latest init [options]
| Option | Description | Default |
|---|---|---|
-c, --cwd <path> | Working directory used to locate package.json and write config | Current directory |
Initialize in current directory:
pnpm dlx uselab@latest init
Initialize in specific directory:
pnpm dlx uselab@latest init --cwd /path/to/project
pnpm dlx uselab@latest init -c ./my-project
Creates a uselab.json file in your project root:
{
"hooks": "src/hooks"
}If the project is already initialized (hooks is already set in uselab.json), the CLI prints a short message and leaves the config unchanged.
view - Preview Hook DetailsView detailed information about hook(s) before installing, including code preview, dependencies, and file structure.
pnpm dlx uselab@latest view [options] [hooks...]
[hooks...] - Hook name(s) to view (space-separated, optional)
Shows usage help if omitted
Accepts kebab-case or camelCase format
| Option | Description | Default |
|---|---|---|
--format <format> | Output format: code or json | code |
View a single hook:
pnpm dlx uselab@latest view use-network-status
pnpm dlx uselab@latest view useToggle
pnpm dlx uselab@latest view use-counter
View multiple hooks:
pnpm dlx uselab@latest view use-counter use-toggle
pnpm dlx uselab@latest view use-network-status useBattery useCounter
View as JSON:
pnpm dlx uselab@latest view use-network-status --format json
pnpm dlx uselab@latest view use-counter --format json
View multiple hooks as JSON:
pnpm dlx uselab@latest view use-counter use-toggle --format json
Code format (default):
[ts] / [js] labels for variant hooks)JSON format:
list - List Available HooksList all available hooks from the UseKit registry with filtering and pagination support.
pnpm dlx uselab@latest list [options]
| Option | Description | Default |
|---|---|---|
-q, --query <query> | Filter hooks by query (searches in name, title, description) | None (shows all) |
-l, --limit <number> | Maximum number of results to show | 100 |
-o, --offset <number> | Number of results to skip for pagination | 0 |
--skip-limit | Ignore pagination and show all results | false |
--format <format> | Output format: table or json | table |
List all hooks:
pnpm dlx uselab@latest list
Filter by query:
pnpm dlx uselab@latest list --query network
pnpm dlx uselab@latest list -q "state management"
pnpm dlx uselab@latest list --query counter
Limit results:
pnpm dlx uselab@latest list --limit 20
pnpm dlx uselab@latest list -l 50
Pagination:
pnpm dlx uselab@latest list --offset 10
pnpm dlx uselab@latest list --limit 20 --offset 10
pnpm dlx uselab@latest list -l 10 -o 20
Filter with pagination:
pnpm dlx uselab@latest list --query network --limit 10 --offset 10
pnpm dlx uselab@latest list -q network -l 20 -o 0
Show all results (ignore pagination):
pnpm dlx uselab@latest list --skip-limit
pnpm dlx uselab@latest list --query network --skip-limit
pnpm dlx uselab@latest list -q "state" --skip-limit
JSON output:
pnpm dlx uselab@latest list --format json
pnpm dlx uselab@latest list --format json --limit 10
pnpm dlx uselab@latest list -q network --format json
Combined options:
pnpm dlx uselab@latest list --query network --limit 20 --offset 10 --format json
pnpm dlx uselab@latest list -q counter --skip-limit --format json
Table format (default):
JSON format:
Array of hook objects with only essential fields:
[
{
"name": "use-network-status",
"title": "Use Network Status",
"description": "Monitor network status..."
}
]search - Search HooksSearch for hooks in the registry with the same filtering and pagination behavior as list, with an optional positional query for quick typing.
pnpm dlx uselab@latest search [options] [query]
[query] - Optional search string. Equivalent to -q, --query when used alone. If you pass both, the --query value takes precedence.| Option | Description | Default |
|---|---|---|
-q, --query <query> | Search query string (searches in name, title, description) | None (shows all) |
-l, --limit <number> | Maximum number of results to display | 100 |
-o, --offset <number> | Number of results to skip for pagination | 0 |
--skip-limit | Ignore pagination and show all results | false |
Search all hooks:
pnpm dlx uselab@latest search
Search with query:
pnpm dlx uselab@latest search network
pnpm dlx uselab@latest search -q network
pnpm dlx uselab@latest search --query "state management"
Limit search results:
pnpm dlx uselab@latest search --limit 10
pnpm dlx uselab@latest search -l 20
pnpm dlx uselab@latest search network --limit 5
Pagination:
pnpm dlx uselab@latest search --offset 10
pnpm dlx uselab@latest search --limit 20 --offset 10
pnpm dlx uselab@latest search network -l 10 -o 5
Filter with pagination:
pnpm dlx uselab@latest search --query network --limit 20 --offset 10
pnpm dlx uselab@latest search -q "state" -l 15 -o 0
Show all results (ignore pagination):
pnpm dlx uselab@latest search --skip-limit
pnpm dlx uselab@latest search network --skip-limit
pnpm dlx uselab@latest search -q "state management" --skip-limit
Combined options:
pnpm dlx uselab@latest search --query network --limit 20 --offset 10
pnpm dlx uselab@latest search -q counter --skip-limit
listlist supports --format json; search is interactive table output onlysearch accepts an optional positional query (search network) as well as -q / --querybuild - Build registry hook JSONFor registry authors: read a registry JSON file (with an items array), load each hook’s source files from disk, embed file contents, and emit one JSON file per hook under an output directory. TypeScript sources are transpiled to JavaScript when building ts/js variants (using the TypeScript compiler API).
pnpm dlx uselab@latest build [options]
| Option | Description | Required |
|---|---|---|
-r, --registry <path> | Path to the registry JSON file (relative to cwd or absolute) | Yes |
-o, --output <path> | Directory where {hook-name}.json files are written | Yes |
-c, --cwd <path> | Working directory for resolving paths | No (default: current directory) |
pnpm dlx uselab@latest build --registry registry.json --output dist/hooks
pnpm dlx uselab@latest build -r registry.json -o dist --cwd /path/to/project
files array (with a warning){name}.json with embedded files (including variants with content when applicable)$schema to https://usekit.vercel.app/schema/registry-item.json on each output fileAvailable for all commands:
| Option | Description |
|---|---|
-v, --version | Show the current version |
-h, --help | Show help information for a command |
pnpm dlx uselab@latest --version
pnpm dlx uselab@latest --help
pnpm dlx uselab@latest add --help
pnpm dlx uselab@latest list --help
pnpm dlx uselab@latest build --help
The CLI creates a uselab.json file in your project root when you run init:
{
"hooks": "src/hooks"
}By default, hooks are installed to:
src/hooks/ if a src directory existshooks/ in the project root otherwiseYou can customize this in the uselab.json configuration file, or use the --path option when installing hooks.
| Option | Description | Default |
|---|---|---|
hooks | Relative path to hooks directory | src/hooks or hooks/ |
The add command supports three types of hook sources:
Install hooks from the official UseKit registry:
pnpm dlx uselab@latest add use-network-status
pnpm dlx uselab@latest add useToggle
Install hooks from a remote URL:
pnpm dlx uselab@latest add https://example.com/hooks/use-custom.json
pnpm dlx uselab@latest add https://cdn.example.com/hooks/use-utils.json
Requirements:
Install hooks from a local file path:
pnpm dlx uselab@latest add ./local-hooks/use-custom.json
pnpm dlx uselab@latest add ../shared-hooks/use-utils.json
pnpm dlx uselab@latest add /absolute/path/to/hook.json
Requirements:
Visit hooks to browse all available hooks.
You can also use the CLI to explore:
List all hooks
pnpm dlx uselab@latest list
Search for hooks
pnpm dlx uselab@latest search network
View hook details
pnpm dlx uselab@latest view use-network-status