-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix/update docs alignment matrix control #34624
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -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. | ||||||||
Comment on lines
+28
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know that some older READMEs have a similar paragraph, but from now on let's not mention the |
||||||||
|
||||||||
- Type: `String` | ||||||||
- Required: No | ||||||||
|
||||||||
### id | ||||||||
|
||||||||
Unique ID for the component. | ||||||||
- Type: `String` | ||||||||
- Required: No | ||||||||
### label | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tiny nitpick: most headers used for props are missing an empty line above them
Suggested change
|
||||||||
|
||||||||
If provided, sets the aria-label attribute of the wrapper <Composite/> component. | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit:
Suggested change
|
||||||||
|
||||||||
- Type: `String` | ||||||||
- Required: No | ||||||||
- Default: `Alignment Matrix Control` | ||||||||
### defaultValue | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also add the |
||||||||
|
||||||||
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` | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we replace types to be closer to how TypeScript types are described? In this case, it could be something like Other changes would be:
|
||||||||
- Required: No | ||||||||
- Default: `noop` | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know that the default value for this prop is a |
||||||||
### width | ||||||||
|
||||||||
If provided, sets the width of the wrapper <Composite/> component. | ||||||||
- Type: `Number` | ||||||||
- Required: No | ||||||||
- Default: `92` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very very minor, but — it'd be great if the example snippet followed the repo's prettier formatting rules