# @wordpress/create-block

> Generates PHP, JS and CSS code for registering a block for a WordPress plugin.

Latest version **4.99.0** (published 2026-09-23) · GPL-2.0-or-later license · 0 weekly downloads

## Install

```sh
npm install @wordpress/create-block
pnpm add @wordpress/create-block
yarn add @wordpress/create-block
bun add @wordpress/create-block
```

Provides the command `wp-create-block`.

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score; popular repo.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 4.99.0 |
| Published | 2026-09-23 |
| First published | 2020-02-04 |
| Weekly downloads | 0 |
| License | GPL-2.0-or-later |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=20.10.0 |
| Dependencies | 12 |
| Unpacked size | 94.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11753 |
| Author | The WordPress Contributors |
| Maintainers | garypendergast, adamsilverstein, gziolo, ntwb, riad, noisysocks, kadamwhite, gutenbergplugin, jorgefilipecosta, ellatrix, iandunn206, whyisjake, ockham, sirreal, nosolosw, wpisabel, ntsekouras, nerrad, desrosj, talldanwp, peterwilsoncc, ryanwelcher, mamaduka, aduth, johnbillion |
| Keywords | wordpress, gutenberg, block, scaffold |

## Links

- npm: https://www.npmjs.com/package/@wordpress/create-block
- Repository: https://github.com/WordPress/gutenberg
- Homepage: https://github.com/WordPress/gutenberg/tree/HEAD/packages/create-block/README.md
- Issues: https://github.com/WordPress/gutenberg/issues
- npm.io page: https://npm.io/package/@wordpress/create-block

## Dependencies (12)

- [chalk](https://npm.io/package/chalk.md) ^4.1.1
- [execa](https://npm.io/package/execa.md) ^4.0.2
- [rimraf](https://npm.io/package/rimraf.md) ^5.0.10
- [make-dir](https://npm.io/package/make-dir.md) ^3.0.0
- [mustache](https://npm.io/package/mustache.md) ^4.0.0
- [commander](https://npm.io/package/commander.md) ^9.2.0
- [fast-glob](https://npm.io/package/fast-glob.md) ^3.2.7
- [write-pkg](https://npm.io/package/write-pkg.md) ^4.0.0
- [change-case](https://npm.io/package/change-case.md) ^4.1.2
- [npm-package-arg](https://npm.io/package/npm-package-arg.md) ^8.1.5
- [@inquirer/prompts](https://npm.io/package/@inquirer/prompts.md) ^7.2.0
- [check-node-version](https://npm.io/package/check-node-version.md) ^4.1.0

## Alternatives

- [@oh-my-pi/pi-natives](https://npm.io/package/@oh-my-pi/pi-natives.md) — 51.8K weekly downloads
- [@capgo/capacitor-light-sensor](https://npm.io/package/@capgo/capacitor-light-sensor.md) — 3.0K weekly downloads
- [@heyhuynhgiabuu/pi-diff](https://npm.io/package/@heyhuynhgiabuu/pi-diff.md) — 492 weekly downloads
- [@lotsa/verdant-lang-asm](https://npm.io/package/@lotsa/verdant-lang-asm.md) — 38 weekly downloads
- [new-era-syntax](https://npm.io/package/new-era-syntax.md) — 20 weekly downloads

## Recent versions

- 4.99.0 (latest) — 2026-09-23
- 4.98.1-next.v.202609171837.0 (next) — 2026-09-17
- 4.83.1 (wp-7.0) — 2026-06-30
- 4.76.1 (wp-6.9) — 2025-10-28
- 4.62.1 (wp-6.8) — 2025-03-10
- 4.51.1 (wp-6.7) — 2024-09-19
- 4.43.1 (wp-6.6) — 2024-06-11
- 4.35.1 (wp-6.5) — 2024-02-20
- 4.26.13 (wp-6.4) — 2023-11-13
- 4.19.2 (wp-6.3) — 2023-10-12
- 4.10.2 (wp-6.2) — 2023-10-12
- 4.1.1 (wp-6.1) — 2022-09-20
- 3.1.1 (wp-6.0) — 2022-04-19
- 2.7.0 (wp-5.9) — 2021-11-08
- 2.3.2 (wp-5.8) — 2021-05-31
- … 233 more at https://npm.io/package/@wordpress/create-block/versions

## README

# Create Block

Create Block is an **officially supported tool for scaffolding a WordPress plugin that registers a block**. It generates PHP, JS, CSS code, and everything you need to start the project. It also integrates a modern build setup with no configuration.

_It is largely inspired by [create-react-app](https://create-react-app.dev/docs/getting-started). Major kudos to [@gaearon](https://github.com/gaearon), the whole Facebook team, and the React community._

> **Blocks are the fundamental elements of modern WordPress sites**. Introduced in [WordPress 5.0](https://wordpress.org/news/2018/12/bebo/), they allow [page and post builder-like functionality](https://wordpress.org/gutenberg/) to every up-to-date WordPress website.

> _Learn more about the [Block API at the Gutenberg HandBook](https://developer.wordpress.org/block-editor/developers/block-api/block-registration/)._

## Quick start

```bash
$ npx @wordpress/create-block@latest todo-list
$ cd todo-list
$ npm start
```

The `slug` provided (`todo-list` in the example) defines the folder name for the scaffolded plugin and the internal block name. The WordPress plugin generated must [be installed manually](https://wordpress.org/documentation/article/manage-plugins/#manual-plugin-installation-1).

_(requires `node` version `20.10.0` or above)_

> [Watch a video introduction to create-block on Learn.wordpress.org](https://learn.wordpress.org/tutorial/using-the-create-block-tool/)

## Usage

The `create-block` command generates a project with PHP, JS, and CSS code for registering a block with a WordPress plugin.

```bash
$ npx @wordpress/create-block@latest [options] [slug]
```

![Demo](https://user-images.githubusercontent.com/699132/103872910-4de15f00-50cf-11eb-8c74-67ca91a8c1a4.gif)

> The name for a block is a unique string that identifies a block. Block Names are structured as `namespace`/`slug`, where namespace is the name of your plugin or theme.

> In most cases, we recommended pairing blocks with WordPress plugins rather than themes, because only using plugin ensures that all blocks still work when your theme changes.

### Interactive Mode

When no `slug` is provided, the script will run in interactive mode and will start prompting for the input required (`slug`, title, namespace...) to scaffold the project.

### `namespace`

By default, blocks are created with the `create-block` namespace. You should specify your own unique namespace:

```bash
$ npx @wordpress/create-block@latest my-block --namespace=my-namespace
```

This creates `my-namespace/my-block` instead of `create-block/my-block`.

If you've already created a block, update the namespace in:
- `block.json` - the `name` property

### `slug`

The use of `slug` is optional.

When provided it triggers the _quick mode_, where this `slug` is used:

-   as the block slug (required for its identification)
-   as the output location (folder name) for scaffolded files
-   as the name of the WordPress plugin.

The rest of the configuration is set to all default values unless overridden with some options listed below.

### `options`

```bash
-V, --version                output the version number
-t, --template <name>        project template type name; allowed values: "standard" (default), "es5", the name of an external npm package, or the path to a local directory
--variant                    choose a block variant as defined by the template
--no-plugin                  scaffold block files only
--target-dir <directory>     the directory where the files will be scaffolded, defaults to the slug
--namespace <value>          internal namespace for the block name
--title <value>              display title for the block and the WordPress plugin
--short-description <value>  short description for the block and the WordPress plugin
--category <name>            category name for the block
--wp-scripts                 enable integration with `@wordpress/scripts` package
--no-wp-scripts              disable integration with `@wordpress/scripts` package
--wp-env                     enable integration with `@wordpress/env` package
--textdomain <value>         text domain for internationalization
-h, --help                   output usage information
```

#### `--template`

This argument specifies an _external npm package_ as a template.

```bash
$ npx @wordpress/create-block@latest --template my-template-package
```

This argument also allows to pick a _local directory_ as a template.

```bash
$ npx @wordpress/create-block@latest --template ./path/to/template-directory
```

#### `--variant`

With this argument, `create-block` will generate a [dynamic block](https://developer.wordpress.org/block-editor/getting-started/glossary/#dynamic-block) based on the built-in template.

```bash
$ npx @wordpress/create-block@latest --variant dynamic
```

#### `--no-plugin`

With this argument, the `create-block` package runs in _No plugin mode_ which only scaffolds block files into the current directory.

```bash
$ npx @wordpress/create-block@latest --no-plugin
```

#### `--wp-env`

With this argument, the `create-block` package will add to the generated plugin the configuration and the script to run [`wp-env` package](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/) within the plugin. This will allow you to easily set up a local WordPress environment (via Docker) for building and testing the generated plugin.

```bash
$ npx @wordpress/create-block@latest --wp-env
```

#### `--textdomain`

With this argument, the `create-block` package will a generate a block with the provided text domain. If not specified, the block’s slug is used as the default text domain.

```bash
$ npx @wordpress/create-block@latest --textdomain my-custom-domain
```

#### `--help`

With this argument, the `create-block` package outputs usage information.

```bash
$ npx @wordpress/create-block@latest --help
```

## Available commands in the scaffolded project

The plugin folder created when executing this command, is a node package with a modern build setup that requires no configuration.

A set of scripts is available from inside that folder (provided by the `scripts` package) to make your work easier. [Click here](https://github.com/WordPress/gutenberg/tree/HEAD/packages/scripts#available-scripts) for a full description of these commands.

_Note: You don’t need to install or configure tools like [webpack](https://webpack.js.org), [Babel](https://babeljs.io) or [ESLint](https://eslint.org) yourself. They are preconfigured and hidden so that you can focus on coding._

For example, running the `start` script from inside the generated folder (`npm start`) would automatically start the build for development.

## External Project Templates

[Click here](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-create-block/packages-create-block-external-template/) for information on External Project Templates

## Contributing to this package

This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/) and used by [WordPress](https://make.wordpress.org/core/) as well as other software projects.

To find out more about contributing to this package or Gutenberg as a whole, please read the project's main [contributor guide](https://github.com/WordPress/gutenberg/tree/HEAD/CONTRIBUTING.md).

<br /><br /><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>

---
_Source: https://npm.io/package/@wordpress/create-block · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
