Interactivity API
Warning
This package is only available in Gutenberg at the moment and not in WordPress Core as it is still very experimental, and very likely to change.
Note
This package enables the API shared at Proposal: The Interactivity API – A better developer experience in building interactive blocks. As part of an Open Source project we encourage participation in helping shape this API and the discussions in GitHub is the best place to engage.
This package can be tested, but it's still very experimental.
The Interactivity API is being used in some core blocks but its use is still very limited.
Frequently Asked Questions
At this point, some of the questions you have about the Interactivity API may be:
What is this?
This is the base of a new standard to create interactive blocks. Read the proposal to learn more about this.
Can I use it?
You can test it, but it's still very experimental.
How do I get started?
A "Getting started guide" section of the Interactivity API Docs is in progress. In the meantime check the Docs & Examples section below for resources to learn. You can also ask for guidance at the “Interactivity API” category in Gutenberg repo discussions.
Where can I ask questions?
The “Interactivity API” category in Gutenberg repo discussions is the best place to ask questions about the Interactivity API.
Where can I share my feedback about the API?
The “Interactivity API” category in Gutenberg repo discussions is also the best place to share your feedback about the Interactivity API.
Installation
Install the module:
npm install @wordpress/interactivity --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
in your code.
Docs & Examples
Interactivity API is a recent proposal and its Documentation is still in progress. In the meantime, here you have these resources to learn/read more about the Interactivity API: