Skip to content

Commit

Permalink
add Boolean prop to allowedBlocks (#22554)
Browse files Browse the repository at this point in the history
`allowedBlocks` can also take a Boolean value instead of an Array
  • Loading branch information
pwkip authored May 22, 2020
1 parent e6d1efa commit 6675dc5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/block-editor/src/components/inner-blocks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ _Note:_ Because the save step will automatically apply props to the element retu
## Props

### `allowedBlocks`
* **Type:** `Array<String>`
* **Type:** `Boolean|Array<String>`
* **Default:** `true`

Allowed blocks prop should contain an array of strings, each string should contain the identifier of a block. When allowedBlocks is set it is only possible to insert blocks part of the set specified in the array.
`allowedBlocks` can contain an array of strings, each string should contain the identifier of a block. When `allowedBlocks` is set it is only possible to insert blocks part of the set specified in the array.

```jsx
const ALLOWED_BLOCKS = [ 'core/image', 'core/paragraph' ];
Expand All @@ -67,6 +68,8 @@ const ALLOWED_BLOCKS = [];

The previous code block restricts all blocks, so only child blocks explicitly registered as compatible with this block can be inserted. If no child blocks are available: it will be impossible to insert any inner blocks.

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

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

Expand Down

0 comments on commit 6675dc5

Please sign in to comment.