MethodAlignmentControls

 
 
 
 

Overview

Flex alignment, justification, and direction controls with icon‑based toggle groups, wrapped in a ToolsPanel for opt‑in behavior.

  • File: lib/blocks/components/MethodAlignmentControls.js
  • Panel label: “Alignment”

Props

PropTypeDefaultDescription
breakpointstring(required)The responsive breakpoint to read/write: base, mobile, tablet, or wide
attributesobject(required)The block’s full attributes object
setAttributesfunction(required)WordPress setAttributes function
includestring[]['alignItems', 'justifyContent']Which controls to render. Options: alignItems, justifyContent, flexDirection
alignItemsLabelstring'Align Items'Custom label for the align‑items control (e.g., "Content Vertical Alignment")

Controls

Align Items

  • UI: ToggleGroupControl with 4 custom SVG icon options.
  • Settings key: responsiveSettings.{breakpoint}.alignItems
OptionValueDescription
Startflex-startAlign items to the start of the cross axis
CentercenterCenter items on the cross axis
Endflex-endAlign items to the end of the cross axis
StretchstretchStretch items to fill the cross axis

Justify Content

  • UI: ToggleGroupControl with 4 custom SVG icon options.
  • Settings key: responsiveSettings.{breakpoint}.justifyContent
OptionValueDescription
Startflex-startPack items toward the start of the main axis
CentercenterCenter items on the main axis
Endflex-endPack items toward the end of the main axis
Betweenspace-betweenDistribute items evenly with first/last flush to edges

Flex Direction

  • UI: SelectControl dropdown.
  • Settings key: responsiveSettings.{breakpoint}.flexDirection
OptionValue
Rowrow
Row (Reverse)row-reverse
Columncolumn
Column (Reverse)column-reverse

ToolsPanel Behavior

Each control is wrapped in a ToolsPanelItem with:

  • hasValue: Returns true if the settings key is defined (not undefined)
  • onDeselect: Removes the key entirely from responsiveSettings.{breakpoint} (clean deletion, not set to null)
  • onSelect: Sets an initial value (flex-start for align/justify, row for direction)
  • resetAll: Removes all three keys (alignItems, justifyContent, flexDirection) from the breakpoint

Usage by Blocks

BlockIncluded ControlsCustom Label
SectionalignItems“Content Vertical Alignment”
ContaineralignItems“Content Vertical Alignment”
Advanced Grid RowalignItems, justifyContent
Basic GridalignItems, justifyContent
Flex ContaineralignItems, justifyContent, flexDirection
ButtonsalignItems, justifyContent, flexDirection
BreadcrumbalignItems, justifyContent
Social NavjustifyContent, flexDirection