Skip to content

Docs: Add Block List Readme - #69432

Merged
im3dabasia merged 4 commits into
WordPress:trunkfrom
dhruvikpatel18:add/block-list-readme
Aug 12, 2026
Merged

Docs: Add Block List Readme#69432
im3dabasia merged 4 commits into
WordPress:trunkfrom
dhruvikpatel18:add/block-list-readme

Conversation

@dhruvikpatel18

Copy link
Copy Markdown
Member

What?

Part of: #22891

Why?

This PR adds the README for Block List component

Testing Instructions

none

Screenshots or screencast

none

@dhruvikpatel18
dhruvikpatel18 marked this pull request as ready for review March 5, 2025 09:50
@dhruvikpatel18
dhruvikpatel18 requested a review from ellatrix as a code owner March 5, 2025 09:50
@github-actions

github-actions Bot commented Mar 5, 2025

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: dhruvikpatel18 <dhruvik18@git.wordpress.org>
Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@shail-mehta shail-mehta added the [Type] Developer Documentation Documentation for developers label Mar 5, 2025
@github-actions github-actions Bot added the [Package] Block editor /packages/block-editor label Aug 11, 2026

@im3dabasia im3dabasia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking up this issue! @dhruvikpatel18 . Left a few feedbacks.

### Example

```jsx
import BlockList from '@wordpress/block-editor/components/block-list';

@im3dabasia im3dabasia Aug 11, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’d be nice to replace this with the one below.

import { BlockList } from '@wordpress/block-editor';

|---------------------------|------------|-------------|
| `rootClientId` | `string?` | The client ID of the root block whose inner blocks will be rendered. If omitted, renders the top-level blocks. |
| `placeholder` | `ReactNode?` | Placeholder content displayed when no blocks are present. |
| `renderAppender` | `Function?` | Custom function to render an appender component (e.g., the "+" button for adding new blocks). Defaults to the standard block appender. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renderAppender accepts false to suppress the appender entirely . Currently the table only describes the function form. It'd be a nice idea to mention this as well.

Ref usage in style-book

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have a missing className prop. Please add it here, as it is directly consumed by the BlockList component.

## Related Components

- [`BlockListBlock`](./block) - Renders individual blocks within the `BlockList`.
- [`BlockListAppender`](../block-list-appender) - Provides UI for adding new blocks.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BlockListBlock and BlockListAppender don't have READMEs of their own, so these would end up as dead links once this is published.

Might be better to mention them as plain text for now, and link them up if/when those READMEs get added.

```jsx
import BlockList from '@wordpress/block-editor/components/block-list';

function MyEditorComponent( props ) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example can be misleading because it doesn’t show the full picture of how this component can be used. Perhaps we could present it as just one example. What do you think?

import { BlockCanvas, BlockEditorProvider, BlockList } from '@wordpress/block-editor';

<BlockEditorProvider value={ blocks } onChange={ setBlocks }>
	<BlockCanvas height="400px">
		<BlockList className="my-editor-block-list" />
	</BlockCanvas>
</BlockEditorProvider>;

Picked from here

Comment on lines +45 to +48
## Notes

The `BlockList` component plays a crucial role in structuring the block editor. While it is used internally, developers working on extending or modifying the editor interface may need to interact with it for advanced customization.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes isn't a heading used anywhere else in this package, and the content here mostly repeats the opening of Usage above. Could the one new bit be folded into the intro paragraph and the section dropped?

Same thought for Features, most of the READMEs here use Development guidelines for that kind of prose.

@im3dabasia im3dabasia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick turnaround!

  • The general structure of the README.md is incorrect. Could you switch it to follow our usual convention? This would keep the documentation consistent. Please update the PR accordingly.
# Component
## Development guidelines

### Usage

### Props

#### `exampleProp`

## Related components

} from '@wordpress/block-editor';

function MyEditor() {
const [ blocks, setBlocks ] = useState( [] );

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: import { useState } from 'react';

const [ blocks, setBlocks ] = useState( [] );

return (
<BlockEditorProvider value={ blocks } onChange={ setBlocks }>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With only onChange, non-persistent changes (typing inside a block) never reach blocks, so the parent state goes stale. Every canonical example passes both, WDYT about matching?

<BlockEditorProvider value={ blocks } onInput={ setBlocks } onChange={ setBlocks }>

}
```

## Props

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we switch from the tabular format to per-prop subheadings with type/default bullets? This would help us achieve consistency!


- `BlockListBlock` - Renders individual blocks within the `BlockList`.
- `BlockListAppender` - Provides UI for adding new blocks.
- [`useInnerBlocksProps`](../inner-blocks) - Hook for managing inner blocks and their props.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the link altogether here. It points to the folder as of now, which makes little sense.

| `rootClientId` | `string?` | The client ID of the root block whose inner blocks will be rendered. If omitted, renders the top-level blocks. |
| `placeholder` | `ReactNode?` | Placeholder content displayed when no blocks are present. |
| `renderAppender` | `Function \| false?` | Custom function to render an appender component (e.g., the "+" button for adding new blocks). Pass `false` to suppress the appender entirely. Defaults to the standard block appender. |
| `__experimentalAppenderTagName` | `string?` | Tag name for the appender element. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth a short "experimental, may change without notice" note?

Minor, feel free to skip.

@im3dabasia im3dabasia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

@im3dabasia
im3dabasia merged commit 62f77b7 into WordPress:trunk Aug 12, 2026
43 checks passed
@github-actions github-actions Bot added this to the Gutenberg 23.8 milestone Aug 12, 2026
shail-mehta pushed a commit that referenced this pull request Aug 12, 2026
* Docs: Add Block List Readme.
* Docs: Update Block List README with usage examples and prop descriptions
* Docs: Restructure Block List README to match package conventions

Co-authored-by: dhruvikpatel18 <dhruvik18@git.wordpress.org>
Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block editor /packages/block-editor [Type] Developer Documentation Documentation for developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Sponsor
SponsoredKunjungi sekarang
Promo