-
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
Add/inserter list item component readme #25116
Closed
JustinyAhin
wants to merge
3
commits into
WordPress:trunk
from
JustinyAhin:add/inserter-list-item-component-readme
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
packages/block-editor/src/components/inserter-list-item/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 /> | ||
); | ||
``` | ||
|
||
## 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. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@ntsekouras maybe you can help me on this ... I'm having a hard time to identify what are the required props for this component.
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.
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:gutenberg/packages/block-editor/src/components/block-types-list/index.js
Line 52 in 9ced21b
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.