Skip to content

juanma-wp/block-development-examples

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Block Development Examples

Release with Examples Zips πŸ” Static Linting

Important

Go to the Block Development Examples Web App to navigate through the examples

 
Go to the Block Development Examples Web App
 

Welcome to the block-development-examples repo on GitHub. Here you can find a bunch of block-related examples for WordPress that you can use to learn about Block Development.

Check the code, download the plugin zip πŸ“¦ or see a playground-powered live demo of each example

Example Description Tags Download .zip Live Demo
Basic Block with Dynamic Rendering Demonstrates how to create a block that renders its content dynamically on the server side rather than saving static content in the post content. dynamic-rendering create-block πŸ“¦
Basic Block with Translations Shows how to implement internationalization (i18n) in a WordPress block using both PHP and JavaScript translations, demonstrating proper setup of translation files and functions. static-rendering πŸ“¦
Block with Static Rendering Illustrates how to create a block that saves its content as static HTML in the post content, showing the basic pattern for static block rendering. static-rendering create-block πŸ“¦
Block Editable Shows how to create a block with editable content using the block editor's core editing components and attributes. πŸ“¦
Non-block wp data with React Demonstrates how to use @wordpress/data with React components outside of the block editor context, showing data management patterns. no-block wp-data πŸ“¦
Minimal Block A bare-bones example showing the minimum required code to create a functional WordPress block. minimal featured πŸ“¦
Minimal Gutenberg Block (No Build) Shows how to create a simple block without a build process, using vanilla JavaScript and WordPress's built-in scripts. minimal no-build πŸ“¦
Interactive Blocks Collection of examples showing how to create blocks with interactive features and client-side functionality. interactive-block multi-block πŸ“¦
Format API Demonstrates how to use the WordPress Format API to add custom text formatting options to the editor. no-block πŸ“¦
Stylesheets Shows different approaches to adding and managing styles in blocks, including editor-specific and front-end styles. styles featured πŸ“¦
Basic ESNext Demonstrates how to create a basic block using modern JavaScript (ESNext) and JSX syntax with a build process powered by @wordpress/scripts. minimal πŸ“¦
Block Supports Showcases how to use WordPress block supports to add standard features like alignment, colors, and typography to blocks. supports featured πŸ“¦
Dynamic Block Shows how to create blocks that render content dynamically using PHP, including data fetching and server-side rendering. dynamic-rendering πŸ“¦
Interactivity API Block Demonstrates the usage of WordPress's Interactivity API to create blocks with enhanced interactive capabilities. create-block-template interactive-block interactivity-api πŸ“¦
Meta Block Shows how to create blocks that read and save data to post meta, demonstrating integration with WordPress metadata system. meta πŸ“¦
Inner Blocks Demonstrates how to create blocks that can contain other blocks using InnerBlocks component. πŸ“¦
SlotFill Shows how to use WordPress SlotFill system to extend the editor interface with custom components. no-block slotfill πŸ“¦
Block Toolbar Controls Demonstrates how to add custom controls to the block toolbar for enhanced block editing capabilities. block-toolbar πŸ“¦
Recipe A practical example showing how to create a complex block for recipe content with multiple editable fields and structured data. πŸ“¦
Plugin Sidebar Shows how to add a custom sidebar to the editor using SlotFill and integrate it with post meta data. slotfill meta no-block πŸ“¦
Data Basics - @wordpress/data Introduction to using @wordpress/data for state management in WordPress, covering basic concepts and patterns. no-block wp-data featured πŸ“¦
Copyright Date Block Example of a block that combines both static and dynamic rendering to display copyright information. dynamic-rendering static-rendering create-block featured πŸ“¦
Interactivity API Countdown Advanced example showing how to create an interactive countdown timer using the WordPress Interactivity API. dynamic-rendering interactive-block interactivity-api experimental block-toolbar πŸ“¦
Block Settings Sidebar Demonstrates how to add custom settings panels to the block sidebar for additional block configuration options. πŸ“¦
Post Meta Modal Shows how to create a modal interface for editing post meta data outside of the block context. meta no-block πŸ“¦
Interactivity API Quiz Demonstrates building an interactive quiz interface using the WordPress Interactivity API. interactive-block interactivity-api πŸ“¦
Interactivity Router (regions) example Shows how to implement client-side routing in blocks using the WordPress Interactivity API router functionality. interactivity-api interactivity-router πŸ“¦
Server Side Render Block This example demonstrates how to build a simple block that is rendered on the server and displayed in the Editor using the ServerSideRender component. server-side-rendering πŸ“¦

More info

Check the WIKI of this repo for more info about it:

  1. Getting Started
  2. Examples
  3. Local Development Guide
  4. Conventions for examples
  5. Adding new examples

About

Practical examples for building WordPress blocks and extending the Editor.

Resources

License

Stars

Watchers

Forks

Languages

  • JavaScript 44.7%
  • PHP 28.1%
  • TypeScript 15.5%
  • CSS 4.3%
  • SCSS 4.1%
  • Mustache 3.1%
  • Other 0.2%