Debian Codegraph @

node/@patternfly/react-core/src/components/OverflowMenu/examples/OverflowMenu.md

raw
1 ---
2 id: Overflow menu
3 section: components
4 cssPrefix: pf-v6-c-overflow-menu
5 propComponents:
6 [
7 'OverflowMenu',
8 'OverflowMenuContent',
9 'OverflowMenuControl',
10 'OverflowMenuDropdownItem',
11 'OverflowMenuGroup',
12 'OverflowMenuItem'
13 ]
14 ---
15
16 import { useRef, useState } from 'react';
17 import AlignLeftIcon from '@patternfly/react-icons/dist/esm/icons/align-left-icon';
18 import AlignCenterIcon from '@patternfly/react-icons/dist/esm/icons/align-center-icon';
19 import AlignRightIcon from '@patternfly/react-icons/dist/esm/icons/align-right-icon';
20 import RhUiEllipsisVerticalFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ellipsis-vertical-fill-icon';
21
22 ## Examples
23
24 ### Simple (responsive)
25
26 ```ts file="./OverflowMenuSimple.tsx"
27
28 ```
29
30 ### Vertical
31
32 Passing `isVertical` to `OverflowMenu` will change its behavior to respond to breakpoints based on window height instead of width.
33
34 ```ts file="./OverflowMenuSimpleVertical.tsx"
35
36 ```
37
38 ### Group types
39
40 ```ts file="./OverflowMenuGroupTypes.tsx"
41
42 ```
43
44 ### Multiple groups
45
46 ```ts file="./OverflowMenuMultiGroup.tsx"
47
48 ```
49
50 ### Persistent
51
52 ```ts file="./OverflowMenuPersistent.tsx"
53
54 ```
55
56 ### Breakpoint on container width
57
58 By passing in the `breakpointReference` property, the overflow menu's breakpoint will be relative to the width of the reference container rather than the viewport width.
59
60 You can change the container width in this example by adjusting the slider. As the container width changes, the overflow menu will change between a horizontal menu and a vertical dropdown despite the viewport width not changing.
61
62 ```ts file="./OverflowMenuBreakpointOnContainer.tsx"
63
64 ```
65
66 ### Breakpoint on container height
67
68 By passing in the `breakpointReference` and `isVertical` properties, the overflow menu's breakpoint will be determined relative to the height of the reference container rather than the window height.
69
70 ```ts isFullscreen file="./OverflowMenuBreakpointOnContainerHeight.tsx"
71
72 ```