@patternfly/react-docs 7.6.0-prerelease.7 → 7.6.0-prerelease.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +12 -13
- package/patternfly-docs/generated/components/about-modal/react.js +149 -0
- package/patternfly-docs/generated/components/accordion/react.js +262 -0
- package/patternfly-docs/generated/components/action-list/react.js +144 -0
- package/patternfly-docs/generated/components/alert/react-demos.js +56 -0
- package/patternfly-docs/generated/components/alert/react.js +1433 -0
- package/patternfly-docs/generated/components/avatar/react.js +166 -0
- package/patternfly-docs/generated/components/back-to-top/react-demos.js +60 -0
- package/patternfly-docs/generated/components/back-to-top/react.js +77 -0
- package/patternfly-docs/generated/components/backdrop/react.js +64 -0
- package/patternfly-docs/generated/components/background-image/react.js +62 -0
- package/patternfly-docs/generated/components/badge/react.js +97 -0
- package/patternfly-docs/generated/components/banner/react-demos.js +57 -0
- package/patternfly-docs/generated/components/banner/react.js +148 -0
- package/patternfly-docs/generated/components/brand/react.js +142 -0
- package/patternfly-docs/generated/components/breadcrumb/react.js +206 -0
- package/patternfly-docs/generated/components/button/react-demos.js +57 -0
- package/patternfly-docs/generated/components/button/react.js +826 -0
- package/patternfly-docs/generated/components/card/react-demos.js +201 -0
- package/patternfly-docs/generated/components/card/react.js +1015 -0
- package/patternfly-docs/generated/components/charts/area-chart/-Victory.js +1350 -0
- package/patternfly-docs/generated/components/charts/bar-chart/-Victory.js +1334 -0
- package/patternfly-docs/generated/components/charts/box-plot-chart/-Victory.js +1282 -0
- package/patternfly-docs/generated/components/charts/bullet-chart/-Victory.js +848 -0
- package/patternfly-docs/generated/components/charts/colors-for-charts/-Victory.js +192 -0
- package/patternfly-docs/generated/components/charts/donut-chart/-Victory.js +426 -0
- package/patternfly-docs/generated/components/charts/donut-utilization-chart/-Victory.js +804 -0
- package/patternfly-docs/generated/components/charts/legends/-Victory.js +3230 -0
- package/patternfly-docs/generated/components/charts/line-chart/-Victory.js +1178 -0
- package/patternfly-docs/generated/components/charts/line-chart/ECharts.js +525 -0
- package/patternfly-docs/generated/components/charts/patterns/-Victory.js +3382 -0
- package/patternfly-docs/generated/components/charts/pie-chart/-Victory.js +377 -0
- package/patternfly-docs/generated/components/charts/resize-observer/-Victory.js +2475 -0
- package/patternfly-docs/generated/components/charts/sankey-chart/ECharts.js +538 -0
- package/patternfly-docs/generated/components/charts/scatter-chart/-Victory.js +1551 -0
- package/patternfly-docs/generated/components/charts/skeletons/-Victory.js +4115 -0
- package/patternfly-docs/generated/components/charts/sparkline-chart/-Victory.js +955 -0
- package/patternfly-docs/generated/components/charts/stack-chart/-Victory.js +1173 -0
- package/patternfly-docs/generated/components/charts/threshold-chart/-Victory.js +1166 -0
- package/patternfly-docs/generated/components/charts/tooltips/-Victory.js +413 -0
- package/patternfly-docs/generated/components/chip/react-deprecated.js +323 -0
- package/patternfly-docs/generated/components/clipboard-copy/react.js +373 -0
- package/patternfly-docs/generated/components/code-block/react.js +148 -0
- package/patternfly-docs/generated/components/code-editor/react.js +659 -0
- package/patternfly-docs/generated/components/compass/react-demos.js +147 -0
- package/patternfly-docs/generated/components/compass/react.js +440 -0
- package/patternfly-docs/generated/components/content/react.js +248 -0
- package/patternfly-docs/generated/components/data-list/react-demos.js +90 -0
- package/patternfly-docs/generated/components/data-list/react.js +709 -0
- package/patternfly-docs/generated/components/date-and-time/calendar-month/react.js +283 -0
- package/patternfly-docs/generated/components/date-and-time/date-and-time-picker/react-demos.js +64 -0
- package/patternfly-docs/generated/components/date-and-time/date-picker/react-demos.js +83 -0
- package/patternfly-docs/generated/components/date-and-time/date-picker/react.js +395 -0
- package/patternfly-docs/generated/components/date-and-time/time-picker/react.js +241 -0
- package/patternfly-docs/generated/components/description-list/react-demos.js +58 -0
- package/patternfly-docs/generated/components/description-list/react.js +743 -0
- package/patternfly-docs/generated/components/divider/react.js +126 -0
- package/patternfly-docs/generated/components/drag-and-drop/react-demos.js +351 -0
- package/patternfly-docs/generated/components/drag-and-drop/react-deprecated.js +184 -0
- package/patternfly-docs/generated/components/drag-and-drop/react.js +137 -0
- package/patternfly-docs/generated/components/drawer/react.js +598 -0
- package/patternfly-docs/generated/components/dual-list-selector/react-deprecated.js +772 -0
- package/patternfly-docs/generated/components/dual-list-selector/react.js +594 -0
- package/patternfly-docs/generated/components/empty-state/react.js +199 -0
- package/patternfly-docs/generated/components/expandable-section/react-demos.js +65 -0
- package/patternfly-docs/generated/components/expandable-section/react.js +408 -0
- package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react-demos.js +52 -0
- package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react.js +398 -0
- package/patternfly-docs/generated/components/file-upload/simple-file-upload/react.js +749 -0
- package/patternfly-docs/generated/components/forms/checkbox/react.js +222 -0
- package/patternfly-docs/generated/components/forms/form/react.js +1106 -0
- package/patternfly-docs/generated/components/forms/form-select/react.js +208 -0
- package/patternfly-docs/generated/components/forms/radio/react.js +212 -0
- package/patternfly-docs/generated/components/forms/text-area/react.js +160 -0
- package/patternfly-docs/generated/components/forms/text-input/react.js +216 -0
- package/patternfly-docs/generated/components/helper-text/react-demos.js +180 -0
- package/patternfly-docs/generated/components/helper-text/react.js +164 -0
- package/patternfly-docs/generated/components/hero/react.js +88 -0
- package/patternfly-docs/generated/components/hint/react.js +169 -0
- package/patternfly-docs/generated/components/icon/react.js +215 -0
- package/patternfly-docs/generated/components/input-group/react.js +182 -0
- package/patternfly-docs/generated/components/jump-links/react-demos.js +154 -0
- package/patternfly-docs/generated/components/jump-links/react.js +212 -0
- package/patternfly-docs/generated/components/label/react-demos.js +57 -0
- package/patternfly-docs/generated/components/label/react.js +417 -0
- package/patternfly-docs/generated/components/list/react.js +175 -0
- package/patternfly-docs/generated/components/login-page/react.js +587 -0
- package/patternfly-docs/generated/components/masthead/react-demos.js +79 -0
- package/patternfly-docs/generated/components/masthead/react.js +291 -0
- package/patternfly-docs/generated/components/menus/application-launcher/react-demos.js +769 -0
- package/patternfly-docs/generated/components/menus/context-selector/react-demos.js +665 -0
- package/patternfly-docs/generated/components/menus/custom-menus/react-demos.js +187 -0
- package/patternfly-docs/generated/components/menus/dropdown/react-templates.js +163 -0
- package/patternfly-docs/generated/components/menus/dropdown/react.js +998 -0
- package/patternfly-docs/generated/components/menus/menu/react.js +1540 -0
- package/patternfly-docs/generated/components/menus/menu-toggle/react.js +747 -0
- package/patternfly-docs/generated/components/menus/options-menu/react-demos.js +508 -0
- package/patternfly-docs/generated/components/menus/select/react-templates.js +257 -0
- package/patternfly-docs/generated/components/menus/select/react.js +998 -0
- package/patternfly-docs/generated/components/modal/react-deprecated.js +554 -0
- package/patternfly-docs/generated/components/modal/react.js +597 -0
- package/patternfly-docs/generated/components/navigation/react-demos.js +356 -0
- package/patternfly-docs/generated/components/navigation/react.js +409 -0
- package/patternfly-docs/generated/components/notification-badge/react.js +196 -0
- package/patternfly-docs/generated/components/notification-drawer/react-demos.js +107 -0
- package/patternfly-docs/generated/components/notification-drawer/react.js +394 -0
- package/patternfly-docs/generated/components/number-input/react.js +210 -0
- package/patternfly-docs/generated/components/overflow-menu/react.js +274 -0
- package/patternfly-docs/generated/components/page/react-demos.js +149 -0
- package/patternfly-docs/generated/components/page/react.js +1352 -0
- package/patternfly-docs/generated/components/pagination/react.js +492 -0
- package/patternfly-docs/generated/components/panel/react.js +236 -0
- package/patternfly-docs/generated/components/popover/react.js +390 -0
- package/patternfly-docs/generated/components/progress/react-demos.js +59 -0
- package/patternfly-docs/generated/components/progress/react.js +283 -0
- package/patternfly-docs/generated/components/progress-stepper/react-demos.js +45 -0
- package/patternfly-docs/generated/components/progress-stepper/react.js +219 -0
- package/patternfly-docs/generated/components/search-input/react-demos.js +113 -0
- package/patternfly-docs/generated/components/search-input/react.js +263 -0
- package/patternfly-docs/generated/components/sidebar/react.js +236 -0
- package/patternfly-docs/generated/components/simple-list/react.js +200 -0
- package/patternfly-docs/generated/components/skeleton/react-demos.js +44 -0
- package/patternfly-docs/generated/components/skeleton/react.js +122 -0
- package/patternfly-docs/generated/components/skip-to-content/react.js +73 -0
- package/patternfly-docs/generated/components/slider/react.js +309 -0
- package/patternfly-docs/generated/components/spinner/react.js +111 -0
- package/patternfly-docs/generated/components/switch/react.js +163 -0
- package/patternfly-docs/generated/components/table/react-demos.js +355 -0
- package/patternfly-docs/generated/components/table/react-deprecated.js +1350 -0
- package/patternfly-docs/generated/components/table/react.js +3241 -0
- package/patternfly-docs/generated/components/tabs/react-demos.js +108 -0
- package/patternfly-docs/generated/components/tabs/react.js +1359 -0
- package/patternfly-docs/generated/components/text-input-group/react-demos.js +152 -0
- package/patternfly-docs/generated/components/text-input-group/react.js +278 -0
- package/patternfly-docs/generated/components/tile/react-deprecated.js +242 -0
- package/patternfly-docs/generated/components/timestamp/react.js +283 -0
- package/patternfly-docs/generated/components/title/react.js +94 -0
- package/patternfly-docs/generated/components/toggle-group/react.js +299 -0
- package/patternfly-docs/generated/components/toolbar/react-demos.js +66 -0
- package/patternfly-docs/generated/components/toolbar/react.js +932 -0
- package/patternfly-docs/generated/components/tooltip/react.js +241 -0
- package/patternfly-docs/generated/components/tree-view/react.js +429 -0
- package/patternfly-docs/generated/components/truncate/react.js +211 -0
- package/patternfly-docs/generated/components/wizard/react-demos.js +87 -0
- package/patternfly-docs/generated/components/wizard/react-deprecated.js +788 -0
- package/patternfly-docs/generated/components/wizard/react.js +986 -0
- package/patternfly-docs/generated/developer-guides/open-ui-automation/react.js +285 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/bullseye/react.js +70 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/flex/react.js +506 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/gallery/react.js +94 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/grid/react.js +272 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/level/react.js +87 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/split/react.js +124 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/stack/react.js +112 -0
- package/patternfly-docs/generated/index.js +1769 -0
- package/patternfly-docs/generated/patterns/card-view/react-demos.js +78 -0
- package/patternfly-docs/generated/patterns/filters/react-demos.js +141 -0
- package/patternfly-docs/generated/patterns/password-generator/react-demos.js +51 -0
- package/patternfly-docs/generated/patterns/password-strength/react-demos.js +61 -0
- package/patternfly-docs/generated/patterns/primary-detail/react-demos.js +124 -0
- package/patternfly-docs/generated/patterns/right-to-left/react-demos.js +81 -0
- package/LICENSE +0 -21
|
@@ -0,0 +1,747 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
+
import { Fragment, useState } from 'react';
|
|
4
|
+
import '../../../../../../react-core/src/components/MenuToggle/examples/./MenuToggle.css'
|
|
5
|
+
import PlusIcon from '@patternfly/react-icons/dist/esm/icons/plus-icon';
|
|
6
|
+
import RhUiEllipsisVerticalFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ellipsis-vertical-fill-icon';
|
|
7
|
+
import imgAvatar from '@patternfly/react-core/src/components/assets/avatarImg.svg';
|
|
8
|
+
import RhMicronsCloseIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-close-icon';
|
|
9
|
+
const pageData = {
|
|
10
|
+
"id": "Menu toggle",
|
|
11
|
+
"section": "components",
|
|
12
|
+
"subsection": "menus",
|
|
13
|
+
"deprecated": false,
|
|
14
|
+
"template": false,
|
|
15
|
+
"beta": false,
|
|
16
|
+
"demo": false,
|
|
17
|
+
"newImplementationLink": false,
|
|
18
|
+
"source": "react",
|
|
19
|
+
"tabName": null,
|
|
20
|
+
"slug": "/components/menus/menu-toggle/react",
|
|
21
|
+
"sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/MenuToggle/examples/MenuToggle.md",
|
|
22
|
+
"relPath": "packages/react-core/src/components/MenuToggle/examples/MenuToggle.md",
|
|
23
|
+
"propComponents": [
|
|
24
|
+
{
|
|
25
|
+
"name": "MenuToggle",
|
|
26
|
+
"description": "",
|
|
27
|
+
"props": [
|
|
28
|
+
{
|
|
29
|
+
"name": "badge",
|
|
30
|
+
"type": "BadgeProps | React.ReactNode",
|
|
31
|
+
"description": "Optional badge rendered inside the toggle, after the children content"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "children",
|
|
35
|
+
"type": "React.ReactNode",
|
|
36
|
+
"description": "Content rendered inside the toggle"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "className",
|
|
40
|
+
"type": "string",
|
|
41
|
+
"description": "Additional classes added to the toggle"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "icon",
|
|
45
|
+
"type": "React.ReactNode",
|
|
46
|
+
"description": "Optional icon or image rendered inside the toggle, before the children content. It is\nrecommended to wrap most basic icons in our icon component."
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "isCircle",
|
|
50
|
+
"type": "boolean",
|
|
51
|
+
"description": "Flag indicating the toggle has circular styling. Can only be applied to plain toggles.",
|
|
52
|
+
"beta": true
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "isDisabled",
|
|
56
|
+
"type": "boolean",
|
|
57
|
+
"description": "Flag indicating the toggle is disabled"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "isDocked",
|
|
61
|
+
"type": "boolean",
|
|
62
|
+
"description": "Flag indicating the menu toggle is a docked variant. For use in docked navigation.",
|
|
63
|
+
"beta": true
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "isExpanded",
|
|
67
|
+
"type": "boolean",
|
|
68
|
+
"description": "Flag indicating the toggle has expanded styling"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "isFullHeight",
|
|
72
|
+
"type": "boolean",
|
|
73
|
+
"description": "Flag indicating the toggle is full height"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "isFullWidth",
|
|
77
|
+
"type": "boolean",
|
|
78
|
+
"description": "Flag indicating the toggle takes up the full width of its parent"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "isInForm",
|
|
82
|
+
"type": "boolean",
|
|
83
|
+
"description": "Flag indicating the toggle is placed inside a form",
|
|
84
|
+
"beta": true
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "isPlaceholder",
|
|
88
|
+
"type": "boolean",
|
|
89
|
+
"description": "Flag indicating the toggle contains placeholder text"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "isSettings",
|
|
93
|
+
"type": "boolean",
|
|
94
|
+
"description": "Flag indicating whether the toggle is a settings toggle. This will override the icon property"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "isTextExpanded",
|
|
98
|
+
"type": "boolean",
|
|
99
|
+
"description": "Flag indicating the docked toggle should display text. Only applies when isDocked is true.",
|
|
100
|
+
"beta": true
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "ouiaId",
|
|
104
|
+
"type": "number | string",
|
|
105
|
+
"description": "Value to overwrite the randomly generated data-ouia-component-id. It will always target the toggle button."
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"name": "ouiaSafe",
|
|
109
|
+
"type": "boolean",
|
|
110
|
+
"description": "Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false."
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"name": "size",
|
|
114
|
+
"type": "'default' | 'sm'",
|
|
115
|
+
"description": "Adds styling which affects the size of the menu toggle"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"name": "splitButtonItems",
|
|
119
|
+
"type": "React.ReactNode[]",
|
|
120
|
+
"description": "Elements to display before the toggle button. When included, renders the menu toggle as a split button."
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "status",
|
|
124
|
+
"type": "'success' | 'warning' | 'danger'",
|
|
125
|
+
"description": "Status styles of the menu toggle"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"name": "statusIcon",
|
|
129
|
+
"type": "React.ReactNode",
|
|
130
|
+
"description": "Overrides the status icon"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "variant",
|
|
134
|
+
"type": "'default' | 'plain' | 'primary' | 'plainText' | 'secondary' | 'typeahead'",
|
|
135
|
+
"description": "Variant styles of the menu toggle"
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "MenuToggleAction",
|
|
141
|
+
"description": "",
|
|
142
|
+
"props": [
|
|
143
|
+
{
|
|
144
|
+
"name": "children",
|
|
145
|
+
"type": "React.ReactNode",
|
|
146
|
+
"description": "Element to be rendered inside the <button>"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"name": "className",
|
|
150
|
+
"type": "string",
|
|
151
|
+
"description": "Additional classes added to the MenuToggleAction",
|
|
152
|
+
"defaultValue": "''"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "id",
|
|
156
|
+
"type": "string",
|
|
157
|
+
"description": "Id of the action button"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"name": "isDisabled",
|
|
161
|
+
"type": "boolean",
|
|
162
|
+
"description": "Flag to show if the action button is disabled",
|
|
163
|
+
"defaultValue": "false"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"name": "onClick",
|
|
167
|
+
"type": "(event: React.MouseEvent<HTMLButtonElement>) => void",
|
|
168
|
+
"description": "A callback for when the action button is clicked",
|
|
169
|
+
"defaultValue": "() => {}"
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"name": "MenuToggleCheckbox",
|
|
175
|
+
"description": "",
|
|
176
|
+
"props": [
|
|
177
|
+
{
|
|
178
|
+
"name": "children",
|
|
179
|
+
"type": "React.ReactNode",
|
|
180
|
+
"description": "Element to be rendered inside the <span>"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"name": "className",
|
|
184
|
+
"type": "string",
|
|
185
|
+
"description": "Additional classes added to the MenuToggleCheckbox"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"name": "defaultChecked",
|
|
189
|
+
"type": "boolean",
|
|
190
|
+
"description": "Flag to set the default checked value of the checkbox when it is uncontrolled by React state.\nTo make the checkbox controlled instead use the isChecked prop, but do not use both."
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"name": "id",
|
|
194
|
+
"type": "string",
|
|
195
|
+
"description": "Id of the checkbox",
|
|
196
|
+
"required": true
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"name": "isChecked",
|
|
200
|
+
"type": "boolean | null",
|
|
201
|
+
"description": "Flag to show if the checkbox is checked when it is controlled by React state.\nTo make the checkbox uncontrolled instead use the defaultChecked prop, but do not use both."
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"name": "isDisabled",
|
|
205
|
+
"type": "boolean",
|
|
206
|
+
"description": "Flag to show if the checkbox is disabled",
|
|
207
|
+
"defaultValue": "false"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"name": "isValid",
|
|
211
|
+
"type": "boolean",
|
|
212
|
+
"description": "Flag to show if the checkbox selection is valid or invalid",
|
|
213
|
+
"defaultValue": "true"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"name": "onChange",
|
|
217
|
+
"type": "(checked: boolean, event: React.FormEvent<HTMLInputElement>) => void",
|
|
218
|
+
"description": "A callback for when the checkbox selection changes",
|
|
219
|
+
"defaultValue": "() => undefined as any"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"name": "ouiaId",
|
|
223
|
+
"type": "number | string",
|
|
224
|
+
"description": "Value to overwrite the randomly generated data-ouia-component-id."
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"name": "ouiaSafe",
|
|
228
|
+
"type": "boolean",
|
|
229
|
+
"description": "Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false."
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
"cssPrefix": [
|
|
235
|
+
"pf-v6-c-menu-toggle"
|
|
236
|
+
],
|
|
237
|
+
"examples": [
|
|
238
|
+
"Collapsed toggle",
|
|
239
|
+
"Expanded toggle",
|
|
240
|
+
"Small toggle",
|
|
241
|
+
"Disabled toggle",
|
|
242
|
+
"With a badge",
|
|
243
|
+
"Settings toggle",
|
|
244
|
+
"Custom icons",
|
|
245
|
+
"With avatar and text",
|
|
246
|
+
"Variant styles",
|
|
247
|
+
"Plain toggle with icon",
|
|
248
|
+
"Plain circle toggle",
|
|
249
|
+
"Plain toggle with text label",
|
|
250
|
+
"Split toggle with checkbox",
|
|
251
|
+
"Split toggle with labeled checkbox",
|
|
252
|
+
"Split toggle with checkbox and toggle text",
|
|
253
|
+
"Split toggle with action",
|
|
254
|
+
"Full height toggle",
|
|
255
|
+
"Full width toggle",
|
|
256
|
+
"Toggle in a form",
|
|
257
|
+
"Typeahead toggle",
|
|
258
|
+
"Status toggle",
|
|
259
|
+
"Placeholder text in toggle"
|
|
260
|
+
]
|
|
261
|
+
};
|
|
262
|
+
pageData.liveContext = {
|
|
263
|
+
Fragment,
|
|
264
|
+
useState,
|
|
265
|
+
PlusIcon,
|
|
266
|
+
RhUiEllipsisVerticalFillIcon,
|
|
267
|
+
imgAvatar,
|
|
268
|
+
RhMicronsCloseIcon
|
|
269
|
+
};
|
|
270
|
+
pageData.examples = {
|
|
271
|
+
'Collapsed toggle': props =>
|
|
272
|
+
<Example {...pageData} {...props} {...{"code":"import { MenuToggle } from '@patternfly/react-core';\n\nexport const MenuToggleCollapsed: React.FunctionComponent = () => <MenuToggle>Collapsed</MenuToggle>;\n","title":"Collapsed toggle","lang":"ts","className":""}}>
|
|
273
|
+
|
|
274
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
275
|
+
{`A toggle is collapsed until it is selected by a user.`}
|
|
276
|
+
</p>
|
|
277
|
+
</Example>,
|
|
278
|
+
'Expanded toggle': props =>
|
|
279
|
+
<Example {...pageData} {...props} {...{"code":"import { MenuToggle } from '@patternfly/react-core';\n\nexport const MenuToggleExpanded: React.FunctionComponent = () => <MenuToggle isExpanded>Expanded</MenuToggle>;\n","title":"Expanded toggle","lang":"ts","className":""}}>
|
|
280
|
+
|
|
281
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
282
|
+
{`When a user selects a toggle, it becomes expanded and is styled with a blue underline. To flag expanded toggles, and apply expanded styling, use the `}
|
|
283
|
+
|
|
284
|
+
<code {...{"className":"ws-code "}}>
|
|
285
|
+
{`isExpanded`}
|
|
286
|
+
</code>
|
|
287
|
+
{` property .`}
|
|
288
|
+
</p>
|
|
289
|
+
</Example>,
|
|
290
|
+
'Small toggle': props =>
|
|
291
|
+
<Example {...pageData} {...props} {...{"code":"import { MenuToggle } from '@patternfly/react-core';\n\nexport const MenuToggleSmall: React.FunctionComponent = () => <MenuToggle size=\"sm\">Small toggle</MenuToggle>;\n","title":"Small toggle","lang":"ts","className":""}}>
|
|
292
|
+
|
|
293
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
294
|
+
{`You can pass `}
|
|
295
|
+
|
|
296
|
+
<code {...{"className":"ws-code "}}>
|
|
297
|
+
{`size="sm"`}
|
|
298
|
+
</code>
|
|
299
|
+
{` to a MenuToggle to style it as a small toggle, such as within a `}
|
|
300
|
+
|
|
301
|
+
<PatternflyThemeLink {...{"to":"/components/breadcrumb","className":""}}>
|
|
302
|
+
{`breadcrumb`}
|
|
303
|
+
</PatternflyThemeLink>
|
|
304
|
+
{`.`}
|
|
305
|
+
</p>
|
|
306
|
+
</Example>,
|
|
307
|
+
'Disabled toggle': props =>
|
|
308
|
+
<Example {...pageData} {...props} {...{"code":"import { MenuToggle } from '@patternfly/react-core';\n\nexport const MenuToggleDisabled: React.FunctionComponent = () => <MenuToggle isDisabled>Disabled</MenuToggle>;\n","title":"Disabled toggle","lang":"ts","className":""}}>
|
|
309
|
+
|
|
310
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
311
|
+
{`To disable the selection and expansion of a toggle, use the `}
|
|
312
|
+
|
|
313
|
+
<code {...{"className":"ws-code "}}>
|
|
314
|
+
{`isDisabled`}
|
|
315
|
+
</code>
|
|
316
|
+
{` property.`}
|
|
317
|
+
</p>
|
|
318
|
+
</Example>,
|
|
319
|
+
'With a badge': props =>
|
|
320
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { MenuToggle, Badge } from '@patternfly/react-core';\n\nexport const MenuToggleBadge: React.FunctionComponent = () => (\n <Fragment>\n <MenuToggle badge={<Badge>4 selected</Badge>}>Count</MenuToggle>\n <MenuToggle variant=\"plainText\" badge={<Badge screenReaderText=\"additional items\">4</Badge>} />\n </Fragment>\n);\n","title":"With a badge","lang":"ts","className":""}}>
|
|
321
|
+
|
|
322
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
323
|
+
{`To display a count of selected items in a toggle, use the `}
|
|
324
|
+
|
|
325
|
+
<code {...{"className":"ws-code "}}>
|
|
326
|
+
{`badge`}
|
|
327
|
+
</code>
|
|
328
|
+
{` property. You can also pass in `}
|
|
329
|
+
|
|
330
|
+
<code {...{"className":"ws-code "}}>
|
|
331
|
+
{`variant="plainText"`}
|
|
332
|
+
</code>
|
|
333
|
+
{` for a badge only toggle.`}
|
|
334
|
+
</p>
|
|
335
|
+
</Example>,
|
|
336
|
+
'Settings toggle': props =>
|
|
337
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react/jsx-runtime';\nimport { MenuToggle } from '@patternfly/react-core';\n\nexport const MenuToggleSettings: React.FunctionComponent = () => (\n <Fragment>\n <MenuToggle isSettings>Settings</MenuToggle> <MenuToggle isSettings variant=\"plain\" aria-label=\"Settings\" />\n </Fragment>\n);\n","title":"Settings toggle","lang":"ts","className":""}}>
|
|
338
|
+
|
|
339
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
340
|
+
{`To create a "settings" menu toggle that will animate on hover and focus, you can pass the `}
|
|
341
|
+
|
|
342
|
+
<code {...{"className":"ws-code "}}>
|
|
343
|
+
{`isSettings`}
|
|
344
|
+
</code>
|
|
345
|
+
{` property in. Doing so will override the `}
|
|
346
|
+
|
|
347
|
+
<code {...{"className":"ws-code "}}>
|
|
348
|
+
{`icon`}
|
|
349
|
+
</code>
|
|
350
|
+
{` property, as a specific icon is used internally for the animations.`}
|
|
351
|
+
</p>
|
|
352
|
+
</Example>,
|
|
353
|
+
'Custom icons': props =>
|
|
354
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { MenuToggle } from '@patternfly/react-core';\nimport PlusIcon from '@patternfly/react-icons/dist/esm/icons/plus-icon';\n\nexport const MenuToggleCustomIcon: React.FC = () => (\n <Fragment>\n <MenuToggle icon={<PlusIcon />} variant=\"primary\">\n Icon\n </MenuToggle>{' '}\n <MenuToggle icon={<PlusIcon />} variant=\"secondary\">\n Icon\n </MenuToggle>{' '}\n <MenuToggle icon={<PlusIcon />} variant=\"secondary\" isDisabled>\n Icon\n </MenuToggle>\n </Fragment>\n);\n","title":"Custom icons","lang":"ts","className":""}}>
|
|
355
|
+
|
|
356
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
357
|
+
{`To add a recognizable icon to a menu toggle, use the `}
|
|
358
|
+
|
|
359
|
+
<code {...{"className":"ws-code "}}>
|
|
360
|
+
{`icon`}
|
|
361
|
+
</code>
|
|
362
|
+
{` property. The following example adds a `}
|
|
363
|
+
|
|
364
|
+
<code {...{"className":"ws-code "}}>
|
|
365
|
+
{`PlusIcon`}
|
|
366
|
+
</code>
|
|
367
|
+
{` to the toggle.`}
|
|
368
|
+
</p>
|
|
369
|
+
|
|
370
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
371
|
+
{`For most basic icons, it is recommended to wrap it inside our `}
|
|
372
|
+
|
|
373
|
+
<PatternflyThemeLink {...{"to":"/components/icon","className":""}}>
|
|
374
|
+
{`icon component`}
|
|
375
|
+
</PatternflyThemeLink>
|
|
376
|
+
{`.`}
|
|
377
|
+
</p>
|
|
378
|
+
</Example>,
|
|
379
|
+
'With avatar and text': props =>
|
|
380
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { MenuToggle, Avatar } from '@patternfly/react-core';\nimport imgAvatar from '@patternfly/react-core/src/components/assets/avatarImg.svg';\n\nexport const MenuToggleAvatarText: React.FunctionComponent = () => (\n <Fragment>\n <MenuToggle icon={<Avatar src={imgAvatar} alt=\"avatar\" />}>Ned Username</MenuToggle>{' '}\n <MenuToggle icon={<Avatar src={imgAvatar} alt=\"avatar\" />} isExpanded>\n Ned Username\n </MenuToggle>{' '}\n <MenuToggle icon={<Avatar src={imgAvatar} alt=\"avatar\" />} isDisabled>\n Ned Username\n </MenuToggle>\n </Fragment>\n);\n","title":"With avatar and text","lang":"ts","className":""}}>
|
|
381
|
+
|
|
382
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
383
|
+
{`You can also pass images into the `}
|
|
384
|
+
|
|
385
|
+
<code {...{"className":"ws-code "}}>
|
|
386
|
+
{`icon`}
|
|
387
|
+
</code>
|
|
388
|
+
{` property. The following example passes in an `}
|
|
389
|
+
|
|
390
|
+
<code {...{"className":"ws-code "}}>
|
|
391
|
+
{`<Avatar>`}
|
|
392
|
+
</code>
|
|
393
|
+
{` component with an `}
|
|
394
|
+
|
|
395
|
+
<code {...{"className":"ws-code "}}>
|
|
396
|
+
{`imgAvatar`}
|
|
397
|
+
</code>
|
|
398
|
+
{`.`}
|
|
399
|
+
</p>
|
|
400
|
+
|
|
401
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
402
|
+
{`This can be used alongside a text label that provides more context for the image.`}
|
|
403
|
+
</p>
|
|
404
|
+
</Example>,
|
|
405
|
+
'Variant styles': props =>
|
|
406
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { MenuToggle } from '@patternfly/react-core';\n\nexport const MenuToggleVariantStyles: React.FunctionComponent = () => (\n <Fragment>\n <MenuToggle variant=\"primary\">Collapsed</MenuToggle>{' '}\n <MenuToggle variant=\"primary\" isExpanded>\n Expanded\n </MenuToggle>{' '}\n <MenuToggle variant=\"primary\" isDisabled>\n Disabled\n </MenuToggle>\n </Fragment>\n);\n","title":"Variant styles","lang":"ts","className":""}}>
|
|
407
|
+
|
|
408
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
409
|
+
{`Variant styling can be applied to menu toggles. In the following example, the toggle uses primary styling by passing `}
|
|
410
|
+
|
|
411
|
+
<code {...{"className":"ws-code "}}>
|
|
412
|
+
{`variant="primary"`}
|
|
413
|
+
</code>
|
|
414
|
+
{` into the `}
|
|
415
|
+
|
|
416
|
+
<code {...{"className":"ws-code "}}>
|
|
417
|
+
{`<MenuToggle>`}
|
|
418
|
+
</code>
|
|
419
|
+
{` component. Additional variant options include “default”, “plain”, “plainText”, “secondary”, and “typeahead”.`}
|
|
420
|
+
</p>
|
|
421
|
+
</Example>,
|
|
422
|
+
'Plain toggle with icon': props =>
|
|
423
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { MenuToggle } from '@patternfly/react-core';\nimport RhUiEllipsisVerticalFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ellipsis-vertical-fill-icon';\n\nexport const MenuTogglePlainIcon: React.FunctionComponent = () => (\n <Fragment>\n <MenuToggle icon={<RhUiEllipsisVerticalFillIcon />} variant=\"plain\" aria-label=\"plain kebab\" />{' '}\n <MenuToggle icon={<RhUiEllipsisVerticalFillIcon />} variant=\"plain\" isExpanded aria-label=\"plain expanded kebab\" />{' '}\n <MenuToggle icon={<RhUiEllipsisVerticalFillIcon />} variant=\"plain\" isDisabled aria-label=\"disabled plain kebab\" />\n </Fragment>\n);\n","title":"Plain toggle with icon","lang":"ts","className":""}}>
|
|
424
|
+
|
|
425
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
426
|
+
{`To apply plain styling to a menu toggle with an icon, pass in `}
|
|
427
|
+
|
|
428
|
+
<code {...{"className":"ws-code "}}>
|
|
429
|
+
{`variant="plain"`}
|
|
430
|
+
</code>
|
|
431
|
+
{`. This will remove the default bottom border and caret. You may pass in an `}
|
|
432
|
+
|
|
433
|
+
<code {...{"className":"ws-code "}}>
|
|
434
|
+
{`icon`}
|
|
435
|
+
</code>
|
|
436
|
+
{` to serve as the menu toggle. The following example passes in an `}
|
|
437
|
+
|
|
438
|
+
<code {...{"className":"ws-code "}}>
|
|
439
|
+
{`RhUiEllipsisVerticalFillIcon`}
|
|
440
|
+
</code>
|
|
441
|
+
{`.`}
|
|
442
|
+
</p>
|
|
443
|
+
|
|
444
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
445
|
+
{`If the toggle does not have any visible text content, use the `}
|
|
446
|
+
|
|
447
|
+
<code {...{"className":"ws-code "}}>
|
|
448
|
+
{`aria-label`}
|
|
449
|
+
</code>
|
|
450
|
+
{` property to provide an accessible name.`}
|
|
451
|
+
</p>
|
|
452
|
+
</Example>,
|
|
453
|
+
'Plain circle toggle': props =>
|
|
454
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { MenuToggle } from '@patternfly/react-core';\nimport RhUiEllipsisVerticalFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ellipsis-vertical-fill-icon';\n\nexport const MenuTogglePlainCircle: React.FunctionComponent = () => (\n <Fragment>\n <MenuToggle isCircle icon={<RhUiEllipsisVerticalFillIcon />} variant=\"plain\" aria-label=\"plain circle kebab\" />{' '}\n <MenuToggle\n isCircle\n icon={<RhUiEllipsisVerticalFillIcon />}\n variant=\"plain\"\n isExpanded\n aria-label=\"plain circle expanded kebab\"\n />{' '}\n <MenuToggle\n isCircle\n icon={<RhUiEllipsisVerticalFillIcon />}\n variant=\"plain\"\n isDisabled\n aria-label=\"disabled plain circle kebab\"\n />\n </Fragment>\n);\n","title":"Plain circle toggle","lang":"ts","className":""}}>
|
|
455
|
+
|
|
456
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
457
|
+
{`You can also pass the `}
|
|
458
|
+
|
|
459
|
+
<code {...{"className":"ws-code "}}>
|
|
460
|
+
{`isCircle`}
|
|
461
|
+
</code>
|
|
462
|
+
{` property to a plain, icon-only toggle to adjust the styling to a complete circular shape, rather than a rounded square.`}
|
|
463
|
+
</p>
|
|
464
|
+
</Example>,
|
|
465
|
+
'Plain toggle with text label': props =>
|
|
466
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { MenuToggle } from '@patternfly/react-core';\n\nexport const MenuTogglePlainTextLabel: React.FunctionComponent = () => (\n <Fragment>\n <MenuToggle variant=\"plainText\" isDisabled aria-label=\"Disabled plain menu toggle\">\n Disabled\n </MenuToggle>{' '}\n <MenuToggle variant=\"plainText\" aria-label=\"Plain menu toggle\">\n Custom text\n </MenuToggle>{' '}\n <MenuToggle variant=\"plainText\" isExpanded aria-label=\"Expanded plain menu toggle\">\n Custom text (expanded)\n </MenuToggle>\n </Fragment>\n);\n","title":"Plain toggle with text label","lang":"ts","className":""}}>
|
|
467
|
+
|
|
468
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
469
|
+
{`To apply plain styling to a menu toggle with a text label, pass in `}
|
|
470
|
+
|
|
471
|
+
<code {...{"className":"ws-code "}}>
|
|
472
|
+
{`variant="plainText"`}
|
|
473
|
+
</code>
|
|
474
|
+
{`. Unlike the “plain” variant, “plainText” adds a caret pointing down in the toggle.`}
|
|
475
|
+
</p>
|
|
476
|
+
</Example>,
|
|
477
|
+
'Split toggle with checkbox': props =>
|
|
478
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { MenuToggleCheckbox, MenuToggle } from '@patternfly/react-core';\n\nexport const MenuToggleSplitButtonCheckbox: React.FunctionComponent = () => (\n <Fragment>\n <MenuToggle\n splitButtonItems={[\n <MenuToggleCheckbox id=\"split-button-checkbox-example\" key=\"split-checkbox\" aria-label=\"Select all\" />\n ]}\n aria-label=\"Menu toggle with checkbox split button\"\n />{' '}\n <MenuToggle\n variant=\"primary\"\n splitButtonItems={[\n <MenuToggleCheckbox id=\"split-button-checkbox-example\" key=\"split-checkbox\" aria-label=\"Select all\" />\n ]}\n aria-label=\"Menu toggle with checkbox split button\"\n />{' '}\n <MenuToggle\n variant=\"secondary\"\n splitButtonItems={[\n <MenuToggleCheckbox id=\"split-button-checkbox-example\" key=\"split-checkbox\" aria-label=\"Select all\" />\n ]}\n aria-label=\"Menu toggle with checkbox split button\"\n />\n </Fragment>\n);\n","title":"Split toggle with checkbox","lang":"ts","className":""}}>
|
|
479
|
+
|
|
480
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
481
|
+
{`To add a checkbox (or other action/control) to a menu toggle, use a split button.`}
|
|
482
|
+
</p>
|
|
483
|
+
|
|
484
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
485
|
+
{`A `}
|
|
486
|
+
|
|
487
|
+
<code {...{"className":"ws-code "}}>
|
|
488
|
+
{`<MenuToggle>`}
|
|
489
|
+
</code>
|
|
490
|
+
{` can be rendered as a split button by adding a `}
|
|
491
|
+
|
|
492
|
+
<code {...{"className":"ws-code "}}>
|
|
493
|
+
{`splitButtonItems`}
|
|
494
|
+
</code>
|
|
495
|
+
{` property. Elements to be displayed before the toggle button must be included in the `}
|
|
496
|
+
|
|
497
|
+
<code {...{"className":"ws-code "}}>
|
|
498
|
+
{`splitButtonItems`}
|
|
499
|
+
</code>
|
|
500
|
+
{`.`}
|
|
501
|
+
</p>
|
|
502
|
+
|
|
503
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
504
|
+
{`The following example shows a split button with a `}
|
|
505
|
+
|
|
506
|
+
<code {...{"className":"ws-code "}}>
|
|
507
|
+
{`<MenuToggleCheckbox>`}
|
|
508
|
+
</code>
|
|
509
|
+
{`.`}
|
|
510
|
+
</p>
|
|
511
|
+
|
|
512
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
513
|
+
{`Variant styling can be applied to split button toggles to adjust their appearance for different scenarios. Both "primary" and "secondary" variants can be used with split button toggles.`}
|
|
514
|
+
</p>
|
|
515
|
+
</Example>,
|
|
516
|
+
'Split toggle with labeled checkbox': props =>
|
|
517
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { MenuToggleCheckbox, MenuToggle } from '@patternfly/react-core';\n\nexport const MenuToggleSplitButtonCheckboxWithText: React.FunctionComponent = () => (\n <Fragment>\n <MenuToggle\n splitButtonItems={[\n <MenuToggleCheckbox\n id=\"split-button-checkbox-with-text-example\"\n key=\"split-checkbox-with-text\"\n aria-label=\"Select all\"\n >\n 10 selected\n </MenuToggleCheckbox>\n ]}\n aria-label=\"Menu toggle with checkbox split button and text\"\n />{' '}\n <MenuToggle\n variant=\"primary\"\n splitButtonItems={[\n <MenuToggleCheckbox\n id=\"split-button-checkbox-primary-example\"\n key=\"split-checkbox-primary\"\n aria-label=\"Select all\"\n >\n 10 selected\n </MenuToggleCheckbox>\n ]}\n aria-label=\"Primary menu toggle with checkbox split button\"\n />{' '}\n <MenuToggle\n variant=\"secondary\"\n splitButtonItems={[\n <MenuToggleCheckbox\n id=\"split-button-checkbox-secondary-example\"\n key=\"split-checkbox-secondary\"\n aria-label=\"Select all\"\n >\n 10 selected\n </MenuToggleCheckbox>\n ]}\n aria-label=\"Secondary menu toggle with checkbox split button\"\n />\n </Fragment>\n);\n","title":"Split toggle with labeled checkbox","lang":"ts","className":""}}>
|
|
518
|
+
|
|
519
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
520
|
+
{`You can allow users to select a toggle checkbox by clicking either the checkbox or the text label.`}
|
|
521
|
+
</p>
|
|
522
|
+
|
|
523
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
524
|
+
{`To link a split toggle label to the toggle's checkbox, pass both the label and the `}
|
|
525
|
+
|
|
526
|
+
<code {...{"className":"ws-code "}}>
|
|
527
|
+
{`<MenuToggleCheckbox>`}
|
|
528
|
+
</code>
|
|
529
|
+
{` component to `}
|
|
530
|
+
|
|
531
|
+
<code {...{"className":"ws-code "}}>
|
|
532
|
+
{`splitButtonItems`}
|
|
533
|
+
</code>
|
|
534
|
+
{`.`}
|
|
535
|
+
</p>
|
|
536
|
+
</Example>,
|
|
537
|
+
'Split toggle with checkbox and toggle text': props =>
|
|
538
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { MenuToggleCheckbox, MenuToggle } from '@patternfly/react-core';\n\nexport const MenuToggleSplitButtonCheckboxWithToggleText: React.FunctionComponent = () => (\n <Fragment>\n <MenuToggle\n splitButtonItems={[\n <MenuToggleCheckbox\n id=\"split-button-checkbox-with-text-example\"\n key=\"split-checkbox-with-text\"\n aria-label=\"Select all\"\n />\n ]}\n aria-label=\"Menu toggle with checkbox split button and text\"\n >\n 10 selected\n </MenuToggle>{' '}\n <MenuToggle\n variant=\"primary\"\n splitButtonItems={[\n <MenuToggleCheckbox\n id=\"split-button-checkbox-primary-example\"\n key=\"split-checkbox-primary\"\n aria-label=\"Select all\"\n />\n ]}\n aria-label=\"Primary menu toggle with checkbox split button\"\n >\n 10 selected\n </MenuToggle>{' '}\n <MenuToggle\n variant=\"secondary\"\n splitButtonItems={[\n <MenuToggleCheckbox\n id=\"split-button-checkbox-secondary-example\"\n key=\"split-checkbox-secondary\"\n aria-label=\"Select all\"\n />\n ]}\n aria-label=\"Secondary menu toggle with checkbox split button\"\n >\n 10 selected\n </MenuToggle>\n </Fragment>\n);\n","title":"Split toggle with checkbox and toggle text","lang":"ts","className":""}}>
|
|
539
|
+
|
|
540
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
541
|
+
{`To link a split toggle label to the toggle button itself, pass the label to the `}
|
|
542
|
+
|
|
543
|
+
<code {...{"className":"ws-code "}}>
|
|
544
|
+
{`<MenuToggle>`}
|
|
545
|
+
</code>
|
|
546
|
+
{` component, instead of `}
|
|
547
|
+
|
|
548
|
+
<code {...{"className":"ws-code "}}>
|
|
549
|
+
{`splitButtonItems`}
|
|
550
|
+
</code>
|
|
551
|
+
{`.`}
|
|
552
|
+
</p>
|
|
553
|
+
</Example>,
|
|
554
|
+
'Split toggle with action': props =>
|
|
555
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { MenuToggleAction, MenuToggle } from '@patternfly/react-core';\n\nexport const MenuToggleSplitButtonAction: React.FunctionComponent = () => (\n <Fragment>\n <MenuToggle\n splitButtonItems={[\n <MenuToggleAction id=\"split-button-action-example-with-toggle-button\" key=\"split-action\" aria-label=\"Action\">\n Action\n </MenuToggleAction>\n ]}\n aria-label=\"Menu toggle with action split button\"\n />{' '}\n <MenuToggle\n variant=\"primary\"\n splitButtonItems={[\n <MenuToggleAction\n id=\"split-button-action-primary-example-with-toggle-button\"\n key=\"split-action-primary\"\n aria-label=\"Action\"\n >\n Action\n </MenuToggleAction>\n ]}\n aria-label=\"Menu toggle with action split button\"\n />{' '}\n <MenuToggle\n variant=\"secondary\"\n splitButtonItems={[\n <MenuToggleAction\n id=\"split-button-action-secondary-example-with-toggle-button\"\n key=\"split-action-secondary\"\n aria-label=\"Action\"\n >\n Action\n </MenuToggleAction>\n ]}\n aria-label=\"Menu toggle with action split button\"\n />\n </Fragment>\n);\n","title":"Split toggle with action","lang":"ts","className":""}}>
|
|
556
|
+
|
|
557
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
558
|
+
{`To add an action to a split button, add a `}
|
|
559
|
+
|
|
560
|
+
<code {...{"className":"ws-code "}}>
|
|
561
|
+
{`<MenuToggleAction>`}
|
|
562
|
+
</code>
|
|
563
|
+
{` to the `}
|
|
564
|
+
|
|
565
|
+
<code {...{"className":"ws-code "}}>
|
|
566
|
+
{`splitButtonItems`}
|
|
567
|
+
</code>
|
|
568
|
+
{` property.`}
|
|
569
|
+
</p>
|
|
570
|
+
|
|
571
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
572
|
+
{`Actions may be used with primary and secondary toggle variants.`}
|
|
573
|
+
</p>
|
|
574
|
+
</Example>,
|
|
575
|
+
'Full height toggle': props =>
|
|
576
|
+
<Example {...pageData} {...props} {...{"code":"import { MenuToggle } from '@patternfly/react-core';\n\nexport const MenuToggleFullHeight: React.FunctionComponent = () => (\n <div style={{ height: '80px' }}>\n <MenuToggle isFullHeight aria-label=\"Full height menu toggle\">\n Full height\n </MenuToggle>\n </div>\n);\n","title":"Full height toggle","lang":"ts","className":""}}>
|
|
577
|
+
|
|
578
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
579
|
+
{`A full height toggle fills the height of its parent. To flag a full height toggle, use the `}
|
|
580
|
+
|
|
581
|
+
<code {...{"className":"ws-code "}}>
|
|
582
|
+
{`isFullHeight`}
|
|
583
|
+
</code>
|
|
584
|
+
{` property.`}
|
|
585
|
+
</p>
|
|
586
|
+
|
|
587
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
588
|
+
{`In the following example, the toggle fills the size of the "80px" `}
|
|
589
|
+
|
|
590
|
+
<code {...{"className":"ws-code "}}>
|
|
591
|
+
{`<div>`}
|
|
592
|
+
</code>
|
|
593
|
+
{` element that it is within.`}
|
|
594
|
+
</p>
|
|
595
|
+
</Example>,
|
|
596
|
+
'Full width toggle': props =>
|
|
597
|
+
<Example {...pageData} {...props} {...{"code":"import { MenuToggle } from '@patternfly/react-core';\n\nexport const MenuToggleFullWidth: React.FunctionComponent = () => (\n <MenuToggle isFullWidth aria-label=\"Full width menu toggle\">\n Full width\n </MenuToggle>\n);\n","title":"Full width toggle","lang":"ts","className":""}}>
|
|
598
|
+
|
|
599
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
600
|
+
{`A full width toggle fills the width of its parent. To flag a full width toggle, use the `}
|
|
601
|
+
|
|
602
|
+
<code {...{"className":"ws-code "}}>
|
|
603
|
+
{`isFullWidth`}
|
|
604
|
+
</code>
|
|
605
|
+
{` property.`}
|
|
606
|
+
</p>
|
|
607
|
+
|
|
608
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
609
|
+
{`In the following example, the toggle fills the width of its parent as the window size changes.`}
|
|
610
|
+
</p>
|
|
611
|
+
</Example>,
|
|
612
|
+
'Toggle in a form': props =>
|
|
613
|
+
<Example {...pageData} {...props} {...{"code":"import { MenuToggle } from '@patternfly/react-core';\n\nexport const MenuToggleInForm = (): JSX.Element => (\n <MenuToggle isInForm aria-label=\"Menu toggle in a form\">\n In form\n </MenuToggle>\n);\n","title":"Toggle in a form","lang":"ts","className":""}}>
|
|
614
|
+
|
|
615
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
616
|
+
{`When a menu toggle is used inside a form, pass the `}
|
|
617
|
+
|
|
618
|
+
<code {...{"className":"ws-code "}}>
|
|
619
|
+
{`isInForm`}
|
|
620
|
+
</code>
|
|
621
|
+
{` property so the toggle receives form-appropriate styling.`}
|
|
622
|
+
</p>
|
|
623
|
+
</Example>,
|
|
624
|
+
'Typeahead toggle': props =>
|
|
625
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport {\n MenuToggle,\n TextInputGroup,\n TextInputGroupMain,\n TextInputGroupUtilities,\n Button\n} from '@patternfly/react-core';\nimport RhMicronsCloseIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-close-icon';\n\nexport const MenuToggleTypeahead: React.FunctionComponent = () => {\n const [inputValue, setInputValue] = useState<string>('');\n\n const onTextInputChange = (_event: React.FormEvent<HTMLInputElement>, value: string) => {\n setInputValue(value);\n };\n\n return (\n <MenuToggle variant=\"typeahead\" isFullWidth aria-label=\"Typeahead menu toggle\">\n <TextInputGroup isPlain>\n <TextInputGroupMain\n value={inputValue}\n onChange={onTextInputChange}\n id=\"typeahead-select-input\"\n autoComplete=\"off\"\n />\n\n <TextInputGroupUtilities>\n {!!inputValue && (\n <Button\n variant=\"plain\"\n onClick={() => setInputValue('')}\n aria-label=\"Clear input value\"\n icon={<RhMicronsCloseIcon />}\n />\n )}\n </TextInputGroupUtilities>\n </TextInputGroup>\n </MenuToggle>\n );\n};\n","title":"Typeahead toggle","lang":"ts","className":""}}>
|
|
626
|
+
|
|
627
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
628
|
+
{`To create a typeahead toggle, pass in `}
|
|
629
|
+
|
|
630
|
+
<code {...{"className":"ws-code "}}>
|
|
631
|
+
{`variant="typeahead"`}
|
|
632
|
+
</code>
|
|
633
|
+
{` to the `}
|
|
634
|
+
|
|
635
|
+
<code {...{"className":"ws-code "}}>
|
|
636
|
+
{`<MenuToggle>`}
|
|
637
|
+
</code>
|
|
638
|
+
{`. Then, pass a `}
|
|
639
|
+
|
|
640
|
+
<code {...{"className":"ws-code "}}>
|
|
641
|
+
{`<TextInputGroup>`}
|
|
642
|
+
</code>
|
|
643
|
+
{` component as a child of the `}
|
|
644
|
+
|
|
645
|
+
<code {...{"className":"ws-code "}}>
|
|
646
|
+
{`<MenuToggle>`}
|
|
647
|
+
</code>
|
|
648
|
+
{`.`}
|
|
649
|
+
</p>
|
|
650
|
+
|
|
651
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
652
|
+
{`To create a multiple typeahead toggle, pass a `}
|
|
653
|
+
|
|
654
|
+
<code {...{"className":"ws-code "}}>
|
|
655
|
+
{`<TextInputGroup>`}
|
|
656
|
+
</code>
|
|
657
|
+
{` component implemented like the `}
|
|
658
|
+
|
|
659
|
+
<PatternflyThemeLink {...{"to":"/components/text-input-group#filters","className":""}}>
|
|
660
|
+
{`text input group's filter example`}
|
|
661
|
+
</PatternflyThemeLink>
|
|
662
|
+
{` as a child of `}
|
|
663
|
+
|
|
664
|
+
<code {...{"className":"ws-code "}}>
|
|
665
|
+
{`<MenuToggle>`}
|
|
666
|
+
</code>
|
|
667
|
+
{`.`}
|
|
668
|
+
</p>
|
|
669
|
+
</Example>,
|
|
670
|
+
'Status toggle': props =>
|
|
671
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { MenuToggle, HelperText, HelperTextItem } from '@patternfly/react-core';\n\nexport const MenuToggleStatus: React.FunctionComponent = () => (\n <Fragment>\n <MenuToggle status=\"success\">Success</MenuToggle>\n <br />\n <br />\n <MenuToggle status=\"warning\">Warning</MenuToggle>\n <HelperText>\n <HelperTextItem variant=\"warning\">Warning text that explains the issue.</HelperTextItem>\n </HelperText>\n <br />\n <br />\n <MenuToggle status=\"danger\">Danger</MenuToggle>\n <HelperText>\n <HelperTextItem variant=\"error\">Danger text that explains the issue.</HelperTextItem>\n </HelperText>\n </Fragment>\n);\n","title":"Status toggle","lang":"ts","className":""}}>
|
|
672
|
+
|
|
673
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
674
|
+
{`To create a toggle with a status, pass in the `}
|
|
675
|
+
|
|
676
|
+
<code {...{"className":"ws-code "}}>
|
|
677
|
+
{`status`}
|
|
678
|
+
</code>
|
|
679
|
+
{` property to the `}
|
|
680
|
+
|
|
681
|
+
<code {...{"className":"ws-code "}}>
|
|
682
|
+
{`MenuToggle`}
|
|
683
|
+
</code>
|
|
684
|
+
{`. The default icon associated with each status may be overridden by using the `}
|
|
685
|
+
|
|
686
|
+
<code {...{"className":"ws-code "}}>
|
|
687
|
+
{`statusIcon`}
|
|
688
|
+
</code>
|
|
689
|
+
{` property.`}
|
|
690
|
+
</p>
|
|
691
|
+
|
|
692
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
693
|
+
{`When the status value is "warning" or "danger", you must include helper text that conveys what is causing the warning/error.`}
|
|
694
|
+
</p>
|
|
695
|
+
</Example>,
|
|
696
|
+
'Placeholder text in toggle': props =>
|
|
697
|
+
<Example {...pageData} {...props} {...{"code":"import { MenuToggle } from '@patternfly/react-core';\n\nexport const MenuTogglePlaceholder: React.FunctionComponent = () => (\n <MenuToggle isPlaceholder>Placeholder text</MenuToggle>\n);\n","title":"Placeholder text in toggle","lang":"ts","className":""}}>
|
|
698
|
+
|
|
699
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
700
|
+
{`To indicate the toggle contains placeholder text, pass the `}
|
|
701
|
+
|
|
702
|
+
<code {...{"className":"ws-code "}}>
|
|
703
|
+
{`isPlaceholder`}
|
|
704
|
+
</code>
|
|
705
|
+
{` property to the `}
|
|
706
|
+
|
|
707
|
+
<code {...{"className":"ws-code "}}>
|
|
708
|
+
{`MenuToggle`}
|
|
709
|
+
</code>
|
|
710
|
+
{`.`}
|
|
711
|
+
</p>
|
|
712
|
+
</Example>
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
const Component = () => (
|
|
716
|
+
<React.Fragment>
|
|
717
|
+
<AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
718
|
+
{`Examples`}
|
|
719
|
+
</AutoLinkHeader>
|
|
720
|
+
{React.createElement(pageData.examples["Collapsed toggle"])}
|
|
721
|
+
{React.createElement(pageData.examples["Expanded toggle"])}
|
|
722
|
+
{React.createElement(pageData.examples["Small toggle"])}
|
|
723
|
+
{React.createElement(pageData.examples["Disabled toggle"])}
|
|
724
|
+
{React.createElement(pageData.examples["With a badge"])}
|
|
725
|
+
{React.createElement(pageData.examples["Settings toggle"])}
|
|
726
|
+
{React.createElement(pageData.examples["Custom icons"])}
|
|
727
|
+
{React.createElement(pageData.examples["With avatar and text"])}
|
|
728
|
+
{React.createElement(pageData.examples["Variant styles"])}
|
|
729
|
+
{React.createElement(pageData.examples["Plain toggle with icon"])}
|
|
730
|
+
{React.createElement(pageData.examples["Plain circle toggle"])}
|
|
731
|
+
{React.createElement(pageData.examples["Plain toggle with text label"])}
|
|
732
|
+
{React.createElement(pageData.examples["Split toggle with checkbox"])}
|
|
733
|
+
{React.createElement(pageData.examples["Split toggle with labeled checkbox"])}
|
|
734
|
+
{React.createElement(pageData.examples["Split toggle with checkbox and toggle text"])}
|
|
735
|
+
{React.createElement(pageData.examples["Split toggle with action"])}
|
|
736
|
+
{React.createElement(pageData.examples["Full height toggle"])}
|
|
737
|
+
{React.createElement(pageData.examples["Full width toggle"])}
|
|
738
|
+
{React.createElement(pageData.examples["Toggle in a form"])}
|
|
739
|
+
{React.createElement(pageData.examples["Typeahead toggle"])}
|
|
740
|
+
{React.createElement(pageData.examples["Status toggle"])}
|
|
741
|
+
{React.createElement(pageData.examples["Placeholder text in toggle"])}
|
|
742
|
+
</React.Fragment>
|
|
743
|
+
);
|
|
744
|
+
Component.displayName = 'ComponentsMenusMenuToggleReactDocs';
|
|
745
|
+
Component.pageData = pageData;
|
|
746
|
+
|
|
747
|
+
export default Component;
|