Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Alignment Matrix Control

The alignment matrix control allows users to quickly adjust inner block alignment; this is in contrast to the alignment toolbar that aligns the frame block.

Button components

Table of contents

Design guidelines

Usage

The alignment matrix is a specialized tool, and it's used in the cover block.

Cover

As an example, here's the matrix alignment tool in action.

center

rop_right

Development guidelines

Usage

// This is a paraphrased example from the cover block
import {
    BlockControls,
    __experimentalBlockAlignmentMatrixControl as BlockAlignmentMatrixControl
} from "@wordpress/block-editor";

const controls = (
  <>
    <BlockControls>
      <BlockAlignmentMatrixControl
        label={ __( 'Change content position' ) }
        value={ contentPosition }
        onChange={ ( nextPosition ) =>
          setAttributes( { contentPosition: nextPosition } )
        }
      />
    </BlockControls>
  </>
}

Props

Name Type Default Description
label string Change matrix alignment concise description of tool's functionality.
onChange function noop the function to execute upon a user's change of the matrix state
value string center describes the content alignment location and can be top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft