How Block Supports Work
When you enable a support feature:- Additional attributes are automatically registered on your block
- UI controls appear in the block toolbar or sidebar
- Generated properties are added to the block wrapper
- You must apply these properties using
useBlockProps
Applying Block Supports
In JavaScript (Edit Function)
In JavaScript (Save Function)
In PHP (Dynamic Blocks)
Common Block Supports
Align
Adds block alignment controls (left, center, right, wide, full).align attribute is added with a string type. Apply a default:
Anchor
Adds a field to define an HTML anchor (id) for the block.Color
Enables color controls for text, background, gradients, links, headings, and buttons.background and text default to true when color is declared.
Disable specific color controls:
Color Attributes
When color support is declared, these attributes are added:backgroundColor(string) - Preset background color slugtextColor(string) - Preset text color sluggradient(string) - Preset gradient slugstyle.color.background(string) - Custom background colorstyle.color.text(string) - Custom text colorstyle.color.gradient(string) - Custom gradient
Typography
Enables typography controls for font size, line height, and text alignment.Spacing
Enables spacing controls for margin, padding, and block gap.Dimensions
Enables dimension controls for width, height, min-height, and aspect ratio.style attribute:
Background
Enables background image and size controls.style.background.backgroundImage.
Layout Support
For blocks that contain inner blocks, layout support enables layout controls.Layout Options
default- Default layout type and settingsallowSwitching- Allow toggling between layout typesallowEditing- Show layout controls in sidebarallowInheriting- Show “Inner blocks use content width” toggleallowSizingOnChildren- Show sizing controls on child blocks (flex)allowVerticalAlignment- Show vertical alignment control (flex)allowJustification- Show justification controlallowOrientation- Show orientation control (flex)allowWrap- Show wrap toggle (flex)
Visibility and Behavior
ClassName
By default,wp-block-your-block-name is added to the block wrapper. Disable this:
Custom ClassName
Allow users to add a custom CSS class:HTML Mode
Allow editing block markup as HTML:Inserter
Control block visibility in the inserter:Multiple
Allow multiple instances of the block per post:Reusable
Allow converting the block to a reusable block:Lock
Allow users to lock/unlock the block:Renaming
Allow users to rename the block:Advanced Supports
Position
Enable position controls (sticky):Shadow
Enable box shadow controls:style.shadow.
Filter (Duotone)
Enable duotone filter controls:Interactivity API
Indicate if the block uses the Interactivity API:Complete Example
Theme Support
Some block supports require theme opt-in viatheme.json or add_theme_support():
Best Practices
-
Always use useBlockProps: Block supports only work if you spread
useBlockProps()on your wrapper element - Start minimal: Add supports as needed rather than enabling everything
- Consider theme compatibility: Some supports require theme opt-in
- Test thoroughly: Verify that generated classes and styles work correctly
- Document choices: Comment why certain supports are enabled or disabled
Related Documentation
- Block Attributes - Understanding block data
- Block Styles - Alternative visual styles
- Theme.json - Global settings and styles