Skip to content

Commit a53f63a

Browse files
committed
touch up examples and guidance
1 parent 3cb72f1 commit a53f63a

File tree

2 files changed

+50
-13
lines changed

2 files changed

+50
-13
lines changed

packages/styleguide/src/lib/Molecules/Menu/Menu.mdx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { Canvas, Controls, Meta } from '@storybook/blocks';
22

3-
import { ComponentHeader, ImageWrapper, LinkTo } from '~styleguide/blocks';
3+
import {
4+
ComponentHeader,
5+
ImageWrapper,
6+
LinkTo,
7+
Callout,
8+
} from '~styleguide/blocks';
49

510
import * as MenuStories from './Menu.stories';
611

@@ -67,6 +72,18 @@ Use a Menu to organize and present a list of actions, options, or navigation lin
6772

6873
## Variants
6974

75+
In both `popover` and `fixed` variants of `Menu`, you can set the `active` and `disabled` states on the `MenuItem` children. The `active` state indicates the currently selected item, while the `disabled` state indicates that an item is unavailable for interaction. You can optionally use the `label` prop to render a ToolTip explaining why a `MenuItem` is disabled—see the "Icon-Only Menus + ToolTips" section for more details.
76+
77+
<Callout
78+
text={
79+
<>
80+
The <code>Menu</code> component is stateless, you'll need to implement the
81+
logic to manage the <code>active</code> and <code>disabled</code> states
82+
of <code>MenuItem</code> components.
83+
</>
84+
}
85+
/>
86+
7087
### Popover
7188

7289
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.

packages/styleguide/src/lib/Molecules/Menu/Menu.stories.tsx

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,29 @@ export const Popover: Story = {
5454
variant: 'popover',
5555
children: (
5656
<>
57-
<MenuItem onClick={() => null} disabled>
58-
Menu Item
59-
</MenuItem>
60-
<MenuItem active onClick={() => null} disabled>
57+
<MenuItem onClick={() => null}>Menu Item</MenuItem>
58+
<MenuItem active onClick={() => null}>
6159
Active Item
6260
</MenuItem>
6361
<MenuItem icon={MultipleUsersIcon} onClick={() => null}>
6462
Icon Item
6563
</MenuItem>
66-
<MenuItem onClick={() => null}>Menu Item</MenuItem>
64+
<MenuItem disabled onClick={() => null}>
65+
Disabled Item
66+
</MenuItem>
67+
<MenuItem
68+
disabled
69+
label={{
70+
info: 'This is disabled because...',
71+
alignment: 'left-center',
72+
}}
73+
onClick={() => null}
74+
>
75+
Disabled item with ToolTip
76+
</MenuItem>
77+
<MenuItem active disabled onClick={() => null}>
78+
Active Item and disabled FOR TESTING -- will delete after!
79+
</MenuItem>
6780
</>
6881
),
6982
},
@@ -75,21 +88,28 @@ export const Fixed: Story = {
7588
children: (
7689
<>
7790
<MenuItem href="#">Menu Item</MenuItem>
91+
<MenuItem href="#" active>
92+
Active Item
93+
</MenuItem>
94+
<MenuItem href="#" icon={MultipleUsersIcon}>
95+
Icon Item
96+
</MenuItem>
97+
<MenuItem disabled onClick={() => null}>
98+
Disabled Item
99+
</MenuItem>
78100
<MenuItem
79-
active
80-
href="#"
81101
disabled
82102
label={{
83103
info: 'This is disabled because...',
84-
alignment: 'top-center',
104+
alignment: 'left-center',
85105
}}
106+
onClick={() => null}
86107
>
87-
Active Item
108+
Menu Item
88109
</MenuItem>
89-
<MenuItem href="#" icon={MultipleUsersIcon}>
90-
Icon Item
110+
<MenuItem active disabled onClick={() => null}>
111+
Active Item and disabled FOR TESTING -- will delete after!
91112
</MenuItem>
92-
<MenuItem href="#">Menu Item</MenuItem>
93113
</>
94114
),
95115
},

0 commit comments

Comments
 (0)