@redis-ui/components 43.0.2 → 43.2.1

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.
Files changed (85) hide show
  1. package/dist/HighlightedIcon/HighlightedIcon.cjs +26 -0
  2. package/dist/HighlightedIcon/HighlightedIcon.d.ts +3 -0
  3. package/dist/HighlightedIcon/HighlightedIcon.js +26 -0
  4. package/dist/HighlightedIcon/HighlightedIcon.style.cjs +49 -0
  5. package/dist/HighlightedIcon/HighlightedIcon.style.d.ts +5 -0
  6. package/dist/HighlightedIcon/HighlightedIcon.style.js +47 -0
  7. package/dist/HighlightedIcon/HighlightedIcon.types.d.ts +8 -0
  8. package/dist/HighlightedIcon/index.d.ts +3 -0
  9. package/dist/Stepper/Stepper.cjs +14 -5
  10. package/dist/Stepper/Stepper.d.ts +2 -0
  11. package/dist/Stepper/Stepper.js +14 -5
  12. package/dist/Stepper/Stepper.utils.cjs +12 -0
  13. package/dist/Stepper/Stepper.utils.d.ts +2 -0
  14. package/dist/Stepper/Stepper.utils.js +12 -0
  15. package/dist/Stepper/components/Compose/Compose.d.ts +1 -0
  16. package/dist/Stepper/components/Step/Step.cjs +2 -0
  17. package/dist/Stepper/components/Step/Step.d.ts +1 -0
  18. package/dist/Stepper/components/Step/Step.js +2 -0
  19. package/dist/Stepper/components/Step/components/Compose/Compose.cjs +2 -9
  20. package/dist/Stepper/components/Step/components/Compose/Compose.js +2 -9
  21. package/dist/Stepper/components/Step/components/Separator/Separator.cjs +15 -0
  22. package/dist/Stepper/components/Step/components/Separator/Separator.d.ts +3 -0
  23. package/dist/Stepper/components/Step/components/Separator/Separator.js +15 -0
  24. package/dist/Stepper/components/Step/components/Separator/Separator.style.cjs +24 -0
  25. package/dist/Stepper/components/Step/components/Separator/Separator.style.d.ts +1 -0
  26. package/dist/Stepper/components/Step/components/Separator/Separator.style.js +22 -0
  27. package/dist/Stepper/components/Step/components/Separator/Separator.types.d.ts +5 -0
  28. package/dist/index.cjs +4 -0
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +74 -70
  31. package/package.json +2 -2
  32. package/skills/redis-ui-components/SKILL.md +0 -2
  33. package/skills/redis-ui-components/references/ActionIconButton.md +96 -0
  34. package/skills/redis-ui-components/references/AppBar.md +161 -0
  35. package/skills/redis-ui-components/references/AppSelectionMenu.md +184 -0
  36. package/skills/redis-ui-components/references/AutoCompleteSelect.md +193 -0
  37. package/skills/redis-ui-components/references/Badge.md +77 -0
  38. package/skills/redis-ui-components/references/Banner.md +563 -0
  39. package/skills/redis-ui-components/references/BoxSelectionGroup.md +487 -0
  40. package/skills/redis-ui-components/references/Breadcrumbs.md +214 -0
  41. package/skills/redis-ui-components/references/ButtonGroup.md +126 -0
  42. package/skills/redis-ui-components/references/Card.md +56 -0
  43. package/skills/redis-ui-components/references/Checkbox.md +171 -0
  44. package/skills/redis-ui-components/references/Chip.md +154 -0
  45. package/skills/redis-ui-components/references/ChipList.md +307 -0
  46. package/skills/redis-ui-components/references/CopyToClipboardButton.md +47 -0
  47. package/skills/redis-ui-components/references/CountryFlag.md +57 -0
  48. package/skills/redis-ui-components/references/Drawer.md +298 -0
  49. package/skills/redis-ui-components/references/Filters.md +162 -0
  50. package/skills/redis-ui-components/references/FormField.md +678 -0
  51. package/skills/redis-ui-components/references/IconButton.md +63 -0
  52. package/skills/redis-ui-components/references/Input.md +295 -0
  53. package/skills/redis-ui-components/references/KeyValueList.md +501 -0
  54. package/skills/redis-ui-components/references/Label.md +238 -0
  55. package/skills/redis-ui-components/references/Link.md +402 -0
  56. package/skills/redis-ui-components/references/Loader.md +100 -0
  57. package/skills/redis-ui-components/references/Menu.md +988 -0
  58. package/skills/redis-ui-components/references/MidBar.md +358 -0
  59. package/skills/redis-ui-components/references/Modal.md +525 -0
  60. package/skills/redis-ui-components/references/MoreInfoIcon.md +119 -0
  61. package/skills/redis-ui-components/references/MultiSelect.md +558 -0
  62. package/skills/redis-ui-components/references/NumericInput.md +322 -0
  63. package/skills/redis-ui-components/references/Overflow.md +127 -0
  64. package/skills/redis-ui-components/references/Pagination.md +151 -0
  65. package/skills/redis-ui-components/references/PasswordInput.md +262 -0
  66. package/skills/redis-ui-components/references/Popover.md +868 -0
  67. package/skills/redis-ui-components/references/ProfileIcon.md +65 -0
  68. package/skills/redis-ui-components/references/ProgressBar.md +103 -0
  69. package/skills/redis-ui-components/references/QuantityCounter.md +555 -0
  70. package/skills/redis-ui-components/references/RadioGroup.md +265 -0
  71. package/skills/redis-ui-components/references/ScreenReaderAnnounce.md +147 -0
  72. package/skills/redis-ui-components/references/SearchBar.md +242 -0
  73. package/skills/redis-ui-components/references/SearchInput.md +213 -0
  74. package/skills/redis-ui-components/references/Section.md +349 -0
  75. package/skills/redis-ui-components/references/SideBar.md +468 -0
  76. package/skills/redis-ui-components/references/Slider.md +398 -0
  77. package/skills/redis-ui-components/references/Stepper.md +288 -0
  78. package/skills/redis-ui-components/references/Switch.md +193 -0
  79. package/skills/redis-ui-components/references/Tabs.md +383 -0
  80. package/skills/redis-ui-components/references/TextArea.md +139 -0
  81. package/skills/redis-ui-components/references/TextButton.md +217 -0
  82. package/skills/redis-ui-components/references/Toast.md +399 -0
  83. package/skills/redis-ui-components/references/ToggleButton.md +163 -0
  84. package/skills/redis-ui-components/references/Tooltip.md +636 -0
  85. package/skills/redis-ui-components/references/Typography.md +323 -0
@@ -0,0 +1,636 @@
1
+ # Tooltip
2
+
3
+ Popup component triggered by pointer hover, with customizable content, controlled state, and composition helpers.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { Tooltip, TooltipProvider } from '@redislabsdev/redis-ui-components';
9
+ ```
10
+
11
+ > `TooltipProvider` is exported alongside `Tooltip` and sets the shared hover delay (`openDelayDuration`, default `0`).
12
+
13
+ > Examples that use `InfoIcon` also import it from `@redislabsdev/redis-ui-icons`.
14
+
15
+ ## Props
16
+
17
+ | Prop | Type | Default | Description |
18
+ |------|------|---------|-------------|
19
+ | children | `React.ReactNode` | required | Trigger content rendered inside the tooltip wrapper |
20
+ | content | `ReactNode` | - | Tooltip content; falsy values hide the tooltip and string content is wrapped automatically |
21
+ | placement | `'top' \| 'bottom' \| 'left' \| 'right'` | `'top'` | Side where the tooltip is rendered |
22
+ | sideOffset | `number` | `5` | Gap between the trigger and the tooltip panel |
23
+ | maxWidth | `string` | theme default | Maximum width of the tooltip panel |
24
+ | alignOffset | `number` | - | Offset applied along the alignment axis |
25
+ | align | `'start' \| 'center' \| 'end'` | - | Alignment of the tooltip panel relative to the trigger |
26
+ | disableInteractionHelper | `boolean` | - | Deprecated interaction helper flag |
27
+ | portal | `HTMLElement \| null` | `document.body` | Portal container; `null` renders without a portal |
28
+ | collisionBoundary | `RadixTooltip.TooltipContentProps['collisionBoundary']` | - | Radix collision boundary forwarded to the content |
29
+ | defaultOpen | `boolean` | - | Starts the tooltip open in uncontrolled mode |
30
+ | openDelayDuration | `number` | - | Delay before the tooltip opens |
31
+ | open | `boolean` | - | Controlled open state |
32
+ | onOpenChange | `(open: boolean) => void` | - | Called when the open state changes |
33
+ | disabled | `boolean` | - | Prevents the tooltip from opening |
34
+ | interactive | `boolean` | `false` | Keeps the tooltip open when the pointer moves into the content |
35
+ | withButton | `boolean` | `false` | Wraps trigger content in an invisible button for plain text, SVG, or multi-element triggers |
36
+
37
+ ## TooltipProvider
38
+
39
+ | Prop | Type | Default | Description |
40
+ |------|------|---------|-------------|
41
+ | openDelayDuration | `number` | `0` | Shared hover delay applied by the Radix tooltip provider |
42
+ | children | `React.ReactNode` | required | Tooltip tree wrapped by the provider |
43
+
44
+ ## Sub-components
45
+
46
+ - `Tooltip.Compose` - Wraps the Radix tooltip root and handles controlled, uncontrolled, and interactive tooltip state.
47
+ - `Tooltip.Trigger` - Attaches tooltip trigger behavior to child content.
48
+ - `Tooltip.Content` - Renders the tooltip panel and auto-wraps string content in `Tooltip.Content.Text`.
49
+ - `Tooltip.Content.Compose` - Low-level tooltip content wrapper that controls placement, portal, width, and collision behavior.
50
+ - `Tooltip.Content.Text` - Typography body wrapper for simple tooltip text.
51
+ - `Tooltip.Card` - Formatted tooltip card variant with header, body, and footer blocks.
52
+ - `Tooltip.Card.Compose` - Low-level wrapper for composing card content.
53
+ - `Tooltip.Card.Header` - Header block for tooltip cards; defaults to hiding the close button.
54
+ - `Tooltip.Card.Header.Compose` - Low-level header wrapper.
55
+ - `Tooltip.Card.Header.Title` - Header title text; inherits `TypographyHeadingProps`.
56
+ - `Tooltip.Card.Body` - Body block for tooltip cards.
57
+ - `Tooltip.Card.Body.Compose` - Low-level body wrapper.
58
+ - `Tooltip.Card.Body.Text` - Body text; inherits `TypographyBodyProps`.
59
+ - `Tooltip.Card.Footer` - Footer block for tooltip cards with optional action button and link.
60
+ - `Tooltip.Card.Footer.Compose` - Low-level footer wrapper.
61
+
62
+ ## Tooltip.Compose Props
63
+
64
+ | Prop | Type | Default | Description |
65
+ |------|------|---------|-------------|
66
+ | children | `React.ReactNode` | required | Tooltip root children, typically `Tooltip.Trigger` and `Tooltip.Content` |
67
+ | defaultOpen | `boolean` | - | Starts the tooltip open in uncontrolled mode |
68
+ | openDelayDuration | `number` | - | Delay before opening the tooltip |
69
+ | open | `boolean` | - | Controlled open state |
70
+ | onOpenChange | `(open: boolean) => void` | - | Called when the open state changes |
71
+ | disabled | `boolean` | - | Prevents the tooltip from opening |
72
+ | interactive | `boolean` | `false` | Keeps the tooltip open when the pointer moves into the tooltip content |
73
+
74
+ ## Tooltip.Trigger Props
75
+
76
+ | Prop | Type | Default | Description |
77
+ |------|------|---------|-------------|
78
+ | children | `React.ReactNode` | required | Trigger content |
79
+ | withButton | `boolean` | `false` | Wraps the trigger content in an invisible button |
80
+
81
+ ## Tooltip.Content Props
82
+
83
+ | Prop | Type | Default | Description |
84
+ |------|------|---------|-------------|
85
+ | content | `ReactNode` | - | Tooltip content; string values are wrapped in `Tooltip.Content.Text` |
86
+ | placement | `'top' \| 'bottom' \| 'left' \| 'right'` | `'top'` | Side where the tooltip is rendered |
87
+ | sideOffset | `number` | `5` | Gap between trigger and content |
88
+ | maxWidth | `string` | theme default | Maximum width of the tooltip panel |
89
+ | alignOffset | `number` | - | Offset along the alignment axis |
90
+ | align | `'start' \| 'center' \| 'end'` | - | Alignment of the tooltip panel relative to the trigger |
91
+ | disableInteractionHelper | `boolean` | - | Deprecated interaction helper flag |
92
+ | portal | `HTMLElement \| null` | `document.body` | Portal container; `null` renders the tooltip inline |
93
+ | collisionBoundary | `RadixTooltip.TooltipContentProps['collisionBoundary']` | - | Radix collision boundary forwarded to the content |
94
+
95
+ ## Tooltip.Content.Compose Props
96
+
97
+ | Prop | Type | Default | Description |
98
+ |------|------|---------|-------------|
99
+ | children | `React.ReactNode` | required | Tooltip content body |
100
+ | backgroundColor | `string` | - | Overrides the tooltip background color |
101
+ | placement | `'top' \| 'bottom' \| 'left' \| 'right'` | `'top'` | Tooltip side relative to the trigger |
102
+ | sideOffset | `number` | `5` | Gap between trigger and content |
103
+ | maxWidth | `string` | theme default | Maximum width of the tooltip panel |
104
+ | alignOffset | `number` | - | Offset along the alignment axis |
105
+ | align | `'start' \| 'center' \| 'end'` | - | Alignment of the tooltip panel |
106
+ | disableInteractionHelper | `boolean` | - | Deprecated interaction helper flag |
107
+ | portal | `HTMLElement \| null` | `document.body` | Portal container; `null` renders without a portal |
108
+ | collisionBoundary | `RadixTooltip.TooltipContentProps['collisionBoundary']` | - | Radix collision boundary forwarded to the content |
109
+
110
+ ## Tooltip.Card Props
111
+
112
+ | Prop | Type | Default | Description |
113
+ |------|------|---------|-------------|
114
+ | title | `string` | - | Card title shown in the header |
115
+ | text | `string` | - | Card body text |
116
+ | actionButtonText | `string` | - | Label for the optional action button |
117
+ | actionButtonHandler | `(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void` | - | Click handler for the action button |
118
+ | link | `string` | - | Optional footer link URL |
119
+ | linkText | `string` | - | Label for the footer link |
120
+
121
+ `Tooltip.Card` also accepts standard div attributes via the underlying compose wrapper.
122
+
123
+ ## Tooltip.Card.Compose Props
124
+
125
+ | Prop | Type | Default | Description |
126
+ |------|------|---------|-------------|
127
+ | children | `React.ReactNode` | required | Card content wrapper and standard div attributes from the underlying compose wrapper |
128
+
129
+ ## Tooltip.Card.Header Props
130
+
131
+ | Prop | Type | Default | Description |
132
+ |------|------|---------|-------------|
133
+ | title | `string` | - | Header title |
134
+ | hideCloseButton | `boolean` | `true` | Hides the close button by default |
135
+ | children | `React.ReactNode` | - | Standard div attributes from the wrapped header component |
136
+
137
+ ## Tooltip.Card.Header.Compose Props
138
+
139
+ | Prop | Type | Default | Description |
140
+ |------|------|---------|-------------|
141
+ | children | `React.ReactNode` | required | Header composition content and standard div attributes |
142
+
143
+ ## Tooltip.Card.Body Props
144
+
145
+ | Prop | Type | Default | Description |
146
+ |------|------|---------|-------------|
147
+ | text | `string` | - | Body text |
148
+ | children | `React.ReactNode` | - | Standard div attributes from the wrapped body component |
149
+
150
+ ## Tooltip.Card.Body.Compose Props
151
+
152
+ | Prop | Type | Default | Description |
153
+ |------|------|---------|-------------|
154
+ | children | `React.ReactNode` | required | Body composition content and standard div attributes |
155
+
156
+ ## Tooltip.Card.Footer Props
157
+
158
+ | Prop | Type | Default | Description |
159
+ |------|------|---------|-------------|
160
+ | actionButtonText | `string` | - | Label for the action button |
161
+ | actionButtonHandler | `(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void` | - | Click handler for the action button |
162
+ | link | `string` | - | Optional footer link URL |
163
+ | linkText | `string` | - | Label for the footer link |
164
+ | children | `React.ReactNode` | - | Standard div attributes from the wrapped footer component |
165
+
166
+ ## Tooltip.Card.Footer.Compose Props
167
+
168
+ | Prop | Type | Default | Description |
169
+ |------|------|---------|-------------|
170
+ | children | `React.ReactNode` | required | Footer composition content and standard div attributes |
171
+
172
+ ## Examples
173
+
174
+ ### Playground
175
+
176
+ ```tsx
177
+ import { Button, Tooltip } from '@redislabsdev/redis-ui-components';
178
+
179
+ <Tooltip content="Tooltips can display any content">
180
+ <Button>Hover me</Button>
181
+ </Tooltip>
182
+ ```
183
+
184
+ ### TriggerWithButton
185
+
186
+ > Tooltip Trigger has property `withButton` which allows wrapping trigger elements with invisible button.
187
+ >
188
+ > Use this property if you have multiple elements or your element doesn't work as trigger (e.g. svg, plain text)
189
+
190
+ ```tsx
191
+ import { Tooltip } from '@redislabsdev/redis-ui-components';
192
+ import { InfoIcon } from '@redislabsdev/redis-ui-icons';
193
+ import { useViewMode } from '../../helpers/useViewMode';
194
+
195
+ function Render() {
196
+ const { inStory } = useViewMode();
197
+
198
+ return (
199
+ <>
200
+ <Tooltip content="Plain text trigger" withButton defaultOpen={inStory}>
201
+ Plain text
202
+ </Tooltip>
203
+ <Tooltip content="SVG trigger" withButton defaultOpen={inStory}>
204
+ <InfoIcon />
205
+ </Tooltip>
206
+ <Tooltip content="Multiple elements trigger" withButton defaultOpen={inStory}>
207
+ <strong>Multiple</strong>&nbsp;<em>Elements</em>
208
+ </Tooltip>
209
+ </>
210
+ );
211
+ }
212
+ ```
213
+
214
+ ### ProgrammaticallyOpened
215
+
216
+ > Tooltip can be opened programmatically by setting `open` or `defaultOpen` props
217
+
218
+ ```tsx
219
+ import { useEffect, useState } from 'react';
220
+ import { Button, Switch, Tooltip, Typography } from '@redislabsdev/redis-ui-components';
221
+
222
+ function Render() {
223
+ const [open, setOpen] = useState(false);
224
+ const [enabled, setEnabled] = useState(false);
225
+ const [countDown, setCountDown] = useState(0);
226
+
227
+ const resetTimer = () => {
228
+ setCountDown(3);
229
+ };
230
+
231
+ useEffect(() => {
232
+ if (enabled) {
233
+ if (countDown > 0) {
234
+ const timer = setTimeout(() => {
235
+ setCountDown(countDown - 1);
236
+ }, 1000);
237
+
238
+ return () => clearTimeout(timer);
239
+ }
240
+
241
+ setOpen(true);
242
+ } else {
243
+ resetTimer();
244
+ }
245
+
246
+ return undefined;
247
+ }, [countDown, enabled]);
248
+
249
+ return (
250
+ <>
251
+ <Switch checked={enabled} onCheckedChange={setEnabled} />
252
+ {enabled ? (
253
+ <>
254
+ <Typography.Heading size="M">Tooltip will be open in {countDown} seconds</Typography.Heading>
255
+ <Tooltip
256
+ open={open}
257
+ content={
258
+ <div
259
+ style={{
260
+ display: 'flex',
261
+ flexDirection: 'column',
262
+ alignItems: 'center',
263
+ gap: 20
264
+ }}
265
+ >
266
+ <div>This tooltip is opened programmatically</div>
267
+ <Button
268
+ onClick={() => {
269
+ setOpen(false);
270
+ setEnabled(false);
271
+ }}
272
+ >
273
+ Close
274
+ </Button>
275
+ </div>
276
+ }
277
+ withButton
278
+ >
279
+ Tooltip will be opened here
280
+ </Tooltip>
281
+ </>
282
+ ) : (
283
+ <Typography.Heading size="M">Switch timer ON</Typography.Heading>
284
+ )}
285
+ </>
286
+ );
287
+ }
288
+ ```
289
+
290
+ ### TooltipPositions
291
+
292
+ > Multiple Tooltips can be opened in the controlled mode only.
293
+
294
+ ```tsx
295
+ import { Button, Tooltip } from '@redislabsdev/redis-ui-components';
296
+ import { useViewMode } from '../../helpers/useViewMode';
297
+
298
+ function Render() {
299
+ const { inStory } = useViewMode();
300
+
301
+ return (
302
+ <>
303
+ <Tooltip open={inStory} content="Left" placement="left">
304
+ <Button>Left</Button>
305
+ </Tooltip>
306
+ <Tooltip open={inStory} content="Top" placement="top">
307
+ <Button>Top</Button>
308
+ </Tooltip>
309
+ <Tooltip open={inStory} content="Bottom" placement="bottom">
310
+ <Button>Bottom</Button>
311
+ </Tooltip>
312
+ <Tooltip open={inStory} content="Right" placement="right">
313
+ <Button>Right</Button>
314
+ </Tooltip>
315
+ </>
316
+ );
317
+ }
318
+ ```
319
+
320
+ ### TooltipAlign
321
+
322
+ > Multiple Tooltips can be opened in the controlled mode only.
323
+
324
+ ```tsx
325
+ import { Button, Tooltip } from '@redislabsdev/redis-ui-components';
326
+ import { useViewMode } from '../../helpers/useViewMode';
327
+
328
+ function Render() {
329
+ const { inStory } = useViewMode();
330
+
331
+ return (
332
+ <>
333
+ <Tooltip
334
+ open={inStory}
335
+ content={
336
+ <>
337
+ tooltip with <strong>align: end</strong> and <strong>alignOffset</strong>
338
+ </>
339
+ }
340
+ placement="top"
341
+ align="end"
342
+ alignOffset={-20}
343
+ >
344
+ <Button>align: end</Button>
345
+ </Tooltip>
346
+ <Tooltip
347
+ open={inStory}
348
+ content={
349
+ <>
350
+ tooltip with <strong>align: center</strong>
351
+ </>
352
+ }
353
+ placement="top"
354
+ align="center"
355
+ >
356
+ <Button>align: center</Button>
357
+ </Tooltip>
358
+ <Tooltip
359
+ open={inStory}
360
+ content={
361
+ <>
362
+ tooltip with <strong>align: start</strong>
363
+ </>
364
+ }
365
+ placement="top"
366
+ align="start"
367
+ >
368
+ <Button>align: start</Button>
369
+ </Tooltip>
370
+ </>
371
+ );
372
+ }
373
+ ```
374
+
375
+ ### LongText
376
+
377
+ > Long text in the tooltip content will be wrapped
378
+
379
+ ```tsx
380
+ import { Button, Tooltip } from '@redislabsdev/redis-ui-components';
381
+ import { useViewMode } from '../../helpers/useViewMode';
382
+
383
+ function Render() {
384
+ const { inStory } = useViewMode();
385
+
386
+ return (
387
+ <Tooltip
388
+ defaultOpen={inStory}
389
+ content="This is tooltip content with a really really really really really really really really really really really really long text"
390
+ >
391
+ <Button>Hover me</Button>
392
+ </Tooltip>
393
+ );
394
+ }
395
+ ```
396
+
397
+ ### CustomMaxWidth
398
+
399
+ > Custom `maxWidth` can be defined to make very long text laid out more consistently or to contain wider content
400
+
401
+ ```tsx
402
+ import { Button, Tooltip } from '@redislabsdev/redis-ui-components';
403
+ import { useViewMode } from '../../helpers/useViewMode';
404
+
405
+ function Render() {
406
+ const { inStory } = useViewMode();
407
+
408
+ return (
409
+ <Tooltip
410
+ defaultOpen={inStory}
411
+ maxWidth="1000rem"
412
+ content="Custom max width can be defined to make very long text laid out more consistently or contain wider content"
413
+ >
414
+ <Button>Hover me</Button>
415
+ </Tooltip>
416
+ );
417
+ }
418
+ ```
419
+
420
+ ### InteractiveTooltip
421
+
422
+ > If content of Tooltip should be reachable by mouse, `interactive` flag can be used.
423
+ > It prevents closing Tooltip, when mouse leaves trigger in direction to the tooltip.
424
+
425
+ ```tsx
426
+ import { Button, Tooltip } from '@redislabsdev/redis-ui-components';
427
+ import { fn } from '@storybook/test';
428
+
429
+ <Tooltip
430
+ content={
431
+ <>
432
+ If content of Tooltip should be reachable by mouse, <strong>interactive</strong> flag can be
433
+ used
434
+ <Tooltip.Card.Footer
435
+ actionButtonText="Click me"
436
+ linkText="Read me"
437
+ actionButtonHandler={fn()}
438
+ link="#"
439
+ />
440
+ </>
441
+ }
442
+ interactive
443
+ >
444
+ <Button>Hover me</Button>
445
+ </Tooltip>
446
+ ```
447
+
448
+ ### DisabledAndEmptyTooltip
449
+
450
+ > Tooltip with empty (falsy) content or tooltip with `disabled` flag will not be visible
451
+
452
+ ```tsx
453
+ import { Button, Tooltip } from '@redislabsdev/redis-ui-components';
454
+
455
+ <>
456
+ <Tooltip
457
+ content={
458
+ <>
459
+ Tooltip with empty (falsy) content or tooltip with <strong>disabled</strong> flag will not
460
+ be visible
461
+ </>
462
+ }
463
+ >
464
+ <Button>Hover me</Button>
465
+ </Tooltip>
466
+ <Tooltip content="Disabled" disabled open>
467
+ <Button>Disabled</Button>
468
+ </Tooltip>
469
+ <Tooltip content="" open>
470
+ <Button>Empty content</Button>
471
+ </Tooltip>
472
+ </>
473
+ ```
474
+
475
+ ### Portal
476
+
477
+ > Tooltip can be rendered without portal or with custom portal container, using `portal` prop
478
+
479
+ ```tsx
480
+ import { Button, Tooltip } from '@redislabsdev/redis-ui-components';
481
+ import { useViewMode } from '../../helpers/useViewMode';
482
+
483
+ function Render() {
484
+ const { inStory } = useViewMode();
485
+
486
+ return (
487
+ <>
488
+ <Tooltip
489
+ open={inStory}
490
+ maxWidth="20vw"
491
+ content="This tooltip is rendered with default portal (document.body)"
492
+ >
493
+ <Button>With portal</Button>
494
+ </Tooltip>
495
+ <Tooltip open={inStory} portal={null} content="This tooltip is rendered without portal">
496
+ <Button>No portal</Button>
497
+ </Tooltip>
498
+ </>
499
+ );
500
+ }
501
+ ```
502
+
503
+ ### ComposeTooltip
504
+
505
+ > Tooltip can be composed using `Tooltip.Trigger`, `Tooltip.Content` and `Tooltip.Content.Text` components
506
+
507
+ ```tsx
508
+ import { Tooltip } from '@redislabsdev/redis-ui-components';
509
+ import { InfoIcon } from '@redislabsdev/redis-ui-icons';
510
+ import { useViewMode } from '../../helpers/useViewMode';
511
+ import * as S from './Tooltip.style';
512
+
513
+ function Render() {
514
+ const { inStory } = useViewMode();
515
+
516
+ return (
517
+ <Tooltip.Compose defaultOpen={inStory}>
518
+ <Tooltip.Trigger withButton>
519
+ <InfoIcon />
520
+ Hover me
521
+ </Tooltip.Trigger>
522
+ <Tooltip.Content.Compose backgroundColor="#eff9f5">
523
+ <S.TooltipContentText>This tooltip is composed</S.TooltipContentText>
524
+ </Tooltip.Content.Compose>
525
+ </Tooltip.Compose>
526
+ );
527
+ }
528
+ ```
529
+
530
+ ### AsyncContent
531
+
532
+ > Tooltip with async content.
533
+ >
534
+ > Make sure to add `interactive`, to prevent Tooltip getting
535
+ > closed when content changes producing hover event.
536
+ >
537
+ > `⚠️` In general, try avoiding this approach and use a Popover instead, unless it's a must.
538
+
539
+ ```tsx
540
+ import { useEffect, useState } from 'react';
541
+ import { Button, Loader, Tooltip } from '@redislabsdev/redis-ui-components';
542
+
543
+ function AsyncContentComponent() {
544
+ const [loading, setLoading] = useState(true);
545
+
546
+ useEffect(() => {
547
+ const timeout = setTimeout(setLoading, 1500, false);
548
+
549
+ return () => clearTimeout(timeout);
550
+ }, []);
551
+
552
+ return loading ? (
553
+ <Loader size="15" />
554
+ ) : (
555
+ <div>
556
+ <p>Async content:</p>
557
+ <p>Loaded</p>
558
+ </div>
559
+ );
560
+ }
561
+
562
+ function Render() {
563
+ return (
564
+ <Tooltip interactive content={<AsyncContentComponent />}>
565
+ <Button>Get async content</Button>
566
+ </Tooltip>
567
+ );
568
+ }
569
+ ```
570
+
571
+ ### Tooltip.Card Playground
572
+
573
+ ```tsx
574
+ import { Tooltip } from '@redislabsdev/redis-ui-components';
575
+
576
+ <Tooltip
577
+ open
578
+ content={
579
+ <Tooltip.Card
580
+ title="Tooltip Card"
581
+ text="Tooltip Card displays formatted content"
582
+ link="#"
583
+ actionButtonHandler={() => {}}
584
+ actionButtonText="Action"
585
+ />
586
+ }
587
+ >
588
+ <span style={{ marginTop: 120 }} />
589
+ </Tooltip>
590
+ ```
591
+
592
+ ### Tooltip.Card ComposeCard
593
+
594
+ > `Tooltip.Card` can be composed of `Header`, `Body` and `Footer` component
595
+
596
+ ```tsx
597
+ import { Button, Tooltip } from '@redislabsdev/redis-ui-components';
598
+ import { useViewMode } from '../../helpers/useViewMode';
599
+
600
+ function Render() {
601
+ const { inStory } = useViewMode();
602
+
603
+ return (
604
+ <Tooltip
605
+ defaultOpen={inStory}
606
+ interactive
607
+ content={
608
+ <Tooltip.Card.Compose>
609
+ <Tooltip.Card.Header.Compose>
610
+ <Tooltip.Card.Header.Title>Custom Header title</Tooltip.Card.Header.Title>
611
+ </Tooltip.Card.Header.Compose>
612
+ <Tooltip.Card.Body.Compose>
613
+ <Tooltip.Card.Body.Text>Custom Body text</Tooltip.Card.Body.Text>
614
+ </Tooltip.Card.Body.Compose>
615
+ <Tooltip.Card.Footer.Compose>
616
+ <Button>Custom Footer button</Button>
617
+ </Tooltip.Card.Footer.Compose>
618
+ </Tooltip.Card.Compose>
619
+ }
620
+ >
621
+ <Button>Hover me</Button>
622
+ </Tooltip>
623
+ );
624
+ }
625
+ ```
626
+
627
+ ## Notes
628
+
629
+ - `TooltipProvider` defaults `openDelayDuration` to `0`.
630
+ - `Tooltip.Content` hides itself when `content` is falsy.
631
+ - `Tooltip.Trigger` can wrap plain text, SVG, or multi-element triggers by setting `withButton`.
632
+ - `Tooltip.Compose` supports controlled and uncontrolled open state.
633
+ - `Tooltip.Content.Compose` defaults `placement` to `top`, `sideOffset` to `5`, `portal` to `document.body`, and `interactive` to `false`.
634
+ - `Tooltip.Card.Header` hides the close button by default.
635
+ - `Tooltip.Card.Footer` renders nothing when both `link` and `actionButtonHandler` are missing.
636
+ - For async tooltip content, prefer `Popover` unless the tooltip interaction is required.