-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 MenuGroup design documentation #14466
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,31 @@ | ||
# MenuGroup | ||
|
||
## Usage | ||
`MenuGroup` wraps a series of related `MenuItem` components into a common section. | ||
|
||
![MenuGroup Example](https://wordpress.org/gutenberg/files/2019/03/MenuGroup.png) | ||
|
||
1. MenuGroup | ||
|
||
## Table of Contents | ||
|
||
1. [Design guidelines](#design-guidelines) | ||
2. [Development guidelines](#development-guidelines) | ||
3. [Related components](#related-components) | ||
|
||
## Design guidelines | ||
|
||
### Usage | ||
|
||
A `MenuGroup` should be used to indicate that two or more individual MenuItems are related. When other menu items exist above or below a `MenuGroup`, the group should have a divider line between it and the adjacent item. A MenuGroup can optionally include a label to describe its contents. | ||
|
||
![MenuGroup diagram with label and dividers](https://wordpress.org/gutenberg/files/2019/03/MenuGroup-Anatomy.png) | ||
|
||
1. MenuGroup label | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "MenuGroup" may be redundant, but it is a bit more clear since you mention other components above. I'll leave that up to you. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I think it's fine to repeat that there, for clarity's sake. Those should have tick marks like the other mentions of the components though. 👍 |
||
2. MenuGroup dividers | ||
|
||
## Development guidelines | ||
|
||
### Usage | ||
|
||
```jsx | ||
import { MenuGroup, MenuItem } from '@wordpress/components'; | ||
|
@@ -12,3 +37,9 @@ const MyMenuGroup = () => ( | |
</MenuGroup> | ||
); | ||
``` | ||
|
||
## Related Components | ||
|
||
- `MenuGroup`s are intended to be used in a `DropDownMenu`. | ||
- To use a single button in a menu, use `MenuItem`. | ||
- To allow users to toggle between a set of menu options, use `MenuItemsChoice` inside of a `MenuGroup`. |
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.
No tick marks around MenuGroup for some reason
Should "MenuItems" have tick marks?
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.
Yep, it should. Good catch! I've opened #14490 as a quick fix for that. 🙂