-
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
Update InnerBlocks defaultblock doc usage #56728
Update InnerBlocks defaultblock doc usage #56728
Conversation
- **Default:** - `undefined`. Determines which block type should be inserted by default and any attributes that should be set by default when the block is inserted. Takes an array in the form of `[ name: blockname, attributes: {blockAttributes} ]`. | ||
|
||
```jsx | ||
const DEFAULT_BLOCK = [ name: 'core/paragraph', attributes: { content: 'Lorem ipsum...' } ]; |
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.
This seems wrong to me, it's either an array or an object, not a mix of both (this notation doesn't work in JavaScript)
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.
@youknowriad thanks for catching that! I've updated the accepted type to Object
.
Co-authored-by: Riad Benguella <[email protected]>
Thanks for clarifying these docs 👍 |
What?
Recently the
defaultBlock
was stabilized as part of WP 6.4 (#52083). However, theInnerBlocks
README
docs were incomplete. I received additional clarification from @sethrubenstein (see here: #52610 (comment))Why?
Clear instructions for extenders on how to use
defaultBlock
How?
Adds clarity to documentation.
I verified while creating a custom block with
useInnerBlocksProps()
. Here is the essential code that worked.props: @sethrubenstein