@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,241 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import RhUiQuestionMarkCircleIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-question-mark-circle-icon';
|
|
5
|
+
import RhUiCopyFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-copy-fill-icon';
|
|
6
|
+
import '../../../../../react-core/src/components/Tooltip/examples/./TooltipExamples.css';
|
|
7
|
+
const pageData = {
|
|
8
|
+
"id": "Tooltip",
|
|
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/tooltip/react",
|
|
19
|
+
"sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/Tooltip/examples/Tooltip.md",
|
|
20
|
+
"relPath": "packages/react-core/src/components/Tooltip/examples/Tooltip.md",
|
|
21
|
+
"propComponents": [
|
|
22
|
+
{
|
|
23
|
+
"name": "Tooltip",
|
|
24
|
+
"description": "",
|
|
25
|
+
"props": [
|
|
26
|
+
{
|
|
27
|
+
"name": "animationDuration",
|
|
28
|
+
"type": "number",
|
|
29
|
+
"description": "CSS fade transition animation duration",
|
|
30
|
+
"defaultValue": "300"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "appendTo",
|
|
34
|
+
"type": "HTMLElement | ((ref?: HTMLElement) => HTMLElement)",
|
|
35
|
+
"description": "The element to append the tooltip to, defaults to body",
|
|
36
|
+
"defaultValue": "() => document.body"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "aria",
|
|
40
|
+
"type": "'describedby' | 'labelledby' | 'none'",
|
|
41
|
+
"description": "aria-labelledby or aria-describedby for tooltip.\nThe trigger will be cloned to add the aria attribute, and the corresponding id in the form of 'pf-tooltip-#' is added to the content container.\nIf you don't want that or prefer to add the aria attribute yourself on the trigger, set aria to 'none'.",
|
|
42
|
+
"defaultValue": "'describedby'"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "aria-live",
|
|
46
|
+
"type": "'off' | 'polite'",
|
|
47
|
+
"description": "Determines whether the tooltip is an aria-live region. If the triggerRef prop is passed in the\ndefault behavior is 'polite' in order to ensure the tooltip contents is announced to\nassistive technologies. Otherwise the default behavior is 'off'.",
|
|
48
|
+
"defaultValue": "triggerRef ? 'polite' : 'off'"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "children",
|
|
52
|
+
"type": "ReactElement<any>",
|
|
53
|
+
"description": "The trigger reference element to which the Tooltip is relatively placed to.\nIf you cannot wrap the element with the Tooltip, you can use the triggerRef prop instead.\nUsage: <Tooltip><Button>Reference</Button></Tooltip>"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "className",
|
|
57
|
+
"type": "string",
|
|
58
|
+
"description": "Tooltip additional class",
|
|
59
|
+
"defaultValue": "''"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "content",
|
|
63
|
+
"type": "React.ReactNode",
|
|
64
|
+
"description": "Tooltip content",
|
|
65
|
+
"required": true
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "distance",
|
|
69
|
+
"type": "number",
|
|
70
|
+
"description": "Distance of the tooltip to its target, defaults to 15",
|
|
71
|
+
"defaultValue": "15"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "enableFlip",
|
|
75
|
+
"type": "boolean",
|
|
76
|
+
"description": "If true, tries to keep the tooltip in view by flipping it if necessary",
|
|
77
|
+
"defaultValue": "true"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"name": "entryDelay",
|
|
81
|
+
"type": "number",
|
|
82
|
+
"description": "Delay in ms before the tooltip appears",
|
|
83
|
+
"defaultValue": "300"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "exitDelay",
|
|
87
|
+
"type": "number",
|
|
88
|
+
"description": "Delay in ms before the tooltip disappears, Avoid passing in a value of \"0\", as users should\nbe given ample time to move their mouse from the trigger to the tooltip content without the content\nbeing hidden.",
|
|
89
|
+
"defaultValue": "300"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "flipBehavior",
|
|
93
|
+
"type": "| 'flip'\n| (\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'\n )[]",
|
|
94
|
+
"description": "The desired position to flip the tooltip to if the initial position is not possible.\nBy setting this prop to 'flip' it attempts to flip the tooltip to the opposite side if there is no space.\nYou can also pass an array of positions that determines the flip order. It should contain the initial position\nfollowed by alternative positions if that position is unavailable.\nExample: Initial position is 'top'. Button with tooltip is in the top right corner. 'flipBehavior' is set to\n['top', 'right', 'left']. Since there is no space to the top, it checks if right is available. There's also no\nspace to the right, so it finally shows the tooltip on the left.",
|
|
95
|
+
"defaultValue": "['top', 'right', 'bottom', 'left', 'top', 'right', 'bottom']"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "id",
|
|
99
|
+
"type": "string",
|
|
100
|
+
"description": "id of the tooltip"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "isContentLeftAligned",
|
|
104
|
+
"type": "boolean",
|
|
105
|
+
"description": "Flag to indicate that the text content is left aligned",
|
|
106
|
+
"defaultValue": "false"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "isVisible",
|
|
110
|
+
"type": "boolean",
|
|
111
|
+
"description": "value for visibility when trigger is 'manual'",
|
|
112
|
+
"defaultValue": "false"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "maxWidth",
|
|
116
|
+
"type": "string",
|
|
117
|
+
"description": "Maximum width of the tooltip (default 18.75rem)",
|
|
118
|
+
"defaultValue": "\"18.75rem\""
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"name": "minWidth",
|
|
122
|
+
"type": "string | 'trigger'",
|
|
123
|
+
"description": "Minimum width of the tooltip. If set to \"trigger\", the minimum width will be set to the reference element width."
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"name": "onTooltipHidden",
|
|
127
|
+
"type": "() => void",
|
|
128
|
+
"description": "Callback when tooltip's hide transition has finished executing",
|
|
129
|
+
"defaultValue": "() => {}"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "position",
|
|
133
|
+
"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'",
|
|
134
|
+
"description": "Tooltip position. Note: With 'enableFlip' set to true,\nit will change the position if there is not enough space for the starting position.\nThe behavior of where it flips to can be controlled through the flipBehavior prop.\nThe 'auto' position chooses the side with the most space.\nThe 'auto' position requires the 'enableFlip' prop to be true.",
|
|
135
|
+
"defaultValue": "'top'"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"name": "trigger",
|
|
139
|
+
"type": "string",
|
|
140
|
+
"description": "Tooltip trigger: click, mouseenter, focus, manual\nSet to manual to trigger tooltip programmatically (through the isVisible prop)",
|
|
141
|
+
"defaultValue": "'mouseenter focus'"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"name": "triggerRef",
|
|
145
|
+
"type": "HTMLElement | (() => HTMLElement) | React.RefObject<any>",
|
|
146
|
+
"description": "The trigger reference element to which the Tooltip is relatively placed to.\nIf you can wrap the element with the Tooltip, you can use the children prop instead, or both props together.\nWhen passed along with the trigger prop, the div element that wraps the trigger will be removed.\nUsage: <Tooltip triggerRef={() => document.getElementById('reference-element')} />"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"name": "zIndex",
|
|
150
|
+
"type": "number",
|
|
151
|
+
"description": "z-index of the tooltip",
|
|
152
|
+
"defaultValue": "9999"
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"cssPrefix": [
|
|
158
|
+
"pf-v6-c-tooltip"
|
|
159
|
+
],
|
|
160
|
+
"examples": [
|
|
161
|
+
"Basic",
|
|
162
|
+
"Tooltip react ref",
|
|
163
|
+
"Tooltip selector ref",
|
|
164
|
+
"On icon with dynamic content",
|
|
165
|
+
"Options"
|
|
166
|
+
]
|
|
167
|
+
};
|
|
168
|
+
pageData.liveContext = {
|
|
169
|
+
useEffect,
|
|
170
|
+
useRef,
|
|
171
|
+
useState,
|
|
172
|
+
RhUiQuestionMarkCircleIcon,
|
|
173
|
+
RhUiCopyFillIcon
|
|
174
|
+
};
|
|
175
|
+
pageData.relativeImports = "import 'react-core/src/components/Tooltip/examples/./TooltipExamples.css';"
|
|
176
|
+
pageData.examples = {
|
|
177
|
+
'Basic': props =>
|
|
178
|
+
<Example {...pageData} {...props} {...{"code":"import { Button, Tooltip } from '@patternfly/react-core';\n\nexport const TooltipBasic: React.FunctionComponent = () => (\n <div style={{ margin: '100px' }}>\n <Tooltip\n content={\n <div>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.\n </div>\n }\n >\n <Button>I have a tooltip!</Button>\n </Tooltip>\n </div>\n);\n","title":"Basic","lang":"ts","className":""}}>
|
|
179
|
+
|
|
180
|
+
</Example>,
|
|
181
|
+
'Tooltip react ref': props =>
|
|
182
|
+
<Example {...pageData} {...props} {...{"code":"import { useRef } from 'react';\nimport { Tooltip } from '@patternfly/react-core';\n\nexport const TooltipReactRef: React.FunctionComponent = () => {\n const tooltipRef = useRef<HTMLButtonElement>(null);\n return (\n <div style={{ margin: '100px' }}>\n <button aria-describedby=\"tooltip-ref1\" ref={tooltipRef}>\n Tooltip attached via react ref\n </button>\n <Tooltip\n id=\"tooltip-ref1\"\n content={\n <div>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.\n </div>\n }\n triggerRef={tooltipRef}\n />\n </div>\n );\n};\n","title":"Tooltip react ref","lang":"ts","className":""}}>
|
|
183
|
+
|
|
184
|
+
</Example>,
|
|
185
|
+
'Tooltip selector ref': props =>
|
|
186
|
+
<Example {...pageData} {...props} {...{"code":"import { Tooltip } from '@patternfly/react-core';\n\nexport const TooltipSelectorRef: React.FunctionComponent = () => (\n <div style={{ margin: '100px' }}>\n <button aria-describedby=\"tooltip-ref2\" id=\"tooltip-selector\">\n Tooltip attached via selector ref\n </button>\n <Tooltip\n id=\"tooltip-ref2\"\n content={\n <div>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.\n </div>\n }\n triggerRef={() => document.getElementById('tooltip-selector') as HTMLButtonElement}\n />\n </div>\n);\n","title":"Tooltip selector ref","lang":"ts","className":""}}>
|
|
187
|
+
|
|
188
|
+
</Example>,
|
|
189
|
+
'On icon with dynamic content': props =>
|
|
190
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { Tooltip, Button } from '@patternfly/react-core';\nimport RhUiCopyFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-copy-fill-icon';\n\nexport const TooltipIcon: React.FunctionComponent = () => {\n const [showSuccessContent, setShowSuccessContent] = useState(false);\n const copyText: string = 'Copy to clipboard';\n const doneCopyText: string = 'Successfully copied to clipboard!';\n\n return (\n <div style={{ margin: '100px' }}>\n <Tooltip aria=\"none\" aria-live=\"polite\" content={showSuccessContent ? doneCopyText : copyText}>\n <Button\n aria-label=\"Clipboard\"\n variant=\"plain\"\n id=\"tt-ref\"\n onClick={() => setShowSuccessContent(!showSuccessContent)}\n icon={<RhUiCopyFillIcon />}\n />\n </Tooltip>\n </div>\n );\n};\n","title":"On icon with dynamic content","lang":"ts","className":""}}>
|
|
191
|
+
|
|
192
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
193
|
+
{`When the tooltip is used as a wrapper and its content will dynamically update, the `}
|
|
194
|
+
|
|
195
|
+
<code {...{"className":"ws-code "}}>
|
|
196
|
+
{`aria`}
|
|
197
|
+
</code>
|
|
198
|
+
{` prop should have a value of "none" passed in. This prevents assistive technologies from announcing the tooltip contents more than once. Additionally, the `}
|
|
199
|
+
|
|
200
|
+
<code {...{"className":"ws-code "}}>
|
|
201
|
+
{`aria-live`}
|
|
202
|
+
</code>
|
|
203
|
+
{` prop should have a value of "polite" passed in, in order for assistive technologies to announce when the tooltip contents gets updated.`}
|
|
204
|
+
</p>
|
|
205
|
+
|
|
206
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
207
|
+
{`When using a React or selector ref with a tooltip that has dynamic content, the `}
|
|
208
|
+
|
|
209
|
+
<code {...{"className":"ws-code "}}>
|
|
210
|
+
{`aria`}
|
|
211
|
+
</code>
|
|
212
|
+
{` and `}
|
|
213
|
+
|
|
214
|
+
<code {...{"className":"ws-code "}}>
|
|
215
|
+
{`aria-live`}
|
|
216
|
+
</code>
|
|
217
|
+
{` props do not need to be manually passed in.`}
|
|
218
|
+
</p>
|
|
219
|
+
</Example>,
|
|
220
|
+
'Options': props =>
|
|
221
|
+
<Example {...pageData} {...props} {...{"code":"import { useEffect, useRef, useState } from 'react';\nimport {\n Button,\n Tooltip,\n Checkbox,\n Select,\n SelectList,\n SelectOption,\n MenuToggle,\n MenuToggleElement,\n TextInput,\n TooltipPosition\n} from '@patternfly/react-core';\n\nexport const TooltipOptions: React.FunctionComponent = () => {\n const [trigger, setTrigger] = useState(['mouseenter', 'focus']);\n const [isVisible, setIsVisible] = useState(true);\n const [contentLeftAligned, setContentLeftAligned] = useState(false);\n const [enableFlip, setEnableFlip] = useState(true);\n const [position, setPosition] = useState<TooltipPosition>(TooltipPosition.top);\n const [positionSelectOpen, setPositionSelectOpen] = useState(false);\n const [flipSelectOpen, setFlipSelectOpen] = useState(false);\n const [flipBehavior, setFlipBehavior] = useState('flip');\n const [entryDelayInput, setEntryDelayInput] = useState(0);\n const [exitDelayInput, setExitDelayInput] = useState(0);\n const [animationDuration, setAnimationDuration] = useState(300);\n const tipBoxRef = useRef(null);\n\n const scrollToRef = (ref: React.RefObject<any>) => {\n if (ref && ref.current) {\n ref.current.scrollTop = 400;\n ref.current.scrollLeft = 300;\n }\n };\n\n useEffect(() => {\n scrollToRef(tipBoxRef);\n }, []);\n\n return (\n <>\n <div>\n <div style={{ border: '1px solid' }}>\n <Checkbox\n label=\"trigger: mouseenter\"\n isChecked={trigger.includes('mouseenter')}\n onChange={(_event, checked) => {\n const updatedTrigger = checked ? trigger.concat('mouseenter') : trigger.filter((t) => t !== 'mouseenter');\n setIsVisible(false);\n setTrigger(updatedTrigger);\n }}\n aria-label=\"trigger: mouseenter\"\n id=\"trigger_mouseenter\"\n />\n <Checkbox\n label=\"trigger: focus\"\n isChecked={trigger.includes('focus')}\n onChange={(_event, checked) => {\n const updatedTrigger = checked ? trigger.concat('focus') : trigger.filter((t) => t !== 'focus');\n setIsVisible(false);\n setTrigger(updatedTrigger);\n }}\n aria-label=\"trigger: focus\"\n id=\"trigger_focus\"\n />\n <Checkbox\n label=\"trigger: click\"\n isChecked={trigger.includes('click')}\n onChange={(_event, checked) => {\n const updatedTrigger = checked ? trigger.concat('click') : trigger.filter((t) => t !== 'click');\n setIsVisible(false);\n setTimeout(() => setTrigger(updatedTrigger));\n }}\n aria-label=\"trigger: click\"\n id=\"trigger_click\"\n />\n <Checkbox\n label=\"trigger: manual\"\n isChecked={trigger.includes('manual')}\n onChange={(_event, checked) => {\n const updatedTrigger = checked ? trigger.concat('manual') : trigger.filter((t) => t !== 'manual');\n setIsVisible(false);\n setTrigger(updatedTrigger);\n }}\n aria-label=\"trigger: manual\"\n id=\"trigger_manual\"\n />\n </div>\n <div style={{ border: '1px solid' }}>\n <Checkbox\n label=\"content left-aligned\"\n isChecked={contentLeftAligned}\n onChange={(_event, checked) => setContentLeftAligned(checked)}\n aria-label=\"content left-aligned\"\n id=\"content_left_aligned\"\n />\n </div>\n <div style={{ border: '1px solid' }}>\n <Checkbox\n label=\"enableFlip\"\n isChecked={enableFlip}\n onChange={(_event, checked) => setEnableFlip(checked)}\n aria-label=\"enableFlip\"\n id=\"enable_flip\"\n />\n </div>\n <div style={{ border: '1px solid' }}>\n position (will flip if enableFlip is true). The 'auto' position requires enableFlip to be set to true.\n <Select\n toggle={(toggleRef: React.Ref<MenuToggleElement>) => (\n <MenuToggle\n ref={toggleRef}\n onClick={() => setPositionSelectOpen(!positionSelectOpen)}\n isExpanded={positionSelectOpen}\n style={\n {\n width: '200px'\n } as React.CSSProperties\n }\n >\n {position}\n </MenuToggle>\n )}\n onOpenChange={setPositionSelectOpen}\n onSelect={(_event, selection) => {\n setPosition(selection.toString() as TooltipPosition);\n setPositionSelectOpen(false);\n }}\n isOpen={positionSelectOpen}\n selected={position}\n >\n <SelectList>\n <SelectOption value={TooltipPosition.auto}>{TooltipPosition.auto}</SelectOption>\n <SelectOption value={TooltipPosition.top}>{TooltipPosition.top}</SelectOption>\n <SelectOption value={TooltipPosition.bottom}>{TooltipPosition.bottom}</SelectOption>\n <SelectOption value={TooltipPosition.left}>{TooltipPosition.left}</SelectOption>\n <SelectOption value={TooltipPosition.right}>{TooltipPosition.right}</SelectOption>\n <SelectOption value={TooltipPosition.topStart}>{TooltipPosition.topStart}</SelectOption>\n <SelectOption value={TooltipPosition.topEnd}>{TooltipPosition.topEnd}</SelectOption>\n <SelectOption value={TooltipPosition.bottomStart}>{TooltipPosition.bottomStart}</SelectOption>\n <SelectOption value={TooltipPosition.bottomEnd}>{TooltipPosition.bottomEnd}</SelectOption>\n <SelectOption value={TooltipPosition.leftStart}>{TooltipPosition.leftStart}</SelectOption>\n <SelectOption value={TooltipPosition.leftEnd}>{TooltipPosition.leftEnd}</SelectOption>\n <SelectOption value={TooltipPosition.rightStart}>{TooltipPosition.rightStart}</SelectOption>\n <SelectOption value={TooltipPosition.rightEnd}>{TooltipPosition.rightEnd}</SelectOption>\n </SelectList>\n </Select>\n </div>\n <div style={{ border: '1px solid' }}>\n <Checkbox\n label=\"isVisible (also set trigger to only manual to programmatically control it)\"\n isChecked={isVisible}\n onChange={(_event, checked) => setIsVisible(checked)}\n aria-label=\"isVisible\"\n id=\"is_visible\"\n />\n </div>\n <div style={{ border: '1px solid' }}>\n Entry delay (ms){' '}\n <TextInput\n value={entryDelayInput}\n type=\"number\"\n onChange={(_event, val) => setEntryDelayInput(Number(val))}\n aria-label=\"entry delay\"\n />\n Exit delay (ms){' '}\n <TextInput\n value={exitDelayInput}\n type=\"number\"\n onChange={(_event, val) => setExitDelayInput(Number(val))}\n aria-label=\"exit delay\"\n />\n Animation duration (ms){' '}\n <TextInput\n value={animationDuration}\n type=\"number\"\n onChange={(_event, val) => setAnimationDuration(Number(val))}\n aria-label=\"animation duration\"\n />\n </div>\n <div style={{ border: '1px solid' }}>\n flip behavior examples (enableFlip has to be true). \"flip\" will try to flip the tooltip to the opposite of the\n starting position. The second option ensures that there are 3 escape positions for every possible starting\n position (default). This setting is ignored if position prop is set to 'auto'.\n <Select\n onOpenChange={setFlipSelectOpen}\n onSelect={(_event, selection) => {\n setFlipBehavior(selection as string);\n setFlipSelectOpen(false);\n }}\n isOpen={flipSelectOpen}\n selected={flipBehavior}\n toggle={(toggleRef: React.Ref<MenuToggleElement>) => (\n <MenuToggle\n ref={toggleRef}\n onClick={() => setFlipSelectOpen(!flipSelectOpen)}\n isExpanded={flipSelectOpen}\n style={\n {\n width: '450px'\n } as React.CSSProperties\n }\n >\n {flipBehavior}\n </MenuToggle>\n )}\n >\n <SelectList>\n <SelectOption value=\"flip\">flip</SelectOption>\n <SelectOption value=\"clockwise\">\n ['top', 'right', 'bottom', 'left', 'top', 'right', 'bottom']\n </SelectOption>\n </SelectList>\n </Select>\n </div>\n </div>\n <div id=\"tooltip-boundary\" className=\"tooltip-box\" ref={tipBoxRef}>\n <Tooltip\n content={\n <div>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.\n </div>\n }\n trigger={trigger.join(' ')}\n enableFlip={enableFlip}\n flipBehavior={flipBehavior === 'flip' ? 'flip' : ['top', 'right', 'bottom', 'left', 'top', 'right', 'bottom']}\n position={position}\n isVisible={isVisible}\n entryDelay={entryDelayInput}\n exitDelay={exitDelayInput}\n animationDuration={animationDuration}\n isContentLeftAligned={contentLeftAligned}\n appendTo={() => document.getElementById('tooltip-boundary') as HTMLElement}\n >\n <Button className=\"tooltip-button\">Tooltip</Button>\n </Tooltip>\n </div>\n </>\n );\n};\n","title":"Options","lang":"ts","className":""}}>
|
|
222
|
+
|
|
223
|
+
</Example>
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
const Component = () => (
|
|
227
|
+
<React.Fragment>
|
|
228
|
+
<AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
229
|
+
{`Examples`}
|
|
230
|
+
</AutoLinkHeader>
|
|
231
|
+
{React.createElement(pageData.examples["Basic"])}
|
|
232
|
+
{React.createElement(pageData.examples["Tooltip react ref"])}
|
|
233
|
+
{React.createElement(pageData.examples["Tooltip selector ref"])}
|
|
234
|
+
{React.createElement(pageData.examples["On icon with dynamic content"])}
|
|
235
|
+
{React.createElement(pageData.examples["Options"])}
|
|
236
|
+
</React.Fragment>
|
|
237
|
+
);
|
|
238
|
+
Component.displayName = 'ComponentsTooltipReactDocs';
|
|
239
|
+
Component.pageData = pageData;
|
|
240
|
+
|
|
241
|
+
export default Component;
|