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 1 commit
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,73 @@
# Alignment Matrix Toolbar
The alignment matrix allows users the ability to change text alignment quickly and intuitively.
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)
- [Best practices](#best-practices)
- [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)

### Best practices
alita-moore marked this conversation as resolved.
Show resolved Hide resolved

The matrix alignment tool should:

- **Folow graphic design alignment guidelines** ; text alignment is important in graphic design. You can find tutorials online about alignment principles in graphic design, but [here](https://www.printwand.com/blog/basic-alignment-principles-in-graphic-design-with-examples) is an example.


## 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`