Skip to content

Commit

Permalink
AlignmentMatrixControl : Fix/update docs (#34624)
Browse files Browse the repository at this point in the history
* Update example to import correctly and use a more verbose example in the onChange prop.
* Add prop details.

Co-authored-by: Ryan Welcher <[email protected]>
  • Loading branch information
ryanwelcher and Ryan Welcher authored Sep 8, 2021
1 parent 211313b commit f20ad34
Showing 1 changed file with 50 additions and 3 deletions.
53 changes: 50 additions & 3 deletions packages/components/src/alignment-matrix-control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,61 @@ AlignmentMatrixControl components enable adjustments to horizontal and vertical
## Usage

```jsx
import { AlignmentMatrixControl } from '@wordpress/components';
import { __experimentalAlignmentMatrixControl as AlignmentMatrixControl } from '@wordpress/components';
import { useState } from '@wordpress/element';

const Example = () => {
const [ alignment, setAlignment ] = useState( 'center center' );
const [alignment, setAlignment] = useState('center center');

return (
<AlignmentMatrixControl value={ alignment } onChange={ setAlignment } />
<AlignmentMatrixControl
value={alignment}
onChange={(newAlignment) => setAlignment(newAlignment)}
/>
);
};
```

## Props

The component accepts the following props:
### className

The class that will be added with "component-alignment-matrix-control" to the classes of the wrapper <Composite/> component.
If no className is passed only "component-alignment-matrix-control" is used.

- Type: `String`
- Required: No

### id

Unique ID for the component.
- Type: `String`
- Required: No
### label

If provided, sets the aria-label attribute of the wrapper <Composite/> component.

- Type: `String`
- Required: No
- Default: `Alignment Matrix Control`
### defaultValue

If provided, sets the default alignment value.
- Type: `String`
- Required: No
- Default: `center center`

### onChange

A function that receives the updated alignment value.

- Type: `function`
- Required: No
- Default: `noop`
### width

If provided, sets the width of the wrapper <Composite/> component.
- Type: `Number`
- Required: No
- Default: `92`

0 comments on commit f20ad34

Please sign in to comment.