Gutenberg itself already exposes a lot of components ready to be re-used in our custom blocks. Most of these are located in
wp.blocks, and they include helpful building blocks for every Gutenberg block: Text Controls, Toggles, Tooltips, Icon Buttons, Tabs, and many many others. Gutenberg’s native component library pretty much has us covered on all basic cases, on every kind of basic UI control we might need but still there are cases where we might need to take it a step further on some kind of more specialized custom block.
With Gutenberg getting close to being ready for a beta release and ultimately being merged into core WP, its API and patterns are at a level mature enough that theme authors (and theme shops!) can start planning ahead for the inevitable adoption of the new block system.
In this post we’ll see what the average theme author should have in mind when updating a theme for Gutenberg compatibility and ponder about the future in theme and plugin editing.
Gutenberg comes with a set of core libraries which are necessary for any kind of custom block development. Namely those libraries are:
- @wordpress/components: Generic, reusable UI WordPress components
- @wordpress/i18n: Internationalization utilities
- @wordpress/element: Abstraction on top of React
- @wordpress/date: Date formatting and manipulation utilities
- @wordpress/blocks: Module providing utilities for registering and building blocks
- @wordpress/data: Abstraction on top of Redux
- @wordpress/editor: Module representing the WordPress Editor’s page
- @wordpress/utils: Various generic utilities
To use them you need to include them as external script requirements to your final build by registering and enqueueing them, similarly to how you’d include any kind of script or style within WordPress.
Gutenberg, the new and modular editing experience for WordPress, has been in rapid development throughout the past year and will soon arrive to our WordPress installations. Gutenberg will be released along with WordPress 5.0 (which is the next major release), and although no official date has been set for that, it’s safe to assume that it’s not very far away especially judging by the remaining features for MVP completion.
Gutenberg is right around the corner with a speculated release in the second quarter of 2018, but what is Gutenberg? In short it’s the new editor experience for WordPress. The project aims to give you broader, better, and more consistent control on your content, and later, along the way your entire page layouts. The aim, at least at the beginning is to unify all content elements into what are called blocks. In the current editor experience, text, media items, shortcodes, links, offer quite different experiences when creating and customizing them. The introduction of Gutenberg blocks aims to make things more consistent for users that just want to create content without even knowing what a shortcode is.
If you are interested to learn more about the project (as you should because it will be in a WordPress installation near you pretty soon) you can check out the project’s page here.