You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(Menu)!: updates menu variants and usage guidance
Updates Menu variants and usage guidance according to figma. The action variant is now popover, the navigation variant is now fixed and the border has been removed, and the select variant is no more.
While most Menus are used as layout elements, Menus can also be used as popover elements within components like Selects.
26
+
27
+
Use a Menu to organize and present a list of actions, options, or navigation links.
28
28
29
29
### Components
30
30
@@ -34,71 +34,81 @@ While most Menus are used as layout elements, Menus can also be used as popover
34
34
35
35
### Best practices:
36
36
37
-
- A `Menu` should only have the `menu` role when it is a list of actions or functions a user can evoke.
38
-
- For example - a popover menu that allows the user to copy text, paste text, or reset a workspace.
39
-
- If your `Menu` is simply a list of links it should not have the `menu` role.
40
-
- Adding the role of `menu` to the menu component will programmatically set the correct roles on its `MenuItem`s and `MenuSeparator`s.
37
+
- The Popover menu has the `menu` role by default, which is intended for presenting actions or options. However, if it contains only navigation links, it should use the `<nav>` element for semantic and accessible navigation.
38
+
- You can create floating menus by utilizing our <LinkToid="Atoms/PopoverContainer">PopoverContainer</LinkTo>. Once you have your base positioning, you just need to adjust the y axis by 48 for the normal spacing or 32 for the condensed spacing for each of the MenuItems. You may also need to change the alignment of the PopoverContainer to ensure correct positioning.
39
+
40
+
### When NOT to use:
41
+
42
+
- Form Inputs - For selecting from a predefined set of choices within a form, use the SelectDropdown component.
43
+
- Expandable Menus - For organizing multiple collapsible sections of navigation links in a structured layout, use the LayoutMenu component.
44
+
- Switching between content - For toggling between multiple related views or content sections within the same context, use the Tabs component.
- Use to visually reinforce the purpose of a menu item, improve scannability, or differentiate between actions.
53
+
54
+
2. Label
55
+
56
+
- Limit to 1-3 words.
57
+
- For actions, use a verb that clearly explains what will happen.
58
+
- When the menu item is linking to information, use a noun.
59
+
- Keep the same word form for each grouping. (For example, all nouns or all verbs.)
60
+
- Order and group by meaning or alphabetically.
61
+
- Avoid placing words that look the same (for example, that start with the exact same letters) adjacent to one another.
41
62
42
-
If you would like to know more about the `menu` role - check out the MDN web docs [here](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/menu_role).
63
+
3. Menu separator (optional)
64
+
65
+
- Use to group menu items into sections when there is a significant number of items, making lengthy menus easier to scan and navigate.
43
66
44
67
## Variants
45
68
46
-
<LayoutGridgap={32}py={24}>
69
+
### Popover
70
+
71
+
Use the Popover menu to present a temporary surface for actions, options, or links, ensuring access only when needed while keeping the interface clean and focused. The Popover menu has the `menu` role by default. But, if the menu contains only a list of navigation links, it should be nested in a `<nav>` element, which implicitly includes the `navigation` role.
47
72
48
-
<Columnsize={4}variant={false}mx={8}>
49
-
### Select
50
-
<Canvasof={MenuStories.Default} />
51
-
A general purpose menu type that can be used for actions or navigation.
52
-
</Column>
73
+
<Canvasof={MenuStories.Popover} />
53
74
54
-
<Columnsize={4}variant={false}>
55
-
### Action
56
-
<Canvasof={MenuStories.Action} />
57
-
These should be populated with MenuItems typed as buttons that execute some action.
58
-
</Column>
75
+
### Fixed
59
76
60
-
<Columnsize={4}variant={false}>
61
-
### Navigation
62
-
<Canvasof={MenuStories.Navigation} />
63
-
These should be populated with MenuItems typed as links.
64
-
</Column>
77
+
Use the Fixed menu to provide persistent access to navigation links, allowing users to seamlessly move between sections of the interface without opening additional surfaces. Fixed menus should always use the `<nav>` element to ensure semantic and accessible navigation.
65
78
66
-
</LayoutGrid>
79
+
<Canvasof={MenuStories.Fixed} />
67
80
68
81
## Spacing variants
82
+
69
83
Setting the Menu's `spacing` to `'condensed'` will reduce the padding around the MenuItems.
70
84
71
-
<LayoutGridgap={32}py={24}>
85
+
### Popover condensed
72
86
73
-
<Columnsize={4}variant={false}mx={8}>
74
-
### Select condensed
75
-
<Canvasof={MenuStories.SelectCondensed} />
76
-
</Column>
87
+
<Canvasof={MenuStories.PopoverCondensed} />
77
88
78
-
<Columnsize={4}variant={false}>
79
-
### Action condensed
80
-
<Canvasof={MenuStories.ActionCondensed} />
81
-
</Column>
89
+
### Fixed condensed
82
90
83
-
<Columnsize={4}variant={false}>
84
-
### Navigation condensed
85
-
<Canvasof={MenuStories.NavigationCondensed} />
86
-
</Column>
91
+
<Canvasof={MenuStories.FixedCondensed} />
87
92
88
-
</LayoutGrid>
93
+
## Menu separator
89
94
90
-
## Popover menus
95
+
Use the `MenuSeparator` component to group menu items into sections when there is a significant number of items, making lengthy menus easier to scan and navigate.
91
96
92
-
You can create popover menus by utilizing our **PopoverContainer**. Once you have your base positioning, you just need to adjust the `y` axis by `48` for the `normal` spacing or `32` for the `condensed` spacing for each of the `MenuItem`s. You may also need to change the `alignment` of the `PopoverContainer` to ensure correct positioning.
97
+
<Canvasof={MenuStories.PopoverMenuSeparator} />
98
+
<Canvasof={MenuStories.FixedMenuSeparator} />
93
99
94
-
Popover Menus that have complex functionalities or actions, like the example below, should have the `menu` role.
100
+
## Floating menus
95
101
96
-
Click through each item to see how the `Menu`s appear (and disappear when the item is clicked again, or another item is selected.)
102
+
You can create floating menus by utilizing our <LinkToid="Atoms/PopoverContainer">PopoverContainer</LinkTo>. Once you have your base positioning, you just need to adjust the y axis by 48 for the normal spacing or 32 for the condensed spacing for each of the MenuItems. You may also need to change the alignment of the PopoverContainer to ensure correct positioning.
97
103
98
-
<Canvasof={MenuStories.Popover} />
104
+
Floating menus that have complex functionalities or actions, like the example below, should have the menu role.
105
+
106
+
Click through each item to see how the `Menu`s appear (and disappear when the item is clicked again, or another item is selected.)
0 commit comments