Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added readme to matrix alignment toolbar #23341

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
alita-moore marked this conversation as resolved.
Show resolved Hide resolved

![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`