Title: @wordpress/data-controls
Published: March 9, 2021
Last modified: October 16, 2026

---

# @wordpress/data-controls

## In this article

 * [Installation](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data-controls/?output_format=md#installation)
 * [API](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data-controls/?output_format=md#api)
    - [apiFetch](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data-controls/?output_format=md#apifetch)
    - [controls](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data-controls/?output_format=md#controls)
    - [dispatch](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data-controls/?output_format=md#dispatch)
    - [select](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data-controls/?output_format=md#select)
    - [syncSelect](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data-controls/?output_format=md#syncselect)
 * [Contributing to this package](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data-controls/?output_format=md#contributing-to-this-package)

The data controls module is a module intended to simplify implementation of common
controls used with the [`@wordpress/data`](https://github.com/WordPress/gutenberg/tree/HEAD/packages/data/README.md)
package.

**Note:** It is assumed that the registry being used has the controls plugin enabled
on it (see [more details on controls here](https://github.com/WordPress/gutenberg/tree/HEAD/packages/data#controls))

## 󠀁[Installation](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data-controls/?output_format=md#installation)󠁿

Install the module

    ```bash
    npm install @wordpress/data-controls --save
    ```

_This package assumes that your code will run in an **ES2015+** environment. If 
you’re using an environment that has limited or no support for such language features
and APIs, you should include [the polyfill shipped in `@wordpress/babel-preset-default`](https://github.com/WordPress/gutenberg/tree/HEAD/packages/babel-preset-default#polyfill)
in your code._

The following controls are available on the object returned by the module:

## 󠀁[API](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data-controls/?output_format=md#api)󠁿

### 󠀁[apiFetch](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data-controls/?output_format=md#apifetch)󠁿

Dispatches a control action for triggering an api fetch call.

_Usage_

    ```javascript
    import { apiFetch } from '@wordpress/data-controls';

    // Action generator using apiFetch
    export function* myAction() {
        const path = '/v2/my-api/items';
        const items = yield apiFetch( { path } );
        // do something with the items.
    }
    ```

_Parameters_

 * _request_ `Object`: Arguments for the fetch request.

_Returns_

 * `Object`: The control descriptor.

### 󠀁[controls](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data-controls/?output_format=md#controls)󠁿

The default export is what you use to register the controls with your custom store.

_Usage_

    ```javascript
    import { controls } from '@wordpress/data-controls';
    import { registerStore } from '@wordpress/data';
    import reducer from './reducer';
    import * as selectors from './selectors';
    import * as actions from './actions';
    import * as resolvers from './resolvers';

    registerStore( 'my-custom-store', {
        reducer,
        controls,
        actions,
        selectors,
        resolvers,
    } );
    ```

_Returns_

 * `Object`: An object for registering the default controls with the store.

### 󠀁[dispatch](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data-controls/?output_format=md#dispatch)󠁿

Control for dispatching an action in a registered data store. Alias for the `dispatch`
control in the `@wordpress/data` package.

_Parameters_

 * _storeNameOrDescriptor_ `string | StoreDescriptor`: The store object or identifier.
 * _actionName_ `string`: The action name.
 * _args_ `any[]`: Arguments passed without change to the `@wordpress/data` control.

### 󠀁[select](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data-controls/?output_format=md#select)󠁿

Control for resolving a selector in a registered data store. Alias for the `resolveSelect`
built-in control in the `@wordpress/data` package.

_Parameters_

 * _storeNameOrDescriptor_ `string | StoreDescriptor`: The store object or identifier.
 * _selectorName_ `string`: The selector name.
 * _args_ `any[]`: Arguments passed without change to the `@wordpress/data` control.

### 󠀁[syncSelect](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data-controls/?output_format=md#syncselect)󠁿

Control for calling a selector in a registered data store. Alias for the `select`
built-in control in the `@wordpress/data` package.

_Parameters_

 * _storeNameOrDescriptor_ `string | StoreDescriptor`: The store object or identifier.
 * _selectorName_ `string`: The selector name.
 * _args_ `any[]`: Arguments passed without change to the `@wordpress/data` control.

## 󠀁[Contributing to this package](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data-controls/?output_format=md#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).

First published

March 9, 2021

Last updated

October 16, 2026

Edit article

[ Improve it on GitHub: @wordpress/data-controls ](https://github.com/WordPress/gutenberg/edit/trunk/packages/data-controls/README.md)

[  Previous: @wordpress/customize-widgets](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-customize-widgets/)

[  Next: @wordpress/data](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data/)