Skip to content

Commit

Permalink
Add docs for InnerBlocks orientation prop (#23641)
Browse files Browse the repository at this point in the history
* Update README for InnerBlocks to document orientation prop

* Update nested blocks tuturoial
  • Loading branch information
talldan committed Jul 2, 2020
1 parent 542ba2a commit 2d7e690
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ const ALLOWED_BLOCKS = [ 'core/image', 'core/paragraph' ];
/>
```

## Orientation

By default, `InnerBlocks` expects its blocks to be shown in a vertical list. A valid use-case is to style InnerBlocks to appear horizontally. When blocks are styled in such a way, the `orientation` prop can be used to indicate a horizontal layout:
```js
<InnerBlocks
orientation="horizontal"
/>
```

Specifying this prop will result in the block movers being shown horizontally, and also ensure drag and drop works correctly.

## Template

Expand Down
7 changes: 7 additions & 0 deletions packages/block-editor/src/components/inner-blocks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ The previous code block restricts all blocks, so only child blocks explicitly re

If `allowedBlocks` is set to `true`, all blocks are allowed. `false` means no blocks are allowed.

### `orientation`
* **Type:** `"horizontal"|"vertical"|undefined`

Indicates whether inner blocks are shown horizontally or vertically. Use the string 'horizontal' or 'vertical' as a value. When left unspecified, defaults to 'vertical'.

While this prop doesn't change any styles for the inner blocks themselves, it does display the Block Movers in the correct orientation, and also ensures drag and drop works correctly.

### `template`
* **Type:** `Array<Array<Object>>`

Expand Down

0 comments on commit 2d7e690

Please sign in to comment.