Skip to main content
Block Supports is the API that allows a block to declare support for certain features. Opting into these features automatically registers additional attributes on the block and provides UI controls to manipulate them.

How Block Supports Work

When you enable a support feature:
  1. Additional attributes are automatically registered on your block
  2. UI controls appear in the block toolbar or sidebar
  3. Generated properties are added to the block wrapper
  4. 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).
When declared, the align attribute is added with a string type. Apply a default:

Anchor

Adds a field to define an HTML anchor (id) for the block.
Allows users to link directly to a specific block on a page.

Color

Enables color controls for text, background, gradients, links, headings, and buttons.
Note: 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 slug
  • textColor (string) - Preset text color slug
  • gradient (string) - Preset gradient slug
  • style.color.background (string) - Custom background color
  • style.color.text (string) - Custom text color
  • style.color.gradient (string) - Custom gradient

Typography

Enables typography controls for font size, line height, and text alignment.
Limit text alignment options:

Spacing

Enables spacing controls for margin, padding, and block gap.
Control specific sides:

Dimensions

Enables dimension controls for width, height, min-height, and aspect ratio.
Stores values in the style attribute:

Background

Enables background image and size controls.
Stores image data in style.background.backgroundImage.

Layout Support

For blocks that contain inner blocks, layout support enables layout controls.

Layout Options

  • default - Default layout type and settings
  • allowSwitching - Allow toggling between layout types
  • allowEditing - Show layout controls in sidebar
  • allowInheriting - Show “Inner blocks use content width” toggle
  • allowSizingOnChildren - Show sizing controls on child blocks (flex)
  • allowVerticalAlignment - Show vertical alignment control (flex)
  • allowJustification - Show justification control
  • allowOrientation - 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:
Disable the custom class field:

HTML Mode

Allow editing block markup as HTML:
Disable HTML editing:

Inserter

Control block visibility in the inserter:

Multiple

Allow multiple instances of the block per post:
Restrict to one instance:

Reusable

Allow converting the block to a reusable block:
Prevent conversion:

Lock

Allow users to lock/unlock the block:

Renaming

Allow users to rename the block:
Disable renaming:

Advanced Supports

Position

Enable position controls (sticky):
Stores values in:

Shadow

Enable box shadow controls:
Stores shadow value in style.shadow.

Filter (Duotone)

Enable duotone filter controls:

Interactivity API

Indicate if the block uses the Interactivity API:
Or simply:

Complete Example

Theme Support

Some block supports require theme opt-in via theme.json or add_theme_support():

Best Practices

  1. Always use useBlockProps: Block supports only work if you spread useBlockProps() on your wrapper element
  2. Start minimal: Add supports as needed rather than enabling everything
  3. Consider theme compatibility: Some supports require theme opt-in
  4. Test thoroughly: Verify that generated classes and styles work correctly
  5. Document choices: Comment why certain supports are enabled or disabled