Skip to content

Commit

Permalink
added readme to matrix alignment toolbar (#23341)
Browse files Browse the repository at this point in the history
  • Loading branch information
alita-moore committed Jul 9, 2020
1 parent 805bdf8 commit d3503d4
Showing 1 changed file with 64 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Alignment Matrix Toolbar

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

![Button components](https://i.imgur.com/PxYkgL5.png)

## Table of contents
- [Alignment Matrix Toolbar](#alignment-matrix-toolbar)
- [Table of contents](#table-of-contents)
- [Design guidelines](#design-guidelines)
- [Usage](#usage)
- [Development guidelines](#development-guidelines)
- [Usage](#usage-1)
- [Props](#props)

## Design guidelines

### Usage

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

![Cover](https://i.imgur.com/nJjqen8.png)

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

![center](https://i.imgur.com/0Ce1fZm.png)


![rop_right](https://i.imgur.com/yGGf6IP.png)

## Development guidelines

### Usage

```jsx
// This is a paraphrased example from the cover block
import {
BlockControls,
__experimentalBlockAlignmentMatrixToolbar as BlockAlignmentMatrixToolbar
} from "@wordpress/block-editor";

const controls = (
<>
<BlockControls>
<BlockAlignmentMatrixToolbar
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`

0 comments on commit d3503d4

Please sign in to comment.