Skip to content
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/inserter list item component readme #25116

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Inserter List Item

The `InserterListItem` component allows you to display a group of elements for each of the blocks that are present in the editor's block type list interfaces.

These groups are made up of a block icon and its name.

In practice, a click on these groups allows you to insert the corresponding block in the editor.

![Paragraph block inserter list item](https://make.wordpress.org/core/files/2020/09/paragraph-inserter-list-item.png)

## Table of contents

1. [Development guidelines](#development-guidelines)
2. [Related components](#related-components)

## Development guidelines

### Usage

Renders a block inserter list item.

```jsx
import { InserterListItem } from '@wordpress/block-editor';

const MyInserterListItem = () => (
<InserterListItem />
Copy link
Member Author

Choose a reason for hiding this comment

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

@ntsekouras maybe you can help me on this ... I'm having a hard time to identify what are the required props for this component.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @JustinyAhin! The InserterListItem component it's actually a single element that shows a block in quick appender and the main appender list. It's only used for now in these places with a single entry point here:

You can see from the code above, the usage of many needed props in GB core.

I'm not really sure if the composite is required and if is tightly coupled with Reakit parent there.. (import { Composite, useCompositeState } from 'reakit';

(https://reakit.io/docs/composite/). @youknowriad any input here, since I saw you made that addition for better keyboard navigation.

);
```

## Related components

Block Editor components are components that can be used to compose the UI of your block editor. Thus, they can only be used under a [`BlockEditorProvider`](https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/provider/README.md) in the components tree.