-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add layout API documentation. #52673
Changes from 1 commit
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 |
---|---|---|
|
@@ -543,6 +543,79 @@ supports: { | |
} | ||
``` | ||
|
||
## layout | ||
|
||
- Type: `boolean` or `Object` | ||
- Default value: null | ||
- Subproperties: | ||
- `default`: type `Object`, default value null | ||
- `allowSwitching`: type `boolean`, default value `false` | ||
- `allowEditing`: type `boolean`, default value `true` | ||
- `allowInheriting`: type `boolean`, default value `true` | ||
- `allowSizingOnChildren`: type `boolean`, default value `false` | ||
- `allowVerticalAlignment`: type `boolean`, default value `true` | ||
- `allowJustification`: type `boolean`, default value `true` | ||
- `allowOrientation`: type `boolean`, default value `true` | ||
|
||
This value only applies to blocks that are containers for inner blocks. If set to `true` the layout type will be `flow`. For other layout types it's necessary to set the `type` explicitly inside the `default` object. | ||
|
||
### layout.default | ||
|
||
- Type: `Object` | ||
- Default value: null | ||
|
||
Allows setting the `type` property to define what layout type is default for the block, and also default values for any properties inherent to that layout type, e.g., for a `flex` layout, a default value can be set for `flexWrap`. | ||
|
||
### layout.allowSwitching | ||
|
||
- Type: `boolean` | ||
- Default value: `false` | ||
|
||
Exposes a switcher control that allows toggling between all existing layout types. | ||
|
||
### layout.allowEditing | ||
|
||
- Type: `boolean` | ||
- Default value: `true` | ||
|
||
Determines display of layout controls in the block sidebar. If set to false, layout controls will be hidden. | ||
|
||
### layout.allowInheriting | ||
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'm not sure this property still makes sense. It's being used incorrectly across several core blocks (it doesn't do anything for blocks with 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. Yeah, it probably doesn't make much sense any more. Back when inheriting was a feature within a single layout type it probably did, but now we have two distinct layout types I think it highlights that it was a good decision splitting the complex behaviour of |
||
|
||
- Type: `boolean` | ||
- Default value: `true` | ||
|
||
For the `flow` layout type only, determines display of the "Inner blocks use content width" toggle. | ||
|
||
### layout.allowSizingOnChildren | ||
|
||
- Type: `boolean` | ||
- Default value: `false` | ||
|
||
For the `flex` layout type only, determines display of sizing controls (Fit/Fill/Fixed) on all child blocks of the flex block. | ||
|
||
### layout.allowVerticalAlignment | ||
|
||
- Type: `boolean` | ||
- Default value: `true` | ||
|
||
For the `flex` layout type only, determines display of the vertical alignment control in the block toolbar. | ||
|
||
### layout.allowJustification | ||
|
||
- Type: `boolean` | ||
- Default value: `true` | ||
|
||
For the `flex` layout type, determines display of the justification control in the block toolbar and block sidebar. For the `constrained` layout type, determines display of justification control in the block sidebar. | ||
|
||
### layout.allowOrientation | ||
|
||
- Type: `boolean` | ||
- Default value: `true` | ||
|
||
For the `flex` layout type only, determines display of the orientation control in the block toolbar. | ||
|
||
|
||
## multiple | ||
|
||
- Type: `boolean` | ||
|
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.
No biggie, but just curious about whether we should provide illustrative examples since theme.json doesn't cover any of the possible extended values?
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.
hmm good point perhaps we should add all the possible values to the schema, or they might erroneously be flagged as invalid