This example demonstrates how to leverage WordPress block supports to enhance your blocks with standard WordPress features. Block supports provide a declarative way to add common functionality like alignment controls, color settings, and typography options without writing custom code.
Key concepts covered:
- Block supports configuration in
block.json
- Integration with WordPress core features
- Automatic UI controls generation
- Standard block behaviors implementation
- Property handling in Edit and Save components
Example | Description | Tags | Download .zip | Live Demo |
---|---|---|---|---|
Block Supports | Showcases how to use WordPress block supports to add standard features like alignment, colors, and typography to blocks. | supports featured |
📦 |
-
Core Support Features
align
: Controls block alignment optionscolor
: Enables background and text color settingstypography
: Provides font size and other text controlsspacing
: Allows margin and padding adjustments
-
Implementation Details
- Supports defined in
block.json
metadata - Properties automatically added via
useBlockProps
- Generated UI controls in block sidebar
- Consistent behavior in editor and frontend
- Supports defined in
-
Block Registration
{ "supports": { "align": true, "color": { "background": true, "text": true }, "typography": { "fontSize": true } } }
-
Component Integration
useBlockProps
handles support properties- Automatic class generation
- Proper attribute management
- Consistent rendering between editor and frontend
- Block API: Supports Documentation
- Block Editor Handbook - Block Supports
useBlockProps
Hook Documentation- WordPress Core Styles
- Block Alignment Guide
Note Check the Start Guide for local development with the examples