@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,417 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
+
import { Fragment, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';
|
|
5
|
+
import RhUiInformationFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-information-fill-icon';
|
|
6
|
+
import '../../../../../react-core/src/components/Label/examples/./Label.css';
|
|
7
|
+
const pageData = {
|
|
8
|
+
"id": "Label",
|
|
9
|
+
"section": "components",
|
|
10
|
+
"subsection": "",
|
|
11
|
+
"deprecated": false,
|
|
12
|
+
"template": false,
|
|
13
|
+
"beta": false,
|
|
14
|
+
"demo": false,
|
|
15
|
+
"newImplementationLink": false,
|
|
16
|
+
"source": "react",
|
|
17
|
+
"tabName": null,
|
|
18
|
+
"slug": "/components/label/react",
|
|
19
|
+
"sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/Label/examples/Label.md",
|
|
20
|
+
"relPath": "packages/react-core/src/components/Label/examples/Label.md",
|
|
21
|
+
"propComponents": [
|
|
22
|
+
{
|
|
23
|
+
"name": "Label",
|
|
24
|
+
"description": "",
|
|
25
|
+
"props": [
|
|
26
|
+
{
|
|
27
|
+
"name": "children",
|
|
28
|
+
"type": "React.ReactNode",
|
|
29
|
+
"description": "Content rendered inside the label."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "className",
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "Additional classes added to the label.",
|
|
35
|
+
"defaultValue": "''"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "closeBtn",
|
|
39
|
+
"type": "React.ReactNode",
|
|
40
|
+
"description": "Node for custom close button."
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "closeBtnAriaLabel",
|
|
44
|
+
"type": "string",
|
|
45
|
+
"description": "Aria label for close button"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "closeBtnProps",
|
|
49
|
+
"type": "any",
|
|
50
|
+
"description": "Additional properties for the default close button."
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "color",
|
|
54
|
+
"type": "'blue' | 'teal' | 'green' | 'orange' | 'purple' | 'red' | 'orangered' | 'grey' | 'yellow' | LabelColor",
|
|
55
|
+
"description": "Color of the label.",
|
|
56
|
+
"defaultValue": "LabelColor.grey"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "editableProps",
|
|
60
|
+
"type": "any",
|
|
61
|
+
"description": "Additional props passed to the editable label text div. Optionally passing onInput and onBlur callbacks will allow finer custom text input control."
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "href",
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "Href for a label that is a link. If present, the label will change to an anchor element. This should not be passed in if the onClick prop is also passed in."
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "icon",
|
|
70
|
+
"type": "React.ReactNode",
|
|
71
|
+
"description": "Icon added to the left of the label text. Overrides the icon set by the status property."
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "isClickable",
|
|
75
|
+
"type": "boolean",
|
|
76
|
+
"description": "Flag indicating the label is clickable. This flag will automatically be set if a href is passed, or if an onClick handler is passed and the label is not an overflow or add variant. This should be manually set when using the render prop.",
|
|
77
|
+
"defaultValue": "false"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"name": "isCompact",
|
|
81
|
+
"type": "boolean",
|
|
82
|
+
"description": "Flag indicating the label is compact.",
|
|
83
|
+
"defaultValue": "false"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "isDisabled",
|
|
87
|
+
"type": "boolean",
|
|
88
|
+
"description": "Flag indicating the label is disabled. Works only on clickable labels, so either href or onClick props must be passed in.",
|
|
89
|
+
"defaultValue": "false"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "isEditable",
|
|
93
|
+
"type": "boolean",
|
|
94
|
+
"description": "Flag indicating the label is editable.",
|
|
95
|
+
"defaultValue": "false"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "onClick",
|
|
99
|
+
"type": "(event: React.MouseEvent) => void",
|
|
100
|
+
"description": "Callback for when the label is clicked. This should not be passed in if the href or isEditable props are also passed in."
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "onClose",
|
|
104
|
+
"type": "(event: React.MouseEvent) => void",
|
|
105
|
+
"description": "Close click callback for removable labels. If present, label will have a close button."
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"name": "onEditCancel",
|
|
109
|
+
"type": "(event: KeyboardEvent, previousText: string) => void",
|
|
110
|
+
"description": "Callback when an editable label cancels an edit."
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"name": "onEditComplete",
|
|
114
|
+
"type": "(event: MouseEvent | KeyboardEvent, newText: string) => void",
|
|
115
|
+
"description": "Callback when an editable label completes an edit."
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"name": "render",
|
|
119
|
+
"type": "({\n className,\n content,\n componentRef\n}: {\n className: string;\n content: React.ReactNode;\n componentRef: any;\n}) => React.ReactNode",
|
|
120
|
+
"description": "Forwards the label content and className to rendered function. Use this prop for react router support."
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "status",
|
|
124
|
+
"type": "'success' | 'warning' | 'danger' | 'info' | 'custom'",
|
|
125
|
+
"description": "Status of the label with a respective icon and color. Overrides the color set by the color property."
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"name": "textMaxWidth",
|
|
129
|
+
"type": "string",
|
|
130
|
+
"description": "The max width of the label before it is truncated. Can be any valid CSS unit, such as '100%', '100px', or '16ch'."
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "tooltipPosition",
|
|
134
|
+
"type": "| TooltipPosition\n| 'auto'\n| 'top'\n| 'bottom'\n| 'left'\n| 'right'\n| 'top-start'\n| 'top-end'\n| 'bottom-start'\n| 'bottom-end'\n| 'left-start'\n| 'left-end'\n| 'right-start'\n| 'right-end'",
|
|
135
|
+
"description": "Position of the tooltip which is displayed if text is truncated"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"name": "variant",
|
|
139
|
+
"type": "'outline' | 'filled' | 'overflow' | 'add'",
|
|
140
|
+
"description": "Variant of the label.",
|
|
141
|
+
"defaultValue": "'filled'"
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"name": "LabelGroup",
|
|
147
|
+
"description": "",
|
|
148
|
+
"props": [
|
|
149
|
+
{
|
|
150
|
+
"name": "addLabelControl",
|
|
151
|
+
"type": "React.ReactNode",
|
|
152
|
+
"description": "Control for adding new labels"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "aria-label",
|
|
156
|
+
"type": "string",
|
|
157
|
+
"description": "Aria label for label group that does not have a category name",
|
|
158
|
+
"defaultValue": "'Label group category'"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"name": "categoryName",
|
|
162
|
+
"type": "string",
|
|
163
|
+
"description": "Category name text for the label group category. If this prop is supplied the label group with have a label and category styling applied",
|
|
164
|
+
"defaultValue": "''"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "children",
|
|
168
|
+
"type": "React.ReactNode",
|
|
169
|
+
"description": "Content rendered inside the label group. Should be <Label> elements."
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"name": "className",
|
|
173
|
+
"type": "string",
|
|
174
|
+
"description": "Additional classes added to the label item"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"name": "closeBtnAriaLabel",
|
|
178
|
+
"type": "string",
|
|
179
|
+
"description": "Aria label for close button",
|
|
180
|
+
"defaultValue": "'Close label group'"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"name": "collapsedText",
|
|
184
|
+
"type": "string",
|
|
185
|
+
"description": "Customizable template string. Use variable \"${remaining}\" for the overflow label count.",
|
|
186
|
+
"defaultValue": "'${remaining} more'"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"name": "defaultIsOpen",
|
|
190
|
+
"type": "boolean",
|
|
191
|
+
"description": "Flag for having the label group default to expanded",
|
|
192
|
+
"defaultValue": "false"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "editableTextAreaProps",
|
|
196
|
+
"type": "any",
|
|
197
|
+
"description": "Additional props passed to the editable textarea."
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"name": "expandedText",
|
|
201
|
+
"type": "string",
|
|
202
|
+
"description": "Customizable \"Show Less\" text string",
|
|
203
|
+
"defaultValue": "'Show Less'"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"name": "hasEditableTextArea",
|
|
207
|
+
"type": "boolean",
|
|
208
|
+
"description": "Flag indicating the editable label group should be appended with a textarea.",
|
|
209
|
+
"defaultValue": "false"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"name": "isClosable",
|
|
213
|
+
"type": "boolean",
|
|
214
|
+
"description": "Flag if label group can be closed",
|
|
215
|
+
"defaultValue": "false"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"name": "isCompact",
|
|
219
|
+
"type": "boolean",
|
|
220
|
+
"description": "Flag indicating the labels in the group are compact",
|
|
221
|
+
"defaultValue": "false"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"name": "isEditable",
|
|
225
|
+
"type": "boolean",
|
|
226
|
+
"description": "Flag indicating contained labels are editable. Allows spacing for a text input after the labels.",
|
|
227
|
+
"defaultValue": "false"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"name": "isVertical",
|
|
231
|
+
"type": "boolean",
|
|
232
|
+
"description": "Flag to implement a vertical layout",
|
|
233
|
+
"defaultValue": "false"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"name": "numLabels",
|
|
237
|
+
"type": "number",
|
|
238
|
+
"description": "Set number of labels to show before overflow",
|
|
239
|
+
"defaultValue": "3"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"name": "onClick",
|
|
243
|
+
"type": "(event: React.MouseEvent) => void",
|
|
244
|
+
"description": "Function that is called when clicking on the label group close button",
|
|
245
|
+
"defaultValue": "(_e: React.MouseEvent) => undefined as any"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"name": "tooltipPosition",
|
|
249
|
+
"type": "| TooltipPosition\n| 'auto'\n| 'top'\n| 'bottom'\n| 'left'\n| 'right'\n| 'top-start'\n| 'top-end'\n| 'bottom-start'\n| 'bottom-end'\n| 'left-start'\n| 'left-end'\n| 'right-start'\n| 'right-end'",
|
|
250
|
+
"description": "Position of the tooltip which is displayed if the category name text is longer",
|
|
251
|
+
"defaultValue": "'top'"
|
|
252
|
+
}
|
|
253
|
+
]
|
|
254
|
+
}
|
|
255
|
+
],
|
|
256
|
+
"cssPrefix": [
|
|
257
|
+
"pf-v6-c-label",
|
|
258
|
+
"pf-v6-c-label-group"
|
|
259
|
+
],
|
|
260
|
+
"examples": [
|
|
261
|
+
"Filled labels",
|
|
262
|
+
"Outlined labels",
|
|
263
|
+
"Compact labels",
|
|
264
|
+
"Label with custom render",
|
|
265
|
+
"Editable labels",
|
|
266
|
+
"Basic label group",
|
|
267
|
+
"Label group with overflow",
|
|
268
|
+
"Label group with categories",
|
|
269
|
+
"Label group with removable categories",
|
|
270
|
+
"Vertical label group",
|
|
271
|
+
"Editable label group",
|
|
272
|
+
"Editable label group with add button"
|
|
273
|
+
]
|
|
274
|
+
};
|
|
275
|
+
pageData.liveContext = {
|
|
276
|
+
Fragment,
|
|
277
|
+
useEffect,
|
|
278
|
+
useRef,
|
|
279
|
+
useState,
|
|
280
|
+
CubeIcon,
|
|
281
|
+
RhUiInformationFillIcon
|
|
282
|
+
};
|
|
283
|
+
pageData.relativeImports = "import 'react-core/src/components/Label/examples/./Label.css';"
|
|
284
|
+
pageData.examples = {
|
|
285
|
+
'Filled labels': props =>
|
|
286
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { Label, LabelColor, LabelStatus } from '@patternfly/react-core';\nimport CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';\n\nexport const LabelFilled: React.FunctionComponent = () => {\n const logColor = (color: string) => {\n // eslint-disable-next-line no-console\n console.log(color, 'label clicked');\n };\n return (\n <Fragment>\n <strong>Non-status:</strong>\n <br />\n <br />\n <Label>Grey</Label>\n <Label icon={<CubeIcon />}>Grey icon</Label>\n <Label onClose={() => Function.prototype}>Grey removable</Label>\n <Label icon={<CubeIcon />} onClose={() => Function.prototype}>\n Grey icon removable\n </Label>\n <Label href=\"#filled\">Grey link</Label>\n <Label href=\"#filled\" onClose={() => Function.prototype}>\n Grey link removable\n </Label>{' '}\n <Label onClick={() => logColor('grey')}>Grey clickable</Label>{' '}\n <Label onClick={() => logColor('grey')} onClose={() => Function.prototype}>\n Grey clickable removable\n </Label>{' '}\n <Label icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Grey label with icon that overflows\n </Label>{' '}\n <Label isDisabled icon={<CubeIcon />} href=\"#filled\" onClose={() => Function.prototype}>\n Grey link removable (disabled)\n </Label>{' '}\n <Label isDisabled icon={<CubeIcon />} onClick={() => logColor('grey')} onClose={() => Function.prototype}>\n Grey clickable removable (disabled)\n </Label>\n <br />\n <br />\n <Label color={LabelColor.blue}>Blue</Label>\n <Label color={LabelColor.blue} icon={<CubeIcon />}>\n Blue icon\n </Label>\n <Label color={LabelColor.blue} onClose={() => Function.prototype}>\n Blue removable\n </Label>\n <Label color={LabelColor.blue} icon={<CubeIcon />} onClose={() => Function.prototype}>\n Blue icon removable\n </Label>\n <Label color={LabelColor.blue} href=\"#filled\">\n Blue link\n </Label>\n <Label color={LabelColor.blue} href=\"#filled\" onClose={() => Function.prototype}>\n Blue link removable\n </Label>{' '}\n <Label color={LabelColor.blue} onClick={() => logColor('blue')}>\n Blue clickable\n </Label>\n <Label color={LabelColor.blue} onClick={() => logColor('blue')} onClose={() => Function.prototype}>\n Blue clickable removable\n </Label>{' '}\n <Label color={LabelColor.blue} icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Blue label with icon that overflows\n </Label>{' '}\n <Label color={LabelColor.blue} isDisabled icon={<CubeIcon />} href=\"#filled\" onClose={() => Function.prototype}>\n Blue link removable (disabled)\n </Label>{' '}\n <Label\n color={LabelColor.blue}\n isDisabled\n icon={<CubeIcon />}\n onClick={() => logColor('blue')}\n onClose={() => Function.prototype}\n >\n Blue clickable removable (disabled)\n </Label>\n <br />\n <br />\n <Label color={LabelColor.green}>Green</Label>\n <Label color={LabelColor.green} icon={<CubeIcon />}>\n Green icon\n </Label>\n <Label color={LabelColor.green} onClose={() => Function.prototype}>\n Green removable\n </Label>\n <Label color={LabelColor.green} icon={<CubeIcon />} onClose={() => Function.prototype}>\n Green icon removable\n </Label>\n <Label color={LabelColor.green} href=\"#filled\">\n Green link\n </Label>\n <Label color={LabelColor.green} href=\"#filled\" onClose={() => Function.prototype}>\n Green link removable\n </Label>{' '}\n <Label color={LabelColor.green} onClick={() => logColor('green')}>\n Green clickable\n </Label>\n <Label color={LabelColor.green} onClick={() => logColor('green')} onClose={() => Function.prototype}>\n Green clickable removable\n </Label>{' '}\n <Label color={LabelColor.green} icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Green label with icon that overflows\n </Label>{' '}\n <Label color={LabelColor.green} isDisabled icon={<CubeIcon />} href=\"#filled\" onClose={() => Function.prototype}>\n Green link removable (disabled)\n </Label>{' '}\n <Label\n color={LabelColor.green}\n isDisabled\n icon={<CubeIcon />}\n onClick={() => logColor('green')}\n onClose={() => Function.prototype}\n >\n Green clickable removable (disabled)\n </Label>\n <br />\n <br />\n <Label color={LabelColor.orange}>Orange</Label>\n <Label color={LabelColor.orange} icon={<CubeIcon />}>\n Orange icon\n </Label>\n <Label color={LabelColor.orange} onClose={() => Function.prototype}>\n Orange removable\n </Label>\n <Label color={LabelColor.orange} icon={<CubeIcon />} onClose={() => Function.prototype}>\n Orange icon removable\n </Label>\n <Label color={LabelColor.orange} href=\"#filled\">\n Orange link\n </Label>\n <Label color={LabelColor.orange} href=\"#filled\" onClose={() => Function.prototype}>\n Orange link removable\n </Label>{' '}\n <Label color={LabelColor.orange} onClick={() => logColor('orange')}>\n Orange clickable\n </Label>\n <Label color={LabelColor.orange} onClick={() => logColor('orange')} onClose={() => Function.prototype}>\n Orange clickable removable\n </Label>{' '}\n <Label color={LabelColor.orange} icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Orange label with icon that overflows\n </Label>{' '}\n <Label color={LabelColor.orange} isDisabled icon={<CubeIcon />} href=\"#filled\" onClose={() => Function.prototype}>\n Orange link removable (disabled)\n </Label>{' '}\n <Label\n color={LabelColor.orange}\n isDisabled\n icon={<CubeIcon />}\n onClick={() => logColor('orange')}\n onClose={() => Function.prototype}\n >\n Orange clickable removable (disabled)\n </Label>\n <br />\n <br />\n <Label color={LabelColor.red}>Red</Label>\n <Label color={LabelColor.red} icon={<CubeIcon />}>\n Red icon\n </Label>\n <Label color={LabelColor.red} onClose={() => Function.prototype}>\n Red removable\n </Label>\n <Label color={LabelColor.red} icon={<CubeIcon />} onClose={() => Function.prototype}>\n Red icon removable\n </Label>\n <Label color={LabelColor.red} href=\"#filled\">\n Red link\n </Label>\n <Label color={LabelColor.red} href=\"#filled\" onClose={() => Function.prototype}>\n Red link removable\n </Label>{' '}\n <Label color={LabelColor.red} onClick={() => logColor('red')}>\n Red clickable\n </Label>\n <Label color={LabelColor.red} onClick={() => logColor('red')} onClose={() => Function.prototype}>\n Red clickable removable\n </Label>{' '}\n <Label color={LabelColor.red} icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Red label with icon that overflows\n </Label>{' '}\n <Label color={LabelColor.red} isDisabled icon={<CubeIcon />} href=\"#filled\" onClose={() => Function.prototype}>\n Red link removable (disabled)\n </Label>{' '}\n <Label\n color={LabelColor.red}\n isDisabled\n icon={<CubeIcon />}\n onClick={() => logColor('red')}\n onClose={() => Function.prototype}\n >\n Red clickable removable (disabled)\n </Label>\n <br />\n <br />\n <Label color={LabelColor.orangered}>Orange red</Label>\n <Label color={LabelColor.orangered} icon={<CubeIcon />}>\n Orange red icon\n </Label>\n <Label color={LabelColor.orangered} onClose={() => Function.prototype}>\n Orange red removable\n </Label>\n <Label color={LabelColor.orangered} icon={<CubeIcon />} onClose={() => Function.prototype}>\n Orange red icon removable\n </Label>\n <Label color={LabelColor.orangered} href=\"#filled\">\n Orange red link\n </Label>\n <Label color={LabelColor.orangered} href=\"#filled\" onClose={() => Function.prototype}>\n Orange red link removable\n </Label>\n <Label color={LabelColor.orangered} onClick={() => logColor('orangered')}>\n Orange red clickable\n </Label>\n <Label color={LabelColor.orangered} onClick={() => logColor('orangered')} onClose={() => Function.prototype}>\n Orange red clickable removable\n </Label>\n <Label color={LabelColor.orangered} icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Orange red label with icon that overflows\n </Label>\n <br />\n <br />\n <Label color={LabelColor.purple}>Purple</Label>\n <Label color={LabelColor.purple} icon={<CubeIcon />}>\n Purple icon\n </Label>\n <Label color={LabelColor.purple} onClose={() => Function.prototype}>\n Purple removable\n </Label>\n <Label color={LabelColor.purple} icon={<CubeIcon />} onClose={() => Function.prototype}>\n Purple icon removable\n </Label>\n <Label color={LabelColor.purple} href=\"#filled\">\n Purple link\n </Label>\n <Label color={LabelColor.purple} href=\"#filled\" onClose={() => Function.prototype}>\n Purple link removable\n </Label>{' '}\n <Label color={LabelColor.purple} onClick={() => logColor('purple')}>\n Purple clickable\n </Label>\n <Label color={LabelColor.purple} onClick={() => logColor('purple')} onClose={() => Function.prototype}>\n Purple clickable removable\n </Label>{' '}\n <Label color={LabelColor.purple} icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Purple label with icon that overflows\n </Label>{' '}\n <Label color={LabelColor.purple} isDisabled icon={<CubeIcon />} href=\"#filled\" onClose={() => Function.prototype}>\n Purple link removable (disabled)\n </Label>{' '}\n <Label\n color={LabelColor.purple}\n isDisabled\n icon={<CubeIcon />}\n onClick={() => logColor('purple')}\n onClose={() => Function.prototype}\n >\n Purple clickable removable (disabled)\n </Label>\n <br />\n <br />\n <Label color={LabelColor.teal}>Teal</Label>\n <Label color={LabelColor.teal} icon={<CubeIcon />}>\n Teal icon\n </Label>\n <Label color={LabelColor.teal} onClose={() => Function.prototype}>\n Teal removable\n </Label>\n <Label color={LabelColor.teal} icon={<CubeIcon />} onClose={() => Function.prototype}>\n Teal icon removable\n </Label>\n <Label color={LabelColor.teal} href=\"#filled\">\n Teal link\n </Label>\n <Label color={LabelColor.teal} href=\"#filled\" onClose={() => Function.prototype}>\n Teal link removable\n </Label>{' '}\n <Label color={LabelColor.teal} onClick={() => logColor('teal')}>\n Teal clickable\n </Label>\n <Label color={LabelColor.teal} onClick={() => logColor('teal')} onClose={() => Function.prototype}>\n Teal clickable removable\n </Label>{' '}\n <Label color={LabelColor.teal} icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Teal label with icon that overflows\n </Label>{' '}\n <Label color={LabelColor.teal} isDisabled icon={<CubeIcon />} href=\"#filled\" onClose={() => Function.prototype}>\n Teal link removable (disabled)\n </Label>{' '}\n <Label\n color={LabelColor.teal}\n isDisabled\n icon={<CubeIcon />}\n onClick={() => logColor('teal')}\n onClose={() => Function.prototype}\n >\n Teal clickable removable (disabled)\n </Label>\n <br />\n <br />\n <Label color={LabelColor.yellow}>Yellow</Label>\n <Label color={LabelColor.yellow} icon={<CubeIcon />}>\n Yellow icon\n </Label>\n <Label color={LabelColor.yellow} onClose={() => Function.prototype}>\n Yellow removable\n </Label>\n <Label color={LabelColor.yellow} icon={<CubeIcon />} onClose={() => Function.prototype}>\n Yellow icon removable\n </Label>\n <Label color={LabelColor.yellow} href=\"#filled\">\n Yellow link\n </Label>\n <Label color={LabelColor.yellow} href=\"#filled\" onClose={() => Function.prototype}>\n Yellow link removable\n </Label>{' '}\n <Label color={LabelColor.yellow} onClick={() => logColor('yellow')}>\n Yellow clickable\n </Label>\n <Label color={LabelColor.yellow} onClick={() => logColor('yellow')} onClose={() => Function.prototype}>\n Yellow clickable removable\n </Label>{' '}\n <Label color={LabelColor.yellow} icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Yellow label with icon that overflows\n </Label>{' '}\n <Label color={LabelColor.yellow} isDisabled icon={<CubeIcon />} href=\"#filled\" onClose={() => Function.prototype}>\n Yellow link removable (disabled)\n </Label>{' '}\n <Label\n color={LabelColor.yellow}\n isDisabled\n icon={<CubeIcon />}\n onClick={() => logColor('yellow')}\n onClose={() => Function.prototype}\n >\n Yellow clickable removable (disabled)\n </Label>\n <br />\n <br />\n <div style={{ width: '250px' }}>\n <Label>Label that overflows its parent, but has no textMaxWidth on its own</Label>\n </div>\n <br />\n <strong>Status:</strong>\n <br />\n <br />\n <Label status={LabelStatus.success}>Success</Label>\n <Label status={LabelStatus.success} onClose={() => Function.prototype}>\n Success removable\n </Label>\n <Label status={LabelStatus.success} href=\"#filled\">\n Success link\n </Label>\n <Label status={LabelStatus.success} href=\"#filled\" onClose={() => Function.prototype}>\n Success link removable\n </Label>\n <Label status={LabelStatus.success} onClick={() => logColor('success')}>\n Success clickable\n </Label>\n <Label status={LabelStatus.success} onClick={() => logColor('success')} onClose={() => Function.prototype}>\n Success clickable removable\n </Label>\n <Label status={LabelStatus.success} onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Success label with text that overflows\n </Label>\n <br />\n <br />\n <Label status={LabelStatus.warning}>Warning</Label>\n <Label status={LabelStatus.warning} onClose={() => Function.prototype}>\n Warning removable\n </Label>\n <Label status={LabelStatus.warning} href=\"#filled\">\n Warning link\n </Label>\n <Label status={LabelStatus.warning} href=\"#filled\" onClose={() => Function.prototype}>\n Warning link removable\n </Label>\n <Label status={LabelStatus.warning} onClick={() => logColor('warning')}>\n Warning clickable\n </Label>\n <Label status={LabelStatus.warning} onClick={() => logColor('warning')} onClose={() => Function.prototype}>\n Warning clickable removable\n </Label>\n <Label status={LabelStatus.warning} onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Warning label with text that overflows\n </Label>\n <br />\n <br />\n <Label status={LabelStatus.danger}>Danger</Label>\n <Label status={LabelStatus.danger} onClose={() => Function.prototype}>\n Danger removable\n </Label>\n <Label status={LabelStatus.danger} href=\"#filled\">\n Danger link\n </Label>\n <Label status={LabelStatus.danger} href=\"#filled\" onClose={() => Function.prototype}>\n Danger link removable\n </Label>\n <Label status={LabelStatus.danger} onClick={() => logColor('danger')}>\n Danger clickable\n </Label>\n <Label status={LabelStatus.danger} onClick={() => logColor('danger')} onClose={() => Function.prototype}>\n Danger clickable removable\n </Label>\n <Label status={LabelStatus.danger} onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Danger label with text that overflows\n </Label>\n <br />\n <br />\n <Label status={LabelStatus.info}>Info</Label>\n <Label status={LabelStatus.info} onClose={() => Function.prototype}>\n Info removable\n </Label>\n <Label status={LabelStatus.info} href=\"#filled\">\n Info link\n </Label>\n <Label status={LabelStatus.info} href=\"#filled\" onClose={() => Function.prototype}>\n Info link removable\n </Label>\n <Label status={LabelStatus.info} onClick={() => logColor('info')}>\n Info clickable\n </Label>\n <Label status={LabelStatus.info} onClick={() => logColor('info')} onClose={() => Function.prototype}>\n Info clickable removable\n </Label>\n <Label status={LabelStatus.info} onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Info label with text that overflows\n </Label>\n <br />\n <br />\n <Label status={LabelStatus.custom}>Custom</Label>\n <Label status={LabelStatus.custom} onClose={() => Function.prototype}>\n Custom removable\n </Label>\n <Label status={LabelStatus.custom} href=\"#filled\">\n Custom link\n </Label>\n <Label status={LabelStatus.custom} href=\"#filled\" onClose={() => Function.prototype}>\n Custom link removable\n </Label>\n <Label status={LabelStatus.custom} onClick={() => logColor('custom')}>\n Custom clickable\n </Label>\n <Label status={LabelStatus.custom} onClick={() => logColor('custom')} onClose={() => Function.prototype}>\n Custom clickable removable\n </Label>\n <Label status={LabelStatus.custom} onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Custom label with text that overflows\n </Label>\n </Fragment>\n );\n};\n","title":"Filled labels","lang":"ts","className":""}}>
|
|
287
|
+
|
|
288
|
+
</Example>,
|
|
289
|
+
'Outlined labels': props =>
|
|
290
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { Label, LabelColor, LabelStatus } from '@patternfly/react-core';\nimport CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';\n\nexport const LabelOutline: React.FunctionComponent = () => {\n const logColor = (color: string) => {\n // eslint-disable-next-line no-console\n console.log(color, 'label clicked');\n };\n return (\n <Fragment>\n <strong>Non-status:</strong>\n <br />\n <br />\n <Label variant=\"outline\">Grey</Label>\n <Label variant=\"outline\" icon={<CubeIcon />}>\n Grey icon\n </Label>\n <Label variant=\"outline\" onClose={() => Function.prototype}>\n Grey removable\n </Label>\n <Label variant=\"outline\" icon={<CubeIcon />} onClose={() => Function.prototype}>\n Grey icon removable\n </Label>\n <Label variant=\"outline\" href=\"#outline\">\n Grey link\n </Label>\n <Label variant=\"outline\" href=\"#outline\" onClose={() => Function.prototype}>\n Grey link removable\n </Label>{' '}\n <Label variant=\"outline\" onClick={() => logColor('grey')}>\n Grey clickable\n </Label>\n <Label variant=\"outline\" onClick={() => logColor('grey')} onClose={() => Function.prototype}>\n Grey clickable removable\n </Label>\n <Label variant=\"outline\" icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Grey label with icon that overflows\n </Label>{' '}\n <Label variant=\"outline\" isDisabled icon={<CubeIcon />} href=\"#filled\" onClose={() => Function.prototype}>\n Grey link removable (disabled)\n </Label>{' '}\n <Label\n variant=\"outline\"\n isDisabled\n icon={<CubeIcon />}\n onClick={() => logColor('grey')}\n onClose={() => Function.prototype}\n >\n Grey clickable removable (disabled)\n </Label>\n <br />\n <br />\n <Label variant=\"outline\" color={LabelColor.blue}>\n Blue\n </Label>\n <Label variant=\"outline\" color={LabelColor.blue} icon={<CubeIcon />}>\n Blue icon\n </Label>\n <Label variant=\"outline\" color={LabelColor.blue} onClose={() => Function.prototype}>\n Blue removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.blue} icon={<CubeIcon />} onClose={() => Function.prototype}>\n Blue icon removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.blue} href=\"#outline\">\n Blue link\n </Label>\n <Label variant=\"outline\" color={LabelColor.blue} href=\"#outline\" onClose={() => Function.prototype}>\n Blue link removable\n </Label>{' '}\n <Label variant=\"outline\" color={LabelColor.blue} onClick={() => logColor('blue')}>\n Blue clickable\n </Label>\n <Label\n variant=\"outline\"\n color={LabelColor.blue}\n onClick={() => logColor('blue')}\n onClose={() => Function.prototype}\n >\n Blue clickable removable\n </Label>\n <Label\n variant=\"outline\"\n color={LabelColor.blue}\n icon={<CubeIcon />}\n onClose={() => Function.prototype}\n textMaxWidth=\"16ch\"\n >\n Blue label with icon that overflows\n </Label>{' '}\n <Label\n variant=\"outline\"\n color={LabelColor.blue}\n isDisabled\n icon={<CubeIcon />}\n href=\"#filled\"\n onClose={() => Function.prototype}\n >\n Blue link removable (disabled)\n </Label>{' '}\n <Label\n variant=\"outline\"\n color={LabelColor.blue}\n isDisabled\n icon={<CubeIcon />}\n onClick={() => logColor('blue')}\n onClose={() => Function.prototype}\n >\n Blue clickable removable (disabled)\n </Label>\n <br />\n <br />\n <Label variant=\"outline\" color={LabelColor.green}>\n Green\n </Label>\n <Label variant=\"outline\" color={LabelColor.green} icon={<CubeIcon />}>\n Green icon\n </Label>\n <Label variant=\"outline\" color={LabelColor.green} onClose={() => Function.prototype}>\n Green removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.green} icon={<CubeIcon />} onClose={() => Function.prototype}>\n Green icon removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.green} href=\"#outline\">\n Green link\n </Label>\n <Label variant=\"outline\" color={LabelColor.green} href=\"#outline\" onClose={() => Function.prototype}>\n Green link removable\n </Label>{' '}\n <Label variant=\"outline\" color={LabelColor.green} onClick={() => logColor('green')}>\n Green clickable\n </Label>\n <Label\n variant=\"outline\"\n color={LabelColor.green}\n onClick={() => logColor('green')}\n onClose={() => Function.prototype}\n >\n Green clickable removable\n </Label>\n <Label\n variant=\"outline\"\n color={LabelColor.green}\n icon={<CubeIcon />}\n onClose={() => Function.prototype}\n textMaxWidth=\"16ch\"\n >\n Green label with icon that overflows\n </Label>{' '}\n <Label\n variant=\"outline\"\n color={LabelColor.green}\n isDisabled\n icon={<CubeIcon />}\n href=\"#filled\"\n onClose={() => Function.prototype}\n >\n Green link removable (disabled)\n </Label>{' '}\n <Label\n variant=\"outline\"\n color={LabelColor.green}\n isDisabled\n icon={<CubeIcon />}\n onClick={() => logColor('green')}\n onClose={() => Function.prototype}\n >\n Green clickable removable (disabled)\n </Label>\n <br />\n <br />\n <Label variant=\"outline\" color={LabelColor.orange}>\n Orange\n </Label>\n <Label variant=\"outline\" color={LabelColor.orange} icon={<CubeIcon />}>\n Orange icon\n </Label>\n <Label variant=\"outline\" color={LabelColor.orange} onClose={() => Function.prototype}>\n Orange removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.orange} icon={<CubeIcon />} onClose={() => Function.prototype}>\n Orange icon removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.orange} href=\"#outline\">\n Orange link\n </Label>\n <Label variant=\"outline\" color={LabelColor.orange} href=\"#outline\" onClose={() => Function.prototype}>\n Orange link removable\n </Label>{' '}\n <Label variant=\"outline\" color={LabelColor.orange} onClick={() => logColor('orange')}>\n Orange clickable\n </Label>\n <Label\n variant=\"outline\"\n color={LabelColor.orange}\n onClick={() => logColor('orange')}\n onClose={() => Function.prototype}\n >\n Orange clickable removable\n </Label>{' '}\n <Label\n variant=\"outline\"\n color={LabelColor.orange}\n icon={<CubeIcon />}\n onClose={() => Function.prototype}\n textMaxWidth=\"16ch\"\n >\n Orange label with icon that overflows\n </Label>{' '}\n <Label\n variant=\"outline\"\n color={LabelColor.orange}\n isDisabled\n icon={<CubeIcon />}\n href=\"#filled\"\n onClose={() => Function.prototype}\n >\n Orange link removable (disabled)\n </Label>{' '}\n <Label\n variant=\"outline\"\n color={LabelColor.orange}\n isDisabled\n icon={<CubeIcon />}\n onClick={() => logColor('orange')}\n onClose={() => Function.prototype}\n >\n Orange clickable removable (disabled)\n </Label>\n <br />\n <br />\n <Label variant=\"outline\" color={LabelColor.red}>\n Red\n </Label>\n <Label variant=\"outline\" color={LabelColor.red} icon={<CubeIcon />}>\n Red icon\n </Label>\n <Label variant=\"outline\" color={LabelColor.red} onClose={() => Function.prototype}>\n Red removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.red} icon={<CubeIcon />} onClose={() => Function.prototype}>\n Red icon removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.red} href=\"#outline\">\n Red link\n </Label>\n <Label variant=\"outline\" color={LabelColor.red} href=\"#outline\" onClose={() => Function.prototype}>\n Red link removable\n </Label>{' '}\n <Label variant=\"outline\" color={LabelColor.red} onClick={() => logColor('red')}>\n Red clickable\n </Label>\n <Label\n variant=\"outline\"\n color={LabelColor.red}\n onClick={() => logColor('red')}\n onClose={() => Function.prototype}\n >\n Red clickable removable\n </Label>\n <Label\n variant=\"outline\"\n color={LabelColor.red}\n icon={<CubeIcon />}\n onClose={() => Function.prototype}\n textMaxWidth=\"16ch\"\n >\n Red label with icon that overflows\n </Label>\n <br />\n <br />\n <Label variant=\"outline\" color={LabelColor.orangered}>\n Orange red\n </Label>\n <Label variant=\"outline\" color={LabelColor.orangered} icon={<CubeIcon />}>\n Orange red icon\n </Label>\n <Label variant=\"outline\" color={LabelColor.orangered} onClose={() => Function.prototype}>\n Orange red removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.orangered} icon={<CubeIcon />} onClose={() => Function.prototype}>\n Orange red icon removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.orangered} href=\"#outline\">\n Orange red link\n </Label>\n <Label variant=\"outline\" color={LabelColor.orangered} href=\"#outline\" onClose={() => Function.prototype}>\n Orange red link removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.orangered} onClick={() => logColor('orangered')}>\n Orange red clickable\n </Label>\n <Label\n variant=\"outline\"\n color={LabelColor.orangered}\n onClick={() => logColor('orangered')}\n onClose={() => Function.prototype}\n >\n Orange red clickable removable\n </Label>\n <Label\n variant=\"outline\"\n color={LabelColor.orangered}\n icon={<CubeIcon />}\n onClose={() => Function.prototype}\n textMaxWidth=\"16ch\"\n >\n Orange red label with icon that overflows\n </Label>\n <br />\n <br />\n <Label variant=\"outline\" color={LabelColor.purple}>\n Purple\n </Label>\n <Label variant=\"outline\" color={LabelColor.purple} icon={<CubeIcon />}>\n Purple icon\n </Label>\n <Label variant=\"outline\" color={LabelColor.purple} onClose={() => Function.prototype}>\n Purple removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.purple} icon={<CubeIcon />} onClose={() => Function.prototype}>\n Purple icon removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.purple} href=\"#outline\">\n Purple link\n </Label>\n <Label variant=\"outline\" color={LabelColor.purple} href=\"#outline\" onClose={() => Function.prototype}>\n Purple link removable\n </Label>{' '}\n <Label variant=\"outline\" color={LabelColor.purple} onClick={() => logColor('purple')}>\n Purple clickable\n </Label>\n <Label\n variant=\"outline\"\n color={LabelColor.purple}\n onClick={() => logColor('purple')}\n onClose={() => Function.prototype}\n >\n Purple clickable removable\n </Label>{' '}\n <Label\n variant=\"outline\"\n color={LabelColor.purple}\n icon={<CubeIcon />}\n onClose={() => Function.prototype}\n textMaxWidth=\"16ch\"\n >\n Purple label with icon that overflows\n </Label>{' '}\n <Label\n variant=\"outline\"\n color={LabelColor.purple}\n isDisabled\n icon={<CubeIcon />}\n href=\"#filled\"\n onClose={() => Function.prototype}\n >\n Purple link removable (disabled)\n </Label>{' '}\n <Label\n variant=\"outline\"\n color={LabelColor.purple}\n isDisabled\n icon={<CubeIcon />}\n onClick={() => logColor('purple')}\n onClose={() => Function.prototype}\n >\n Purple clickable removable (disabled)\n </Label>\n <br />\n <br />\n <Label variant=\"outline\" color={LabelColor.teal}>\n Teal\n </Label>\n <Label variant=\"outline\" color={LabelColor.teal} icon={<CubeIcon />}>\n Teal icon\n </Label>\n <Label variant=\"outline\" color={LabelColor.teal} onClose={() => Function.prototype}>\n Teal removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.teal} icon={<CubeIcon />} onClose={() => Function.prototype}>\n Teal icon removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.teal} href=\"#outline\">\n Teal link\n </Label>\n <Label variant=\"outline\" color={LabelColor.teal} href=\"#outline\" onClose={() => Function.prototype}>\n Teal link removable\n </Label>{' '}\n <Label variant=\"outline\" color={LabelColor.teal} onClick={() => logColor('teal')}>\n Teal clickable\n </Label>\n <Label\n variant=\"outline\"\n color={LabelColor.teal}\n onClick={() => logColor('teal')}\n onClose={() => Function.prototype}\n >\n Teal clickable removable\n </Label>\n <Label\n variant=\"outline\"\n color={LabelColor.teal}\n icon={<CubeIcon />}\n onClose={() => Function.prototype}\n textMaxWidth=\"16ch\"\n >\n Teal label with icon that overflows\n </Label>{' '}\n <Label\n variant=\"outline\"\n color={LabelColor.teal}\n isDisabled\n icon={<CubeIcon />}\n href=\"#filled\"\n onClose={() => Function.prototype}\n >\n Teal link removable (disabled)\n </Label>{' '}\n <Label\n variant=\"outline\"\n color={LabelColor.teal}\n isDisabled\n icon={<CubeIcon />}\n onClick={() => logColor('teal')}\n onClose={() => Function.prototype}\n >\n Teal clickable removable (disabled)\n </Label>\n <br />\n <br />\n <Label variant=\"outline\" color={LabelColor.yellow}>\n Yellow\n </Label>\n <Label variant=\"outline\" color={LabelColor.yellow} icon={<CubeIcon />}>\n Yellow icon\n </Label>\n <Label variant=\"outline\" color={LabelColor.yellow} onClose={() => Function.prototype}>\n Yellow removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.yellow} icon={<CubeIcon />} onClose={() => Function.prototype}>\n Yellow icon removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.yellow} href=\"#outline\">\n Yellow link\n </Label>\n <Label variant=\"outline\" color={LabelColor.yellow} href=\"#outline\" onClose={() => Function.prototype}>\n Yellow link removable\n </Label>{' '}\n <Label variant=\"outline\" color={LabelColor.yellow} onClick={() => logColor('yellow')}>\n Yellow clickable\n </Label>\n <Label\n variant=\"outline\"\n color={LabelColor.yellow}\n onClick={() => logColor('yellow')}\n onClose={() => Function.prototype}\n >\n Yellow clickable removable\n </Label>\n <Label\n variant=\"outline\"\n color={LabelColor.yellow}\n icon={<CubeIcon />}\n onClose={() => Function.prototype}\n textMaxWidth=\"16ch\"\n >\n Yellow label with icon that overflows\n </Label>{' '}\n <Label\n variant=\"outline\"\n color={LabelColor.yellow}\n isDisabled\n icon={<CubeIcon />}\n href=\"#filled\"\n onClose={() => Function.prototype}\n >\n Yellow link removable (disabled)\n </Label>{' '}\n <Label\n variant=\"outline\"\n color={LabelColor.yellow}\n isDisabled\n icon={<CubeIcon />}\n onClick={() => logColor('yellow')}\n onClose={() => Function.prototype}\n >\n Yellow clickable removable (disabled)\n </Label>\n <br />\n <br />\n <strong>Status:</strong>\n <br />\n <br />\n <Label status={LabelStatus.success} variant=\"outline\">\n Success\n </Label>\n <Label status={LabelStatus.success} variant=\"outline\" onClose={() => Function.prototype}>\n Success removable\n </Label>\n <Label status={LabelStatus.success} variant=\"outline\" href=\"#filled\">\n Success link\n </Label>\n <Label status={LabelStatus.success} variant=\"outline\" href=\"#filled\" onClose={() => Function.prototype}>\n Success link removable\n </Label>\n <Label status={LabelStatus.success} variant=\"outline\" onClick={() => logColor('success')}>\n Success clickable\n </Label>\n <Label\n status={LabelStatus.success}\n variant=\"outline\"\n onClick={() => logColor('success')}\n onClose={() => Function.prototype}\n >\n Success clickable removable\n </Label>\n <Label status={LabelStatus.success} variant=\"outline\" onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Success label with text that overflows\n </Label>\n <br />\n <br />\n <Label status={LabelStatus.warning} variant=\"outline\">\n Warning\n </Label>\n <Label status={LabelStatus.warning} variant=\"outline\" onClose={() => Function.prototype}>\n Warning removable\n </Label>\n <Label status={LabelStatus.warning} variant=\"outline\" href=\"#filled\">\n Warning link\n </Label>\n <Label status={LabelStatus.warning} variant=\"outline\" href=\"#filled\" onClose={() => Function.prototype}>\n Warning link removable\n </Label>\n <Label status={LabelStatus.warning} variant=\"outline\" onClick={() => logColor('warning')}>\n Warning clickable\n </Label>\n <Label\n status={LabelStatus.warning}\n variant=\"outline\"\n onClick={() => logColor('warning')}\n onClose={() => Function.prototype}\n >\n Warning clickable removable\n </Label>\n <Label status={LabelStatus.warning} variant=\"outline\" onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Warning label with text that overflows\n </Label>\n <br />\n <br />\n <Label status={LabelStatus.danger} variant=\"outline\">\n Danger\n </Label>\n <Label status={LabelStatus.danger} variant=\"outline\" onClose={() => Function.prototype}>\n Danger removable\n </Label>\n <Label status={LabelStatus.danger} variant=\"outline\" href=\"#filled\">\n Danger link\n </Label>\n <Label status={LabelStatus.danger} variant=\"outline\" href=\"#filled\" onClose={() => Function.prototype}>\n Danger link removable\n </Label>\n <Label status={LabelStatus.danger} variant=\"outline\" onClick={() => logColor('danger')}>\n Danger clickable\n </Label>\n <Label\n status={LabelStatus.danger}\n variant=\"outline\"\n onClick={() => logColor('danger')}\n onClose={() => Function.prototype}\n >\n Danger clickable removable\n </Label>\n <Label status={LabelStatus.danger} variant=\"outline\" onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Danger label with text that overflows\n </Label>\n <br />\n <br />\n <Label status={LabelStatus.info} variant=\"outline\">\n Info\n </Label>\n <Label status={LabelStatus.info} variant=\"outline\" onClose={() => Function.prototype}>\n Info removable\n </Label>\n <Label status={LabelStatus.info} variant=\"outline\" href=\"#filled\">\n Info link\n </Label>\n <Label status={LabelStatus.info} variant=\"outline\" href=\"#filled\" onClose={() => Function.prototype}>\n Info link removable\n </Label>\n <Label status={LabelStatus.info} variant=\"outline\" onClick={() => logColor('info')}>\n Info clickable\n </Label>\n <Label\n status={LabelStatus.info}\n variant=\"outline\"\n onClick={() => logColor('info')}\n onClose={() => Function.prototype}\n >\n Info clickable removable\n </Label>\n <Label status={LabelStatus.info} variant=\"outline\" onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Info label with text that overflows\n </Label>\n <br />\n <br />\n <Label status={LabelStatus.custom} variant=\"outline\">\n Custom\n </Label>\n <Label status={LabelStatus.custom} variant=\"outline\" onClose={() => Function.prototype}>\n Custom removable\n </Label>\n <Label status={LabelStatus.custom} variant=\"outline\" href=\"#filled\">\n Custom link\n </Label>\n <Label status={LabelStatus.custom} variant=\"outline\" href=\"#filled\" onClose={() => Function.prototype}>\n Custom link removable\n </Label>\n <Label status={LabelStatus.custom} variant=\"outline\" onClick={() => logColor('custom')}>\n Custom clickable\n </Label>\n <Label\n status={LabelStatus.custom}\n variant=\"outline\"\n onClick={() => logColor('custom')}\n onClose={() => Function.prototype}\n >\n Custom clickable removable\n </Label>\n <Label status={LabelStatus.custom} variant=\"outline\" onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Custom label with text that overflows\n </Label>\n </Fragment>\n );\n};\n","title":"Outlined labels","lang":"ts","className":""}}>
|
|
291
|
+
|
|
292
|
+
</Example>,
|
|
293
|
+
'Compact labels': props =>
|
|
294
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { Label, LabelColor } from '@patternfly/react-core';\nimport CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';\nimport RhUiInformationFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-information-fill-icon';\n\nexport const LabelCompact: React.FunctionComponent = () => (\n <Fragment>\n <Label isCompact>Compact</Label>\n <Label isCompact icon={<CubeIcon />}>\n Compact icon\n </Label>\n <Label isCompact onClose={() => Function.prototype}>\n Compact removable\n </Label>\n <Label isCompact icon={<CubeIcon />} onClose={() => Function.prototype}>\n Compact icon removable\n </Label>\n <Label isCompact href=\"#compact\">\n Compact link\n </Label>\n <Label isCompact href=\"#compact\" onClose={() => Function.prototype}>\n Compact link removable\n </Label>{' '}\n <Label isCompact onClick={() => Function.prototype}>\n Compact clickable\n </Label>{' '}\n <Label isCompact onClick={() => Function.prototype} onClose={() => Function.prototype}>\n Compact clickable removable\n </Label>{' '}\n <Label isCompact icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth=\"16ch\">\n Compact label with icon that overflows\n </Label>{' '}\n <Label isDisabled isCompact href=\"#compact\" onClose={() => Function.prototype} icon={<CubeIcon />}>\n Compact link removable (disabled)\n </Label>{' '}\n <Label\n isDisabled\n isCompact\n onClick={() => Function.prototype}\n onClose={() => Function.prototype}\n icon={<CubeIcon />}\n >\n Compact clickable removable (disabled)\n </Label>\n <Label variant=\"outline\" color={LabelColor.blue} isCompact icon={<CubeIcon />}>\n Compact icon\n </Label>\n <Label variant=\"outline\" color={LabelColor.blue} isCompact onClose={() => Function.prototype}>\n Compact removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.blue} isCompact icon={<CubeIcon />} onClose={() => Function.prototype}>\n Compact icon removable\n </Label>\n <Label variant=\"outline\" color={LabelColor.blue} isCompact href=\"#compact\">\n Compact link\n </Label>\n <Label variant=\"outline\" color={LabelColor.blue} isCompact href=\"#compact\" onClose={() => Function.prototype}>\n Compact link removable\n </Label>\n <Label\n variant=\"outline\"\n color={LabelColor.blue}\n isCompact\n icon={<CubeIcon />}\n onClose={() => Function.prototype}\n textMaxWidth=\"16ch\"\n >\n Compact label with icon that overflows\n </Label>{' '}\n <Label isDisabled isCompact href=\"#compact\" onClose={() => Function.prototype} icon={<RhUiInformationFillIcon />}>\n Compact link removable (disabled)\n </Label>{' '}\n <Label\n isDisabled\n isCompact\n onClick={() => Function.prototype}\n onClose={() => Function.prototype}\n icon={<RhUiInformationFillIcon />}\n >\n Compact clickable removable (disabled)\n </Label>\n </Fragment>\n);\n","title":"Compact labels","lang":"ts","className":""}}>
|
|
295
|
+
|
|
296
|
+
</Example>,
|
|
297
|
+
'Label with custom render': props =>
|
|
298
|
+
<Example {...pageData} {...props} {...{"code":"import { Label, LabelColor } from '@patternfly/react-core';\nimport RhUiInformationFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-information-fill-icon';\n\nexport const LabelCustomRender: React.FunctionComponent = () => (\n <Label\n color={LabelColor.blue}\n icon={<RhUiInformationFillIcon />}\n onClose={() => Function.prototype}\n render={({ className, content, componentRef }) => (\n <a className={className} ref={componentRef}>\n {content}\n </a>\n )}\n textMaxWidth=\"16ch\"\n isClickable\n >\n Blue label router link with icon that overflows\n </Label>\n);\n","title":"Label with custom render","lang":"ts","className":""}}>
|
|
299
|
+
|
|
300
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
301
|
+
{`Labels may be passed a custom renderer to display customized content or for use with router components. When using a custom render, `}
|
|
302
|
+
|
|
303
|
+
<code {...{"className":"ws-code "}}>
|
|
304
|
+
{`isClickable`}
|
|
305
|
+
</code>
|
|
306
|
+
{` may also be passed to remove the underline text decoration of anchors or router links.`}
|
|
307
|
+
</p>
|
|
308
|
+
</Example>,
|
|
309
|
+
'Editable labels': props =>
|
|
310
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Label, LabelColor } from '@patternfly/react-core';\n\nexport const LabelEditable: React.FunctionComponent = () => {\n const [labelText, setLabelText] = useState('Editable label');\n const [compactLabelText, setCompactLabelText] = useState('Compact editable label');\n\n const onEditCancel = (_event: KeyboardEvent, prevText: string) => {\n setLabelText(prevText);\n };\n\n const onEditComplete = (_event: MouseEvent | KeyboardEvent, text: string) => {\n setLabelText(text);\n };\n\n const onCompactEditCancel = (_event: KeyboardEvent, prevText: string) => {\n setCompactLabelText(prevText);\n };\n\n const onCompactEditComplete = (_event: MouseEvent | KeyboardEvent, text: string) => {\n setCompactLabelText(text);\n };\n\n return (\n <Fragment>\n <Label\n color={LabelColor.blue}\n onClose={() => {}}\n closeBtnAriaLabel=\"Custom close button for editable label\"\n onEditCancel={onEditCancel}\n onEditComplete={onEditComplete}\n isEditable\n editableProps={{\n 'aria-label': `Editable label with text ${labelText}`,\n id: 'editable-label'\n }}\n >\n {labelText}\n </Label>\n <Label\n color={LabelColor.grey}\n isCompact\n onClose={() => {}}\n closeBtnAriaLabel=\"Custom close button for compact editable label\"\n onEditCancel={onCompactEditCancel}\n onEditComplete={onCompactEditComplete}\n isEditable\n editableProps={{\n 'aria-label': `Editable compact label with text ${compactLabelText}`,\n id: 'compact-editable-label'\n }}\n >\n {compactLabelText}\n </Label>\n </Fragment>\n );\n};\n","title":"Editable labels","lang":"ts","className":""}}>
|
|
311
|
+
|
|
312
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
313
|
+
{`Click or press either enter or space to begin editing a label. After editing, click outside the label or press enter again to complete the edit. To cancel an edit, press escape.`}
|
|
314
|
+
</p>
|
|
315
|
+
|
|
316
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
317
|
+
{`You can also customize any Label's close button aria-label as this example shows with `}
|
|
318
|
+
|
|
319
|
+
<code {...{"className":"ws-code "}}>
|
|
320
|
+
{`closeBtnAriaLabel`}
|
|
321
|
+
</code>
|
|
322
|
+
{`.`}
|
|
323
|
+
</p>
|
|
324
|
+
</Example>,
|
|
325
|
+
'Basic label group': props =>
|
|
326
|
+
<Example {...pageData} {...props} {...{"code":"import { Label, LabelColor, LabelGroup } from '@patternfly/react-core';\nimport RhUiInformationFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-information-fill-icon';\n\nexport const LabelGroupBasic: React.FunctionComponent = () => (\n <LabelGroup>\n <Label icon={<RhUiInformationFillIcon />}>Label 1</Label>\n <Label icon={<RhUiInformationFillIcon />} color={LabelColor.blue}>\n Label 2\n </Label>\n <Label icon={<RhUiInformationFillIcon />} color={LabelColor.green}>\n Label 3\n </Label>\n </LabelGroup>\n);\n","title":"Basic label group","lang":"ts","className":""}}>
|
|
327
|
+
|
|
328
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
329
|
+
{`Use a label group when you have multiple labels to display at once.`}
|
|
330
|
+
</p>
|
|
331
|
+
</Example>,
|
|
332
|
+
'Label group with overflow': props =>
|
|
333
|
+
<Example {...pageData} {...props} {...{"code":"import { Label, LabelColor, LabelGroup } from '@patternfly/react-core';\nimport RhUiInformationFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-information-fill-icon';\n\nexport const LabelGroupOverflow: React.FunctionComponent = () => (\n <LabelGroup>\n <Label icon={<RhUiInformationFillIcon />}>Label 1</Label>\n <Label icon={<RhUiInformationFillIcon />} color={LabelColor.blue}>\n Label 2\n </Label>\n <Label icon={<RhUiInformationFillIcon />} color={LabelColor.green}>\n Label 3\n </Label>\n <Label icon={<RhUiInformationFillIcon />} color={LabelColor.orange}>\n Label 4\n </Label>\n <Label icon={<RhUiInformationFillIcon />} color={LabelColor.red}>\n Label 5\n </Label>\n <Label icon={<RhUiInformationFillIcon />} color={LabelColor.purple}>\n Label 6\n </Label>\n </LabelGroup>\n);\n","title":"Label group with overflow","lang":"ts","className":""}}>
|
|
334
|
+
|
|
335
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
336
|
+
{`An overflow label can be added to the end of a group to save space when the number of labels exceeds some threshold. Click the overflow label to expand and collapse the group.`}
|
|
337
|
+
</p>
|
|
338
|
+
</Example>,
|
|
339
|
+
'Label group with categories': props =>
|
|
340
|
+
<Example {...pageData} {...props} {...{"code":"import { Label, LabelColor, LabelGroup } from '@patternfly/react-core';\nimport RhUiInformationFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-information-fill-icon';\n\nexport const LabelGroupCategory: React.FunctionComponent = () => (\n <LabelGroup categoryName=\"Group label\">\n <Label icon={<RhUiInformationFillIcon />}>Label 1</Label>\n <Label icon={<RhUiInformationFillIcon />} color={LabelColor.blue}>\n Label 2\n </Label>\n <Label icon={<RhUiInformationFillIcon />} color={LabelColor.green}>\n Label 3\n </Label>\n </LabelGroup>\n);\n","title":"Label group with categories","lang":"ts","className":""}}>
|
|
341
|
+
|
|
342
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
343
|
+
{`Use a category name to organize a set of labels`}
|
|
344
|
+
</p>
|
|
345
|
+
</Example>,
|
|
346
|
+
'Label group with removable categories': props =>
|
|
347
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { Label, LabelColor, LabelGroup } from '@patternfly/react-core';\nimport RhUiInformationFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-information-fill-icon';\n\nexport const LabelGroupCategoryRemovable: React.FunctionComponent = () => {\n const [labels, setLabels] = useState([\n ['Label 1', 'grey'],\n ['Label 2', 'blue'],\n ['Label 3', 'green'],\n ['Label 4', 'orange'],\n ['Label 5', 'red']\n ]);\n const deleteCategory = () => setLabels([]);\n\n return (\n <LabelGroup categoryName=\"Group label\" isClosable onClick={deleteCategory}>\n {labels.map(([labelText, labelColor]) => (\n <Label icon={<RhUiInformationFillIcon />} color={labelColor as LabelColor} key={labelText}>\n {labelText}\n </Label>\n ))}\n </LabelGroup>\n );\n};\n","title":"Label group with removable categories","lang":"ts","className":""}}>
|
|
348
|
+
|
|
349
|
+
</Example>,
|
|
350
|
+
'Vertical label group': props =>
|
|
351
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { Label, LabelColor, LabelGroup } from '@patternfly/react-core';\nimport RhUiInformationFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-information-fill-icon';\n\nexport const LabelGroupVerticalCategoryOverflowRemovable: React.FunctionComponent = () => {\n const [labels, setLabels] = useState([\n ['Label 1', 'grey'],\n ['Label 2', 'blue'],\n ['Label 3', 'green'],\n ['Label 4', 'orange'],\n ['Label 5', 'red']\n ]);\n const deleteCategory = () => setLabels([]);\n\n return (\n <LabelGroup categoryName=\"Group label with a very long name\" isVertical isClosable onClick={deleteCategory}>\n {labels.map(([labelText, labelColor]) => (\n <Label icon={<RhUiInformationFillIcon />} color={labelColor as LabelColor} key={labelText}>\n {labelText}\n </Label>\n ))}\n </LabelGroup>\n );\n};\n","title":"Vertical label group","lang":"ts","className":""}}>
|
|
352
|
+
|
|
353
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
354
|
+
{`Labels in a group can also be stacked vertically. This example shows a verical label group with a category name and overflow.`}
|
|
355
|
+
</p>
|
|
356
|
+
</Example>,
|
|
357
|
+
'Editable label group': props =>
|
|
358
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { LabelGroup, Label, LabelColor } from '@patternfly/react-core';\n\nexport const LabelGroupEditableLabels: React.FunctionComponent = () => {\n const [label1, setLabel1] = useState('Editable label');\n const [label2, setLabel2] = useState('Editable label 2');\n const [label3, setLabel3] = useState('Editable label 3');\n\n return (\n <LabelGroup numLabels={5} isEditable>\n <Label\n color={LabelColor.blue}\n onClose={() => Function.prototype}\n onEditCancel={(_event, prevText) => setLabel1(prevText)}\n onEditComplete={(_event, newText) => setLabel1(newText)}\n isEditable\n editableProps={{\n 'aria-label': `Editable label with text ${label1}`,\n id: 'editable-label-1'\n }}\n >\n {label1}\n </Label>\n <Label color={LabelColor.green}>Static label</Label>\n <Label\n color={LabelColor.blue}\n onClose={() => Function.prototype}\n onEditCancel={(_event, prevText) => setLabel2(prevText)}\n onEditComplete={(_event, newText) => setLabel2(newText)}\n isEditable\n editableProps={{\n 'aria-label': `Editable label with text ${label2}`,\n id: 'editable-label-2'\n }}\n >\n {label2}\n </Label>\n <Label\n color={LabelColor.blue}\n onClose={() => Function.prototype}\n onEditCancel={(_event, prevText) => setLabel3(prevText)}\n onEditComplete={(_event, newText) => setLabel3(newText)}\n isEditable\n editableProps={{\n 'aria-label': `Editable label with text ${label3}`,\n id: 'editable-label-3'\n }}\n >\n {label3}\n </Label>\n </LabelGroup>\n );\n};\n","title":"Editable label group","lang":"ts","className":""}}>
|
|
359
|
+
|
|
360
|
+
</Example>,
|
|
361
|
+
'Editable label group with add button': props =>
|
|
362
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { LabelGroup, Label, LabelColor } from '@patternfly/react-core';\n\nexport const LabelGroupEditableAdd: React.FunctionComponent = () => {\n const [idIndex, setIdIndex] = useState<number>(3);\n const [labels, setLabels] = useState<any>([\n { name: 'Label 1', id: 0 },\n { name: 'Label 2', id: 1 },\n {\n name: 'Label 3',\n props: {\n isEditable: true,\n editableProps: {\n 'aria-label': 'Editable label with text Label 3'\n }\n },\n id: 2\n }\n ]);\n\n const onClose = (labelId: string) => {\n setLabels(labels.filter((l: any) => l.id !== labelId));\n };\n\n const onEdit = (nextText: string, index: number) => {\n const copy = [...labels];\n const updatedProps = {\n ...labels[index].props,\n editableProps: { 'aria-label': `Editable label with text ${nextText}` }\n };\n\n copy[index] = { name: nextText, props: updatedProps, id: labels[index].id };\n setLabels(copy);\n };\n\n const onAdd = () => {\n setLabels([\n {\n name: 'New Label',\n props: {\n isEditable: true,\n editableProps: {\n 'aria-label': `Editable label with text New Label`\n }\n },\n id: idIndex\n },\n ...labels\n ]);\n setIdIndex(idIndex + 1);\n };\n\n return (\n <LabelGroup\n categoryName=\"Label group 1\"\n numLabels={5}\n isEditable\n addLabelControl={\n <Label variant=\"add\" onClick={onAdd}>\n Add label\n </Label>\n }\n >\n {labels.map((label, index) => (\n <Label\n key={label.id}\n id={label.id}\n color={LabelColor.blue}\n onClose={() => onClose(label.id)}\n onEditCancel={(_event, prevText) => onEdit(prevText, index)}\n onEditComplete={(_event, newText) => onEdit(newText, index)}\n {...label.props}\n >\n {label.name}\n </Label>\n ))}\n </LabelGroup>\n );\n};\n","title":"Editable label group with add button","lang":"ts","className":""}}>
|
|
363
|
+
|
|
364
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
365
|
+
{`The contents of a label group can be modified by removing labels or adding new ones using the add button. For additional documentation that showcases adding a new label, see `}
|
|
366
|
+
|
|
367
|
+
<PatternflyThemeLink {...{"to":"/components/label/react-demos","className":""}}>
|
|
368
|
+
{`label demos`}
|
|
369
|
+
</PatternflyThemeLink>
|
|
370
|
+
{`.`}
|
|
371
|
+
</p>
|
|
372
|
+
</Example>
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
const Component = () => (
|
|
376
|
+
<React.Fragment>
|
|
377
|
+
<AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
378
|
+
{`Examples`}
|
|
379
|
+
</AutoLinkHeader>
|
|
380
|
+
{React.createElement(pageData.examples["Filled labels"])}
|
|
381
|
+
{React.createElement(pageData.examples["Outlined labels"])}
|
|
382
|
+
{React.createElement(pageData.examples["Compact labels"])}
|
|
383
|
+
{React.createElement(pageData.examples["Label with custom render"])}
|
|
384
|
+
{React.createElement(pageData.examples["Editable labels"])}
|
|
385
|
+
{React.createElement(pageData.examples["Basic label group"])}
|
|
386
|
+
{React.createElement(pageData.examples["Label group with overflow"])}
|
|
387
|
+
{React.createElement(pageData.examples["Label group with categories"])}
|
|
388
|
+
{React.createElement(pageData.examples["Label group with removable categories"])}
|
|
389
|
+
{React.createElement(pageData.examples["Vertical label group"])}
|
|
390
|
+
{React.createElement(pageData.examples["Editable label group"])}
|
|
391
|
+
{React.createElement(pageData.examples["Editable label group with add button"])}
|
|
392
|
+
<AutoLinkHeader {...{"id":"using-router-links","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
393
|
+
{`Using router links`}
|
|
394
|
+
</AutoLinkHeader>
|
|
395
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
396
|
+
{`Router links can be used for in-app linking in React environments to prevent page reloading. To use a `}
|
|
397
|
+
<code {...{"className":"ws-code "}}>
|
|
398
|
+
{`Link`}
|
|
399
|
+
</code>
|
|
400
|
+
{` component from a router package, you can use the `}
|
|
401
|
+
<code {...{"className":"ws-code "}}>
|
|
402
|
+
{`render`}
|
|
403
|
+
</code>
|
|
404
|
+
{` property of the `}
|
|
405
|
+
<code {...{"className":"ws-code "}}>
|
|
406
|
+
{`Label`}
|
|
407
|
+
</code>
|
|
408
|
+
{`:`}
|
|
409
|
+
</p>
|
|
410
|
+
<Example {...{"code":"<Label\n render={({ className, content, componentRef }) => (\n <Link to=\"/\" className={className} innerRef={componentRef}>\n {content}\n </Link>\n )}\n>\n Label router link\n</Label>","lang":"nolive","className":""}}>
|
|
411
|
+
</Example>
|
|
412
|
+
</React.Fragment>
|
|
413
|
+
);
|
|
414
|
+
Component.displayName = 'ComponentsLabelReactDocs';
|
|
415
|
+
Component.pageData = pageData;
|
|
416
|
+
|
|
417
|
+
export default Component;
|