@czi-sds/mcp 0.2.2 → 0.3.0
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/data/zeroheight-cache.json +5195 -0
- package/data/zeroheight-exports/Accordion.md +675 -0
- package/data/zeroheight-exports/Banner.md +576 -0
- package/data/zeroheight-exports/Borders.md +118 -0
- package/data/zeroheight-exports/Buttons.md +2260 -0
- package/data/zeroheight-exports/Callout.md +756 -0
- package/data/zeroheight-exports/Colors.md +633 -0
- package/data/zeroheight-exports/Content-Card.md +162 -0
- package/data/zeroheight-exports/Contributing-to-SDS.md +99 -0
- package/data/zeroheight-exports/Control-Inputs.md +2066 -0
- package/data/zeroheight-exports/Corners.md +112 -0
- package/data/zeroheight-exports/Cover-page.md +4 -0
- package/data/zeroheight-exports/Dialog.md +1133 -0
- package/data/zeroheight-exports/Downloads.md +121 -0
- package/data/zeroheight-exports/Drop-Shadows.md +80 -0
- package/data/zeroheight-exports/Dropdown-Input.md +1149 -0
- package/data/zeroheight-exports/Dropdown-Menu.md +3787 -0
- package/data/zeroheight-exports/Element-Status-Tracker.md +268 -0
- package/data/zeroheight-exports/Field-Inputs.md +965 -0
- package/data/zeroheight-exports/Filters.md +868 -0
- package/data/zeroheight-exports/Getting-Started.md +1296 -0
- package/data/zeroheight-exports/Hero.md +256 -0
- package/data/zeroheight-exports/Icons.md +432 -0
- package/data/zeroheight-exports/Intent.md +47 -0
- package/data/zeroheight-exports/Introduction-to-Bases.md +36 -0
- package/data/zeroheight-exports/Introduction-to-Cells.md +36 -0
- package/data/zeroheight-exports/Introduction-to-DNA.md +36 -0
- package/data/zeroheight-exports/Introduction-to-Genes.md +36 -0
- package/data/zeroheight-exports/Introduction.md +116 -0
- package/data/zeroheight-exports/Link.md +373 -0
- package/data/zeroheight-exports/Lists.md +617 -0
- package/data/zeroheight-exports/Loading-Indicator.md +38 -0
- package/data/zeroheight-exports/Navigation.md +853 -0
- package/data/zeroheight-exports/Notification.md +858 -0
- package/data/zeroheight-exports/Panel.md +862 -0
- package/data/zeroheight-exports/README.md +124 -0
- package/data/zeroheight-exports/Responsive-Design.md +275 -0
- package/data/zeroheight-exports/Search-Input.md +54 -0
- package/data/zeroheight-exports/Search.md +609 -0
- package/data/zeroheight-exports/Segmented-Control.md +561 -0
- package/data/zeroheight-exports/Spacing.md +298 -0
- package/data/zeroheight-exports/Table.md +4832 -0
- package/data/zeroheight-exports/Tabs.md +773 -0
- package/data/zeroheight-exports/Tags.md +1025 -0
- package/data/zeroheight-exports/Text-Link.md +185 -0
- package/data/zeroheight-exports/Theming.md +313 -0
- package/data/zeroheight-exports/Tooltips.md +1564 -0
- package/data/zeroheight-exports/Typography.md +769 -0
- package/dist/stdio.js +188 -0
- package/package.json +4 -3
|
@@ -0,0 +1,1564 @@
|
|
|
1
|
+
# Tooltips
|
|
2
|
+
|
|
3
|
+
Tooltips are used throughout the UI and appear whenever users hover over elements that require additional context, instructions, or details.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
## Tooltip Variants
|
|
8
|
+
|
|
9
|
+
| Tooltips are always used in conjunction with other elements when there is a need to clarify the element's function further, provide instructions, or display additional details to the user. The variant used depends on the element it is tied to and the area in the UI in which it is located. Follow the usage criteria accompanying each variant as a guide for selecting the correct Tooltip for any given use case. | | **Jump to variant:** Tooltip Condensed |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Tooltip
|
|
15
|
+
|
|
16
|
+
| | In Figma | | | Meets Accessibility | | | In napari hub + .org Codebases |
|
|
17
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
18
|
+
|
|
19
|
+
Use to display supplementary information such as definitions, instructions, or expanded details for elements, such as in combination with Tags to provide definitions of the parameter on the Tag.
|
|
20
|
+
|
|
21
|
+
Use the `title` and `footer` props to add optional text to the Tooltip to communicate additional usage or clarifying details such as further instructions for using the element the Tooltip is connected to.
|
|
22
|
+
|
|
23
|
+
Use the `placement` prop to indicate from which direction the Tooltip will appear on hover in relation to the element it is connected to. For example, `placement: top` will result in the Tooltip appearing above the element with its directional arrow in the center of the Tooltip, pointing down at the element. See the Placement Variations section for more details.
|
|
24
|
+
|
|
25
|
+
The Tooltip is positioned relative to the on-screen element as opposed to relative to the user's cursor.
|
|
26
|
+
|
|
27
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
### Tooltip Spacing
|
|
40
|
+
|
|
41
|
+
These rules establish how much margin should exist between and around elements.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### Placement Variations
|
|
46
|
+
|
|
47
|
+
The `placement` prop indicates from which direction the Tooltip will appear on hover in relation to the element it is connected to. For example, `placement: top` will result in the Tooltip appearing above the element with its directional arrow in the center of the Tooltip, pointing down at the element. There are 12 possible variations to choose from depending on the design's need.
|
|
48
|
+
|
|
49
|
+
The Tooltip is positioned relative to the on-screen element as opposed to relative to the user's cursor.
|
|
50
|
+
|
|
51
|
+
| **Bottom-start** | **Bottom** | **Bottom-End** |
|
|
52
|
+
| --- | --- | --- |
|
|
53
|
+
|
|
54
|
+
| **Left-start** | **Left** | **Left-end** |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
|
|
57
|
+
| **Right-start** | **Right** | **Right-end** |
|
|
58
|
+
| --- | --- | --- |
|
|
59
|
+
|
|
60
|
+
| **Top-Start** | **Top** | **Top-end** |
|
|
61
|
+
| --- | --- | --- |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Condensed Tooltip
|
|
66
|
+
|
|
67
|
+
| | In Figma | | | Meets Accessibility | | | In napari hub + .org Codebases |
|
|
68
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
69
|
+
|
|
70
|
+
Use to display smaller bits of text, not full sentences or descriptions, similar to a label, but only viewable on hover. Most often used in Charts, Tables, and Data Visualizations (documentation coming soon).
|
|
71
|
+
|
|
72
|
+
A colored indicator can be included using the `indicator` prop when using color will help clarify for users what the label is connected to.
|
|
73
|
+
|
|
74
|
+
The Condensed Tooltip is positioned relative to the user's cursor as opposed to the on-screen element it's connected to.
|
|
75
|
+
|
|
76
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### Condensed Tooltip Spacing
|
|
83
|
+
|
|
84
|
+
These rules establish how much margin should exist between and around elements.
|
|
85
|
+
|
|
86
|
+
## Code
|
|
87
|
+
|
|
88
|
+
## Dropdown Input Component
|
|
89
|
+
|
|
90
|
+
| Below you will find an interactive Storybook iframe for Tooltips. Tabs within each iframe provide a different set of tools: The Controls tab allows you to see and adjust all available props. The Actions tab shows you data displayed by event handler arguments. | | **Jump to component:** Tooltip TooltipCondensed |
|
|
91
|
+
| --- | --- | --- |
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
>These components appear as they are in the default SDS codebase. Once imported into the napari hub or napari.org codebases, use a theme file to enable the napari visual appearance customization.
|
|
96
|
+
|
|
97
|
+
### Tooltip
|
|
98
|
+
|
|
99
|
+
Storybook
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### TooltipCondensed
|
|
104
|
+
|
|
105
|
+
Storybook
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
Tooltips are used throughout the UI and appear whenever users hover over elements that require additional context, instructions, or details.
|
|
110
|
+
|
|
111
|
+
## Overview
|
|
112
|
+
|
|
113
|
+
## Tooltip Variants
|
|
114
|
+
|
|
115
|
+
| Tooltips are always used in conjunction with other elements when there is a need to further clarify the element's function, provide instructions, or display additional details to the user. The variant used depends on the element it is tied to and the area in the UI in which it is located. Follow the usage criteria accompanying each variant as a guide for selecting the correct Tooltip for any given use case. | | **Jump to variant:** Dark Light Condensed Table |
|
|
116
|
+
| --- | --- | --- |
|
|
117
|
+
|
|
118
|
+
### Visual Preview
|
|
119
|
+
|
|
120
|
+
Use the links below to jump to information on a specific Tooltip variant:
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Tooltip
|
|
125
|
+
|
|
126
|
+
| | In Figma | | | Meets Accessibility | | | In CZ GEN EPI Codebase |
|
|
127
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
128
|
+
|
|
129
|
+
### Dark Tooltip
|
|
130
|
+
|
|
131
|
+
Use in conjunction with actionary UI elements such as Icon Buttons or Segmented Control to display information on what that element does, especially when there is only an icon being used to communicate UI action.
|
|
132
|
+
|
|
133
|
+
Use the `subtitle` prop to add optional text to the Tooltip to communicate additional usage or clarifying details such as further instructions for using the element the Tooltip is connected to.
|
|
134
|
+
|
|
135
|
+
Use the `placement` prop to indicate from which direction the Tooltip will appear on hover in relation to the element it is connected to. For example, `placement: top` will result in the Tooltip appearing above the element with its directional arrow in the center of Tooltip, pointing down at the element. See Placement Variations section for more details.
|
|
136
|
+
|
|
137
|
+
The Tooltip is positioned relative to the on-screen element as opposed to relative to the user's cursor.
|
|
138
|
+
|
|
139
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
### Light Tooltip
|
|
148
|
+
|
|
149
|
+
Use to display supplementary information such as definitions, instructions, or expanded details which require more text in the Tooltip. The white background on the Tooltip makes longer blocks of copy easier for the user to read. Use the `width` prop to expand the width of the Light Tooltip to a max-width of 550px if there is a need to display particularly long blocks of copy.
|
|
150
|
+
|
|
151
|
+
Use the `placement` prop to indicate from which direction the Tooltip will appear on hover in relation to the element it is connected to. For example, `placement: top` will result in the Tooltip appearing above the element with its directional arrow in the center of Tooltip, pointing down at the element. See Placement Variations section for more details.
|
|
152
|
+
|
|
153
|
+
The Tooltip is positioned relative to the on-screen element as opposed to relative to the user's cursor.
|
|
154
|
+
|
|
155
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
### Tooltip Spacing
|
|
164
|
+
|
|
165
|
+
These rules establish how much margin should exist between and around elements.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
### Placement Variations
|
|
170
|
+
|
|
171
|
+
The `placement` prop indicates from which direction the Tooltip will appear on hover in relation to the element it is connected to. For example, `placement: top` will result in the Tooltip appearing above the element with its directional arrow in the center of the Tooltip, pointing down at the element. There are 12 possible variations to choose from depending on the design's need.
|
|
172
|
+
|
|
173
|
+
The Tooltip is positioned relative to the on-screen element as opposed to relative to the user's cursor.
|
|
174
|
+
|
|
175
|
+
| **Bottom-start** | **Bottom** | **Bottom-End** |
|
|
176
|
+
| --- | --- | --- |
|
|
177
|
+
|
|
178
|
+
| **Left-start** | **Left** | **Left-end** |
|
|
179
|
+
| --- | --- | --- |
|
|
180
|
+
|
|
181
|
+
| **Right-start** | **Right** | **Right-end** |
|
|
182
|
+
| --- | --- | --- |
|
|
183
|
+
|
|
184
|
+
| **Top-Start** | **Top** | **Top-end** |
|
|
185
|
+
| --- | --- | --- |
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Condensed Tooltip
|
|
190
|
+
|
|
191
|
+
| | In Figma | | | Meets Accessibility | | | In CZ GEN EPI Codebase |
|
|
192
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
193
|
+
|
|
194
|
+
Use to display smaller bits of text, not full sentences or descriptions, similar to a label, but only viewable on hover. Most often used in Charts, Tables, and Data Visualizations.
|
|
195
|
+
|
|
196
|
+
Use the Condensed Tooltip without an indicator in CZ GEN EPI to display detailed information on Data Visualizations.
|
|
197
|
+
|
|
198
|
+
A colored indicator can be included using the `indicator` prop when using color will help clarify for users what the label is connected to. Use the Condensed Tooltip with an indicator in CZ GEN EPI to display legend information on Data Visualizations.
|
|
199
|
+
|
|
200
|
+
The Condensed Tooltip is positioned relative to the user's cursor as opposed to the on-screen element it's connected to.
|
|
201
|
+
|
|
202
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
### Condensed Tooltip Spacing
|
|
211
|
+
|
|
212
|
+
These rules establish how much margin should exist between and around elements.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Table Tooltip
|
|
217
|
+
|
|
218
|
+
| | In Figma | | | Meets Accessibility | | | In CZ GEN EPI Codebase |
|
|
219
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
220
|
+
|
|
221
|
+
Used in CZ GEN EPI to display complex, dense information that would benefit from being shown in a table format such as additional data or context connected to datasets in Charts, Tables, and Data Visualizations.
|
|
222
|
+
|
|
223
|
+
The content in the Table Tooltip is determined by the `[array]` passed into the `data` prop. The `[array]` will determine optional section headers, whether a section is disabled or not, as well as each content row's label and item value. There can be as many sections and content rows per section as needed. See the Data Format section below for details about configuring the `[array]`.
|
|
224
|
+
|
|
225
|
+
The Table Tooltip is positioned relative to the user's cursor as opposed to the on-screen element it's connected to.
|
|
226
|
+
|
|
227
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
### Data Format
|
|
238
|
+
|
|
239
|
+
Use the following configuration for the `[array]` passed into the `data` prop:
|
|
240
|
+
|
|
241
|
+
```js
|
|
242
|
+
data = [
|
|
243
|
+
{
|
|
244
|
+
// section with a header
|
|
245
|
+
dataRows: [
|
|
246
|
+
{
|
|
247
|
+
label: "Label",
|
|
248
|
+
value: "Item",
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
label: "Label",
|
|
252
|
+
value: "Item",
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
label: "Label",
|
|
256
|
+
value: "Item",
|
|
257
|
+
}
|
|
258
|
+
],
|
|
259
|
+
label: "Section One", // optional
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
// section with no header
|
|
263
|
+
dataRows: [
|
|
264
|
+
{
|
|
265
|
+
label: "Label",
|
|
266
|
+
value: "Item",
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
label: "Label",
|
|
270
|
+
value: "Item",
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
label: "Label",
|
|
274
|
+
value: "Item",
|
|
275
|
+
}
|
|
276
|
+
],
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
// disabled section with no header
|
|
280
|
+
dataRows: [
|
|
281
|
+
{
|
|
282
|
+
label: "Label",
|
|
283
|
+
value: "Item",
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
label: "Label",
|
|
287
|
+
value: "Item",
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
label: "Label",
|
|
291
|
+
value: "Item",
|
|
292
|
+
}
|
|
293
|
+
],
|
|
294
|
+
disabled: true
|
|
295
|
+
},
|
|
296
|
+
];
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
### Table Tooltip Spacing
|
|
302
|
+
|
|
303
|
+
These rules establish how much margin should exist between and around elements.
|
|
304
|
+
|
|
305
|
+
## Code
|
|
306
|
+
|
|
307
|
+
## Dropdown Input Component
|
|
308
|
+
|
|
309
|
+
| Below you will find an interactive Storybook iframe for Tooltips. Tabs within each iframe provide a different set of tools: The Controls tab allows you to see and adjust all available props. The Actions tab shows you data displayed by event handler arguments. | | **Jump to component:** Tooltip TooltipCondensed TooltipTable |
|
|
310
|
+
| --- | --- | --- |
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
>This component appears as it is in the default SDS codebase. Once imported into the CZ GEN EPI codebase, use a theme file to enable the CZ GEN EPI visual appearance customization.
|
|
315
|
+
|
|
316
|
+
### Tooltip
|
|
317
|
+
|
|
318
|
+
Storybook
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
### TooltipCondensed
|
|
323
|
+
|
|
324
|
+
Storybook
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
### TooltipTable
|
|
329
|
+
|
|
330
|
+
Storybook
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
Tooltips are used throughout the UI and appear whenever users hover over elements that require additional context, instructions, or details.
|
|
335
|
+
|
|
336
|
+
## Overview
|
|
337
|
+
|
|
338
|
+
## Tooltip Variants
|
|
339
|
+
|
|
340
|
+
| Tooltips are always used in conjunction with other elements when there is a need to further clarify the element's function, provide instructions, or display additional details to the user. The variant used depends on the element it is tied to and the area in the UI in which it is located. Follow the usage criteria accompanying each variant as a guide for selecting the correct Tooltip for any given use case. | | **Jump to variant:** Dark Light Condensed Table |
|
|
341
|
+
| --- | --- | --- |
|
|
342
|
+
|
|
343
|
+
### Visual Preview
|
|
344
|
+
|
|
345
|
+
Use the links below to jump to information on a specific Tooltip variant:
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## Tooltip
|
|
350
|
+
|
|
351
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
352
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
353
|
+
|
|
354
|
+
### Dark Tooltip
|
|
355
|
+
|
|
356
|
+
Use in conjunction with actionary UI elements such as Icon Buttons or Segmented Control to display information on what that element does, especially when there is only an icon being used to communicate UI action.
|
|
357
|
+
|
|
358
|
+
Use the `subtitle` prop to add optional text to the Tooltip to communicate additional usage or clarifying details such as further instructions for using the element the Tooltip is connected to.
|
|
359
|
+
|
|
360
|
+
Use the `placement` prop to indicate from which direction the Tooltip will appear on hover in relation to the element it is connected to. For example, `placement: top` will result in the Tooltip appearing above the element with its directional arrow in the center of Tooltip, pointing down at the element. See Placement Variations section for more details.
|
|
361
|
+
|
|
362
|
+
The Tooltip is positioned relative to the on-screen element as opposed to relative to the user's cursor.
|
|
363
|
+
|
|
364
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
### Light Tooltip
|
|
373
|
+
|
|
374
|
+
Use to display supplementary information such as definitions, instructions, or expanded details which require more text in the Tooltip. The white background on the Tooltip makes longer blocks of copy easier for the user to read. Use the `width` prop to expand the width of the Light Tooltip to a max width of 550px if there is a need to display particularly long blocks of copy.
|
|
375
|
+
|
|
376
|
+
Use the `placement` prop to indicate from which direction the Tooltip will appear on hover in relation to the element it is connected to. For example, `placement: top` will result in the Tooltip appearing above the element with its directional arrow in the center of Tooltip, pointing down at the element. See Placement Variations section for more details.
|
|
377
|
+
|
|
378
|
+
The Tooltip is positioned relative to the on-screen element as opposed to relative to the user's cursor.
|
|
379
|
+
|
|
380
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
### Tooltip Spacing
|
|
389
|
+
|
|
390
|
+
These rules establish how much margin should exist between and around elements.
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
### Placement Variations
|
|
395
|
+
|
|
396
|
+
The `placement` prop indicates from which direction the Tooltip will appear on hover in relation to the element it is connected to. For example, `placement: top` will result in the Tooltip appearing above the element with its directional arrow in the center of the Tooltip, pointing down at the element. There are 12 possible variations to choose from depending on the design's need.
|
|
397
|
+
|
|
398
|
+
The Tooltip is positioned relative to the on-screen element as opposed to relative to the user's cursor.
|
|
399
|
+
|
|
400
|
+
| **Bottom-start** | **Bottom** | **Bottom-End** |
|
|
401
|
+
| --- | --- | --- |
|
|
402
|
+
|
|
403
|
+
| **Left-start** | **Left** | **Left-end** |
|
|
404
|
+
| --- | --- | --- |
|
|
405
|
+
|
|
406
|
+
| **Right-start** | **Right** | **Right-end** |
|
|
407
|
+
| --- | --- | --- |
|
|
408
|
+
|
|
409
|
+
| **Top-Start** | **Top** | **Top-end** |
|
|
410
|
+
| --- | --- | --- |
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## Condensed Tooltip
|
|
415
|
+
|
|
416
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
417
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
418
|
+
|
|
419
|
+
Use to display smaller bits of text, not full sentences or descriptions, similar to a label, but only viewable on hover. Most often used in Charts, Tables, and Data Visualizations.
|
|
420
|
+
|
|
421
|
+
Use the Condensed Tooltip without an indicator in CZ ID to display detailed information on Data Visualizations.
|
|
422
|
+
|
|
423
|
+
A colored indicator can be included using the `indicator` prop when using color will help clarify for users what the label is connected to. Use the Condensed Tooltip with an indicator in CZ ID to display legend information on Data Visualizations.
|
|
424
|
+
|
|
425
|
+
The Condensed Tooltip is positioned relative to the user's cursor as opposed to the on-screen element it's connected to.
|
|
426
|
+
|
|
427
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
### Condensed Tooltip Spacing
|
|
434
|
+
|
|
435
|
+
These rules establish how much margin should exist between and around elements.
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
## Table Tooltip
|
|
440
|
+
|
|
441
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
442
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
443
|
+
|
|
444
|
+
Used in CZ ID to display complex, dense information that would benefit from being shown in a table format such as additional data or context connected to datasets in Charts, Tables, and Data Visualizations.
|
|
445
|
+
|
|
446
|
+
The content in the Table Tooltip is determined by the `[array]` passed into the `data` prop. The `[array]` will determine optional section headers, whether a section is disabled or not, as well as each content row's label and item value. There can be as many sections and content rows per section as needed. See the Data Format section below for details about configuring the `[array]`.
|
|
447
|
+
|
|
448
|
+
The Table Tooltip is positioned relative to the user's cursor as opposed to the on-screen element it's connected to.
|
|
449
|
+
|
|
450
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
|
|
456
|
+
---
|
|
457
|
+
|
|
458
|
+
---
|
|
459
|
+
|
|
460
|
+
### Data Format
|
|
461
|
+
|
|
462
|
+
Use the following configuration for the `[array]` passed into the `data` prop:
|
|
463
|
+
|
|
464
|
+
```js
|
|
465
|
+
data = [
|
|
466
|
+
{
|
|
467
|
+
// section with a header
|
|
468
|
+
dataRows: [
|
|
469
|
+
{
|
|
470
|
+
label: "Label",
|
|
471
|
+
value: "Item",
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
label: "Label",
|
|
475
|
+
value: "Item",
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
label: "Label",
|
|
479
|
+
value: "Item",
|
|
480
|
+
}
|
|
481
|
+
],
|
|
482
|
+
label: "Section One", // optional
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
// section with no header
|
|
486
|
+
dataRows: [
|
|
487
|
+
{
|
|
488
|
+
label: "Label",
|
|
489
|
+
value: "Item",
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
label: "Label",
|
|
493
|
+
value: "Item",
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
label: "Label",
|
|
497
|
+
value: "Item",
|
|
498
|
+
}
|
|
499
|
+
],
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
// disabled section with no header
|
|
503
|
+
dataRows: [
|
|
504
|
+
{
|
|
505
|
+
label: "Label",
|
|
506
|
+
value: "Item",
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
label: "Label",
|
|
510
|
+
value: "Item",
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
label: "Label",
|
|
514
|
+
value: "Item",
|
|
515
|
+
}
|
|
516
|
+
],
|
|
517
|
+
disabled: true
|
|
518
|
+
},
|
|
519
|
+
];
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
---
|
|
523
|
+
|
|
524
|
+
### Table Tooltip Spacing
|
|
525
|
+
|
|
526
|
+
These rules establish how much margin should exist between and around elements.
|
|
527
|
+
|
|
528
|
+
## Code
|
|
529
|
+
|
|
530
|
+
## Dropdown Input Component
|
|
531
|
+
|
|
532
|
+
| Below you will find an interactive Storybook iframe for Tooltips. Tabs within each iframe provide a different set of tools: The Controls tab allows you to see and adjust all available props. The Actions tab shows you data displayed by event handler arguments. | | **Jump to component:** Tooltip TooltipCondensed TooltipTable |
|
|
533
|
+
| --- | --- | --- |
|
|
534
|
+
|
|
535
|
+
---
|
|
536
|
+
|
|
537
|
+
### Tooltip
|
|
538
|
+
|
|
539
|
+
Storybook
|
|
540
|
+
|
|
541
|
+
---
|
|
542
|
+
|
|
543
|
+
### TooltipCondensed
|
|
544
|
+
|
|
545
|
+
Storybook
|
|
546
|
+
|
|
547
|
+
---
|
|
548
|
+
|
|
549
|
+
### TooltipTable
|
|
550
|
+
|
|
551
|
+
Storybook
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
---
|
|
556
|
+
|
|
557
|
+
Tooltips are used throughout the UI and appear whenever users hover over elements that require additional context, instructions, or details.
|
|
558
|
+
|
|
559
|
+
## Guidelines
|
|
560
|
+
|
|
561
|
+
## Tooltip Components
|
|
562
|
+
|
|
563
|
+
| Tooltips are always used in conjunction with other elements when there is a need to further clarify the element's function, provide instructions, or display additional details to the user. The variant used depends on the element that triggers it and where it's located in the interface. | | **Jump to variant:** Tooltip Condensed Tooltip Table Tooltip |
|
|
564
|
+
| --- | --- | --- |
|
|
565
|
+
|
|
566
|
+
### Visual Preview
|
|
567
|
+
|
|
568
|
+
---
|
|
569
|
+
|
|
570
|
+
## Tooltip
|
|
571
|
+
|
|
572
|
+
| | In Figma | | | Meets Accessibility | | | In Code |
|
|
573
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
574
|
+
|
|
575
|
+
### Tooltip Types
|
|
576
|
+
|
|
577
|
+
There are two available Tooltip types: Short and Long.
|
|
578
|
+
|
|
579
|
+
Each Tooltip type can optionally be displayed using an inverted color scheme for better contrast on certain backgrounds.
|
|
580
|
+
|
|
581
|
+
---
|
|
582
|
+
|
|
583
|
+
### Live Instance
|
|
584
|
+
|
|
585
|
+
Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
|
|
586
|
+
|
|
587
|
+
Default
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
### Tooltip – Short
|
|
592
|
+
|
|
593
|
+
Use in conjunction with action UI elements like Buttons or Segmented Control to display information about interacting with that element.
|
|
594
|
+
|
|
595
|
+
A subtitle may be added to communicate additional details, like instructions for using the element connected to the Tooltip.
|
|
596
|
+
|
|
597
|
+
| Default | Default (inverted) | Default + Subtitle | Default + Subtitle (inverted) |
|
|
598
|
+
| --- | --- | --- | --- |
|
|
599
|
+
|
|
600
|
+
---
|
|
601
|
+
|
|
602
|
+
### Tooltip – Long
|
|
603
|
+
|
|
604
|
+
Use to display supplementary information like definitions, instructions, or expanded details which require more space for text. The width can be increased up to `550px`.
|
|
605
|
+
|
|
606
|
+
| Default | Default (inverted) |
|
|
607
|
+
| --- | --- |
|
|
608
|
+
|
|
609
|
+
---
|
|
610
|
+
|
|
611
|
+
### Tooltip Spacing
|
|
612
|
+
|
|
613
|
+
The Tooltip and its triggering element have a standard margin between them.
|
|
614
|
+
|
|
615
|
+
---
|
|
616
|
+
|
|
617
|
+
### Placement Variations
|
|
618
|
+
|
|
619
|
+
A Tooltip appears in one of twelve positions relative to the element it is tied to. For example, a position of `bottom` will appear **below** the trigger element.
|
|
620
|
+
|
|
621
|
+
| Bottom-start | Bottom | Bottom-end |
|
|
622
|
+
| --- | --- | --- |
|
|
623
|
+
|
|
624
|
+
| Left-start | Left | Left-end |
|
|
625
|
+
| --- | --- | --- |
|
|
626
|
+
|
|
627
|
+
| Right-start | Right | Right-end |
|
|
628
|
+
| --- | --- | --- |
|
|
629
|
+
|
|
630
|
+
| Top-start | Top | Top-end |
|
|
631
|
+
| --- | --- | --- |
|
|
632
|
+
|
|
633
|
+
---
|
|
634
|
+
|
|
635
|
+
## Condensed Tooltip
|
|
636
|
+
|
|
637
|
+
| | In Figma | | | Meets Accessibility | | | In Code |
|
|
638
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
639
|
+
|
|
640
|
+
### Live Instance
|
|
641
|
+
|
|
642
|
+
Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
|
|
643
|
+
|
|
644
|
+
Default
|
|
645
|
+
|
|
646
|
+
---
|
|
647
|
+
|
|
648
|
+
### Overview
|
|
649
|
+
|
|
650
|
+
Use Condensed Tooltip to display small amounts of text, not full sentences or descriptions. It's similar to a label, but only viewable on hover — most often used in data visualizations and Tables.
|
|
651
|
+
|
|
652
|
+
The Condensed Tooltip is positioned relative to the user's cursor rather than its triggering element. A colored indicator can be included in the Tooltip to help clarify what element the Tooltip is related to.
|
|
653
|
+
|
|
654
|
+
The Condensed Tooltip can optionally be displayed using an inverted color scheme for better contrast on certain backgrounds.
|
|
655
|
+
|
|
656
|
+
| Default | Default (inverted) | Default + Indicator | Default + Indicator (inverted) |
|
|
657
|
+
| --- | --- | --- | --- |
|
|
658
|
+
|
|
659
|
+
---
|
|
660
|
+
|
|
661
|
+
### Condensed Tooltip Spacing
|
|
662
|
+
|
|
663
|
+
The Condensed Tooltip and its triggering element have a standard margin between them.
|
|
664
|
+
|
|
665
|
+
---
|
|
666
|
+
|
|
667
|
+
## Table Tooltip
|
|
668
|
+
|
|
669
|
+
| | In Figma | | | Meets Accessibility | | | In Code |
|
|
670
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
671
|
+
|
|
672
|
+
### Live Instance
|
|
673
|
+
|
|
674
|
+
Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
|
|
675
|
+
|
|
676
|
+
Live Preview
|
|
677
|
+
|
|
678
|
+
---
|
|
679
|
+
|
|
680
|
+
### Overview
|
|
681
|
+
|
|
682
|
+
Use Table Tooltip to display complex information that benefits from being shown in a table format. A Table Tooltip can contain as many sections as necessary and can optionally include section headers.
|
|
683
|
+
|
|
684
|
+
By default, Item values are aligned right but can be aligned left.
|
|
685
|
+
|
|
686
|
+
The Table Tooltip is positioned relative to the user's cursor rather than its triggering element
|
|
687
|
+
|
|
688
|
+
| 1 Section | 1 Section + Section Headers | 2 Sections + Section Headers |
|
|
689
|
+
| --- | --- | --- |
|
|
690
|
+
|
|
691
|
+
---
|
|
692
|
+
|
|
693
|
+
### Table Tooltip Spacing
|
|
694
|
+
|
|
695
|
+
The Table Tooltip and its triggering element have a standard margin between them.
|
|
696
|
+
|
|
697
|
+
## Code
|
|
698
|
+
|
|
699
|
+
## Tooltip Components
|
|
700
|
+
|
|
701
|
+
| `Tooltips` are always used in conjunction with other elements when there is a need to further clarify the element's function, provide instructions, or display additional details to the user. The variant used depends on the element that triggers it and where it's located in the interface. | | **Jump to variant:** Tooltip TooltipCondensed TooltipTable |
|
|
702
|
+
| --- | --- | --- |
|
|
703
|
+
|
|
704
|
+
### Visual Preview
|
|
705
|
+
|
|
706
|
+
>**Note:** The code examples below must install dependencies before displaying and may take extra time to load
|
|
707
|
+
|
|
708
|
+
---
|
|
709
|
+
|
|
710
|
+
## Tooltip
|
|
711
|
+
|
|
712
|
+
### SDS Source Code
|
|
713
|
+
|
|
714
|
+
The component's source code in the SDS codebase can be found here.
|
|
715
|
+
|
|
716
|
+
### SDS vs MUI
|
|
717
|
+
|
|
718
|
+
The SDS `Tooltip` component has a number of preset options in addition to, or that modify, the MUI options:
|
|
719
|
+
|
|
720
|
+
* **`sdsStyle`** **:** This prop takes either `light` (the default if not specified), or `dark`. Each of these "unlocks" additional options for other props; see below bullets:
|
|
721
|
+
* **`width`****:** SDS `Tooltip`'s `width` prop accepts `"default"`(unsurprisingly, the default!) which limits the maximum width to 250px. Additionally, only if `sdsStyle="light"` then it also accepts a value of `"wide"`, which translates to a maximum width of 550px. Compare these string options to MUI's `width` prop, which takes a number for the width in pixels.
|
|
722
|
+
* **`subtitle`****:** This SDS-specific prop is only available for dark-styled `Tooltips` (`sdsStyle="dark"`) . It takes a string value that displays below the text set by the `title` prop.
|
|
723
|
+
* **`arrowOffset`****:** This SDS-only prop takes a negative or positive value equivalent to the number of pixels by which to move the arrow (if `arrow={true}`) either left or right, respectively. It is possible though for this to move the arrow outside of the `Tooltip` edge itself, so be aware of the `width` setting as well as the length of text within the `Tooltip`.
|
|
724
|
+
|
|
725
|
+
### MUI Documentation
|
|
726
|
+
|
|
727
|
+
Documentation for the underlying MUI component can be found here.
|
|
728
|
+
|
|
729
|
+
### Props
|
|
730
|
+
|
|
731
|
+
Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
|
|
732
|
+
|
|
733
|
+
| Name | Type | Default | Description |
|
|
734
|
+
| --- | --- | --- | --- |
|
|
735
|
+
| `arrow` | `boolean` | `false` | If `true`, adds an arrow to the tooltip. |
|
|
736
|
+
| `arrowOffset` | `number` | `0` | ArrowOffset changes the position of the tooltip arrow and can be any numeric value within `[-120, 120]`. Exceeding the tooltip width removes the arrow. |
|
|
737
|
+
| `placement` | `"bottom-start"` `| "bottom"` `| "bottom-end"` `| "left-start"` `| "left"` `| "left-end"` `| "right-start"` `| "right"` `| "right-end"` `| "top-start"` `| "top"` `| "top-end"` | `"bottom"` | Tooltip placement. |
|
|
738
|
+
| `sdsStyle` | `"light" | "dark"` | `"light"` | Style of the component. |
|
|
739
|
+
| `subtitle` | `string` | `-` | Tooltip subtitle text. |
|
|
740
|
+
| `title` | `Node` | `-` | Tooltip title. Zero-length titles string, undefined, null and false are never displayed. |
|
|
741
|
+
| `width` | `"default" | "wide"` | `"default"` | If set to `wide`, the tooltip is wider. |
|
|
742
|
+
|
|
743
|
+
### Code examples
|
|
744
|
+
|
|
745
|
+
#### **Tooltip – Dark**
|
|
746
|
+
|
|
747
|
+
This example demonstrates a dark-themed `Tooltip` that includes both a title and a subtitle.
|
|
748
|
+
|
|
749
|
+
**/styles.css**
|
|
750
|
+
|
|
751
|
+
```css
|
|
752
|
+
body {
|
|
753
|
+
font-size: 13px;
|
|
754
|
+
font-weight: 400;
|
|
755
|
+
letter-spacing: 0.08px;
|
|
756
|
+
line-height: 20px;
|
|
757
|
+
text-transform: none;
|
|
758
|
+
font-family: "Inter", sans-serif;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
h1 {
|
|
762
|
+
font-size: 1.5rem;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
.app {
|
|
766
|
+
padding: 20px;
|
|
767
|
+
display: flex;
|
|
768
|
+
justify-content: center;
|
|
769
|
+
}
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
**tsconfig.json**
|
|
773
|
+
|
|
774
|
+
```json
|
|
775
|
+
{
|
|
776
|
+
"include": [
|
|
777
|
+
"./**/*"
|
|
778
|
+
],
|
|
779
|
+
"compilerOptions": {
|
|
780
|
+
"strict": true,
|
|
781
|
+
"esModuleInterop": true,
|
|
782
|
+
"lib": [ "dom", "es2015" ],
|
|
783
|
+
"jsx": "react-jsx"
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
**/App.tsx**
|
|
789
|
+
|
|
790
|
+
```tsx
|
|
791
|
+
import { ButtonIcon, Tooltip } from "@czi-sds/components";
|
|
792
|
+
import "./styles.css";
|
|
793
|
+
|
|
794
|
+
function App() {
|
|
795
|
+
return (
|
|
796
|
+
<div className="app">
|
|
797
|
+
<Tooltip
|
|
798
|
+
arrow
|
|
799
|
+
sdsStyle="dark"
|
|
800
|
+
subtitle="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla facilisi."
|
|
801
|
+
title="Tooltip title"
|
|
802
|
+
>
|
|
803
|
+
<ButtonIcon
|
|
804
|
+
sdsType="secondary"
|
|
805
|
+
sdsSize="large"
|
|
806
|
+
sdsIcon="InfoCircle"
|
|
807
|
+
/>
|
|
808
|
+
</Tooltip>
|
|
809
|
+
</div>
|
|
810
|
+
);
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
export default App;
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
**/index.tsx**
|
|
817
|
+
|
|
818
|
+
```tsx
|
|
819
|
+
import React from "react";
|
|
820
|
+
import { createRoot } from "react-dom/client";
|
|
821
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
822
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
823
|
+
import { Theme } from "@czi-sds/components";
|
|
824
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
825
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
826
|
+
|
|
827
|
+
import App from "./App";
|
|
828
|
+
|
|
829
|
+
const container = document.getElementById("root");
|
|
830
|
+
const root = createRoot(container!);
|
|
831
|
+
|
|
832
|
+
const RootApp = () => {
|
|
833
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
834
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
835
|
+
|
|
836
|
+
return (
|
|
837
|
+
<StyledEngineProvider injectFirst>
|
|
838
|
+
<ThemeProvider theme={theme}>
|
|
839
|
+
<EmotionThemeProvider theme={theme}>
|
|
840
|
+
<CssBaseline />
|
|
841
|
+
<App />
|
|
842
|
+
</EmotionThemeProvider>
|
|
843
|
+
</ThemeProvider>
|
|
844
|
+
</StyledEngineProvider>
|
|
845
|
+
);
|
|
846
|
+
};
|
|
847
|
+
|
|
848
|
+
root.render(
|
|
849
|
+
<React.StrictMode>
|
|
850
|
+
<RootApp />
|
|
851
|
+
</React.StrictMode>
|
|
852
|
+
);
|
|
853
|
+
|
|
854
|
+
```
|
|
855
|
+
|
|
856
|
+
**/public/index.html**
|
|
857
|
+
|
|
858
|
+
```html
|
|
859
|
+
<!DOCTYPE html>
|
|
860
|
+
<html lang="en">
|
|
861
|
+
<head>
|
|
862
|
+
<meta charset="UTF-8" />
|
|
863
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
864
|
+
<title>Tooltips</title>
|
|
865
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
866
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
867
|
+
<link
|
|
868
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
869
|
+
rel="stylesheet"
|
|
870
|
+
/>
|
|
871
|
+
<link
|
|
872
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
873
|
+
rel="stylesheet"
|
|
874
|
+
/>
|
|
875
|
+
</head>
|
|
876
|
+
<body>
|
|
877
|
+
<div id="root"></div>
|
|
878
|
+
</body>
|
|
879
|
+
</html>
|
|
880
|
+
|
|
881
|
+
```
|
|
882
|
+
|
|
883
|
+
**/package.json**
|
|
884
|
+
|
|
885
|
+
```json
|
|
886
|
+
{"dependencies":{"react":"^18.0.0","react-dom":"^18.0.0","react-scripts":"^4.0.0"},"devDependencies":{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0","typescript":"^4.0.0"},"main":"/index.tsx"}
|
|
887
|
+
```
|
|
888
|
+
|
|
889
|
+
---
|
|
890
|
+
|
|
891
|
+
#### **Tooltip – Light**
|
|
892
|
+
|
|
893
|
+
This example showcases a light-themed `Tooltip`.
|
|
894
|
+
|
|
895
|
+
**/styles.css**
|
|
896
|
+
|
|
897
|
+
```css
|
|
898
|
+
body {
|
|
899
|
+
font-size: 13px;
|
|
900
|
+
font-weight: 400;
|
|
901
|
+
letter-spacing: 0.08px;
|
|
902
|
+
line-height: 20px;
|
|
903
|
+
text-transform: none;
|
|
904
|
+
font-family: "Inter", sans-serif;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
h1 {
|
|
908
|
+
font-size: 1.5rem;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
.app {
|
|
912
|
+
padding: 20px;
|
|
913
|
+
height: 100vh;
|
|
914
|
+
display: flex;
|
|
915
|
+
justify-content: center;
|
|
916
|
+
align-items: center;
|
|
917
|
+
}
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
**tsconfig.json**
|
|
921
|
+
|
|
922
|
+
```json
|
|
923
|
+
{
|
|
924
|
+
"include": [
|
|
925
|
+
"./**/*"
|
|
926
|
+
],
|
|
927
|
+
"compilerOptions": {
|
|
928
|
+
"strict": true,
|
|
929
|
+
"esModuleInterop": true,
|
|
930
|
+
"lib": [ "dom", "es2015" ],
|
|
931
|
+
"jsx": "react-jsx"
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
```
|
|
935
|
+
|
|
936
|
+
**/App.tsx**
|
|
937
|
+
|
|
938
|
+
```tsx
|
|
939
|
+
import { ButtonIcon, Tooltip } from "@czi-sds/components";
|
|
940
|
+
import "./styles.css";
|
|
941
|
+
|
|
942
|
+
function App() {
|
|
943
|
+
return (
|
|
944
|
+
<div className="app">
|
|
945
|
+
<Tooltip
|
|
946
|
+
arrow
|
|
947
|
+
title="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla facilisi."
|
|
948
|
+
>
|
|
949
|
+
<ButtonIcon
|
|
950
|
+
sdsType="secondary"
|
|
951
|
+
sdsSize="large"
|
|
952
|
+
sdsIcon="InfoCircle"
|
|
953
|
+
/>
|
|
954
|
+
</Tooltip>
|
|
955
|
+
</div>
|
|
956
|
+
);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
export default App;
|
|
960
|
+
```
|
|
961
|
+
|
|
962
|
+
**/index.tsx**
|
|
963
|
+
|
|
964
|
+
```tsx
|
|
965
|
+
import React from "react";
|
|
966
|
+
import { createRoot } from "react-dom/client";
|
|
967
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
968
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
969
|
+
import { Theme } from "@czi-sds/components";
|
|
970
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
971
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
972
|
+
|
|
973
|
+
import App from "./App";
|
|
974
|
+
|
|
975
|
+
const container = document.getElementById("root");
|
|
976
|
+
const root = createRoot(container!);
|
|
977
|
+
|
|
978
|
+
const RootApp = () => {
|
|
979
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
980
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
981
|
+
|
|
982
|
+
return (
|
|
983
|
+
<StyledEngineProvider injectFirst>
|
|
984
|
+
<ThemeProvider theme={theme}>
|
|
985
|
+
<EmotionThemeProvider theme={theme}>
|
|
986
|
+
<CssBaseline />
|
|
987
|
+
<App />
|
|
988
|
+
</EmotionThemeProvider>
|
|
989
|
+
</ThemeProvider>
|
|
990
|
+
</StyledEngineProvider>
|
|
991
|
+
);
|
|
992
|
+
};
|
|
993
|
+
|
|
994
|
+
root.render(
|
|
995
|
+
<React.StrictMode>
|
|
996
|
+
<RootApp />
|
|
997
|
+
</React.StrictMode>
|
|
998
|
+
);
|
|
999
|
+
|
|
1000
|
+
```
|
|
1001
|
+
|
|
1002
|
+
**/public/index.html**
|
|
1003
|
+
|
|
1004
|
+
```html
|
|
1005
|
+
<!DOCTYPE html>
|
|
1006
|
+
<html lang="en">
|
|
1007
|
+
<head>
|
|
1008
|
+
<meta charset="UTF-8" />
|
|
1009
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1010
|
+
<title>Tooltips</title>
|
|
1011
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
1012
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
1013
|
+
<link
|
|
1014
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
1015
|
+
rel="stylesheet"
|
|
1016
|
+
/>
|
|
1017
|
+
<link
|
|
1018
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
1019
|
+
rel="stylesheet"
|
|
1020
|
+
/>
|
|
1021
|
+
</head>
|
|
1022
|
+
<body>
|
|
1023
|
+
<div id="root"></div>
|
|
1024
|
+
</body>
|
|
1025
|
+
</html>
|
|
1026
|
+
|
|
1027
|
+
```
|
|
1028
|
+
|
|
1029
|
+
**/package.json**
|
|
1030
|
+
|
|
1031
|
+
```json
|
|
1032
|
+
{"dependencies":{"react":"^18.0.0","react-dom":"^18.0.0","react-scripts":"^4.0.0"},"devDependencies":{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0","typescript":"^4.0.0"},"main":"/index.tsx"}
|
|
1033
|
+
```
|
|
1034
|
+
|
|
1035
|
+
---
|
|
1036
|
+
|
|
1037
|
+
**Tooltip for disabled components**
|
|
1038
|
+
|
|
1039
|
+
This example demonstrates how to add a tooltip to a disabled component, commonly a button.
|
|
1040
|
+
|
|
1041
|
+
>**Note for Tooltips on** **`Disabled`** **elements**
|
|
1042
|
+
>
|
|
1043
|
+
>If the tooltip wraps a disabled component, please make sure to wrap the children in a `<span>` tag.
|
|
1044
|
+
>
|
|
1045
|
+
>https://mui.com/components/tooltips/#disabled-elements
|
|
1046
|
+
|
|
1047
|
+
**/styles.css**
|
|
1048
|
+
|
|
1049
|
+
```css
|
|
1050
|
+
body {
|
|
1051
|
+
font-size: 13px;
|
|
1052
|
+
font-weight: 400;
|
|
1053
|
+
letter-spacing: 0.08px;
|
|
1054
|
+
line-height: 20px;
|
|
1055
|
+
text-transform: none;
|
|
1056
|
+
font-family: "Inter", sans-serif;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
h1 {
|
|
1060
|
+
font-size: 1.5rem;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
.app {
|
|
1064
|
+
padding: 20px;
|
|
1065
|
+
height: 100vh;
|
|
1066
|
+
display: flex;
|
|
1067
|
+
justify-content: center;
|
|
1068
|
+
align-items: center;
|
|
1069
|
+
}
|
|
1070
|
+
```
|
|
1071
|
+
|
|
1072
|
+
**tsconfig.json**
|
|
1073
|
+
|
|
1074
|
+
```json
|
|
1075
|
+
{
|
|
1076
|
+
"include": [
|
|
1077
|
+
"./**/*"
|
|
1078
|
+
],
|
|
1079
|
+
"compilerOptions": {
|
|
1080
|
+
"strict": true,
|
|
1081
|
+
"esModuleInterop": true,
|
|
1082
|
+
"lib": [ "dom", "es2015" ],
|
|
1083
|
+
"jsx": "react-jsx"
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
```
|
|
1087
|
+
|
|
1088
|
+
**/App.tsx**
|
|
1089
|
+
|
|
1090
|
+
```tsx
|
|
1091
|
+
import { ButtonIcon, Tooltip } from "@czi-sds/components";
|
|
1092
|
+
import "./styles.css";
|
|
1093
|
+
|
|
1094
|
+
function App() {
|
|
1095
|
+
return (
|
|
1096
|
+
<div className="app">
|
|
1097
|
+
<Tooltip
|
|
1098
|
+
arrow
|
|
1099
|
+
title="This Button is disabled!"
|
|
1100
|
+
>
|
|
1101
|
+
<span>
|
|
1102
|
+
<ButtonIcon
|
|
1103
|
+
sdsType="secondary"
|
|
1104
|
+
sdsSize="large"
|
|
1105
|
+
sdsIcon="Widget"
|
|
1106
|
+
disabled
|
|
1107
|
+
/>
|
|
1108
|
+
</span>
|
|
1109
|
+
</Tooltip>
|
|
1110
|
+
</div>
|
|
1111
|
+
);
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
export default App;
|
|
1115
|
+
```
|
|
1116
|
+
|
|
1117
|
+
**/index.tsx**
|
|
1118
|
+
|
|
1119
|
+
```tsx
|
|
1120
|
+
import React from "react";
|
|
1121
|
+
import { createRoot } from "react-dom/client";
|
|
1122
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
1123
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
1124
|
+
import { Theme } from "@czi-sds/components";
|
|
1125
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
1126
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
1127
|
+
|
|
1128
|
+
import App from "./App";
|
|
1129
|
+
|
|
1130
|
+
const container = document.getElementById("root");
|
|
1131
|
+
const root = createRoot(container!);
|
|
1132
|
+
|
|
1133
|
+
const RootApp = () => {
|
|
1134
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
1135
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
1136
|
+
|
|
1137
|
+
return (
|
|
1138
|
+
<StyledEngineProvider injectFirst>
|
|
1139
|
+
<ThemeProvider theme={theme}>
|
|
1140
|
+
<EmotionThemeProvider theme={theme}>
|
|
1141
|
+
<CssBaseline />
|
|
1142
|
+
<App />
|
|
1143
|
+
</EmotionThemeProvider>
|
|
1144
|
+
</ThemeProvider>
|
|
1145
|
+
</StyledEngineProvider>
|
|
1146
|
+
);
|
|
1147
|
+
};
|
|
1148
|
+
|
|
1149
|
+
root.render(
|
|
1150
|
+
<React.StrictMode>
|
|
1151
|
+
<RootApp />
|
|
1152
|
+
</React.StrictMode>
|
|
1153
|
+
);
|
|
1154
|
+
|
|
1155
|
+
```
|
|
1156
|
+
|
|
1157
|
+
**/public/index.html**
|
|
1158
|
+
|
|
1159
|
+
```html
|
|
1160
|
+
<!DOCTYPE html>
|
|
1161
|
+
<html lang="en">
|
|
1162
|
+
<head>
|
|
1163
|
+
<meta charset="UTF-8" />
|
|
1164
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1165
|
+
<title>Tooltips</title>
|
|
1166
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
1167
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
1168
|
+
<link
|
|
1169
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
1170
|
+
rel="stylesheet"
|
|
1171
|
+
/>
|
|
1172
|
+
<link
|
|
1173
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
1174
|
+
rel="stylesheet"
|
|
1175
|
+
/>
|
|
1176
|
+
</head>
|
|
1177
|
+
<body>
|
|
1178
|
+
<div id="root"></div>
|
|
1179
|
+
</body>
|
|
1180
|
+
</html>
|
|
1181
|
+
|
|
1182
|
+
```
|
|
1183
|
+
|
|
1184
|
+
**/package.json**
|
|
1185
|
+
|
|
1186
|
+
```json
|
|
1187
|
+
{"dependencies":{"react":"^18.0.0","react-dom":"^18.0.0","react-scripts":"^4.0.0"},"devDependencies":{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0","typescript":"^4.0.0"},"main":"/index.tsx"}
|
|
1188
|
+
```
|
|
1189
|
+
|
|
1190
|
+
---
|
|
1191
|
+
|
|
1192
|
+
---
|
|
1193
|
+
|
|
1194
|
+
## TooltipCondensed
|
|
1195
|
+
|
|
1196
|
+
### SDS Source Code
|
|
1197
|
+
|
|
1198
|
+
The component's source code in the SDS codebase can be found here.
|
|
1199
|
+
|
|
1200
|
+
### SDS vs MUI
|
|
1201
|
+
|
|
1202
|
+
Like the regular SDS `Tooltip` component, the `TooltipCondensed` component is built on MUI's `Tooltip` component, and has its own SDS-specific props and options (which are different from SDS's `Tooltip` component's SDS-only options):
|
|
1203
|
+
|
|
1204
|
+
* **`indicator`****:** This boolean prop determines whether or not the `Tooltip` text should be preceded by a colored dot.
|
|
1205
|
+
* **`indicatorColor`****:** Sets the color of the `indicator`, if included.
|
|
1206
|
+
* **`followCursor`****:** Additionally, `TooltipCondensed` has the `followCursor` behavior, and setting the `followCursor` prop to `false` has no effect.
|
|
1207
|
+
|
|
1208
|
+
### MUI Documentation
|
|
1209
|
+
|
|
1210
|
+
Documentation for the underlying MUI component can be found here.
|
|
1211
|
+
|
|
1212
|
+
### Props
|
|
1213
|
+
|
|
1214
|
+
Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
|
|
1215
|
+
|
|
1216
|
+
| Name | Type | Default | Description |
|
|
1217
|
+
| --- | --- | --- | --- |
|
|
1218
|
+
| `indicator` | `boolean` | `false` | This boolean prop determines whether or not the Tooltip text should be preceded by a colored dot. |
|
|
1219
|
+
| `indicatorColor` | `color` | `-` | Sets the color of the indicator, if included. |
|
|
1220
|
+
| `title` | `Node` | `-` | Tooltip title. Zero-length titles string, undefined, null and false are never displayed. |
|
|
1221
|
+
|
|
1222
|
+
### Code examples
|
|
1223
|
+
|
|
1224
|
+
#### TooltipCondensed with indicator
|
|
1225
|
+
|
|
1226
|
+
This example illustrates the minimum required props to render `TooltipCondensed` with an indicator.
|
|
1227
|
+
|
|
1228
|
+
**/styles.css**
|
|
1229
|
+
|
|
1230
|
+
```css
|
|
1231
|
+
body {
|
|
1232
|
+
font-size: 13px;
|
|
1233
|
+
font-weight: 400;
|
|
1234
|
+
letter-spacing: 0.08px;
|
|
1235
|
+
line-height: 20px;
|
|
1236
|
+
text-transform: none;
|
|
1237
|
+
font-family: "Inter", sans-serif;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
h1 {
|
|
1241
|
+
font-size: 1.5rem;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
.app {
|
|
1245
|
+
padding: 20px;
|
|
1246
|
+
height: 100vh;
|
|
1247
|
+
display: flex;
|
|
1248
|
+
justify-content: center;
|
|
1249
|
+
align-items: center;
|
|
1250
|
+
}
|
|
1251
|
+
```
|
|
1252
|
+
|
|
1253
|
+
**tsconfig.json**
|
|
1254
|
+
|
|
1255
|
+
```json
|
|
1256
|
+
{
|
|
1257
|
+
"include": [
|
|
1258
|
+
"./**/*"
|
|
1259
|
+
],
|
|
1260
|
+
"compilerOptions": {
|
|
1261
|
+
"strict": true,
|
|
1262
|
+
"esModuleInterop": true,
|
|
1263
|
+
"lib": [ "dom", "es2015" ],
|
|
1264
|
+
"jsx": "react-jsx"
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
```
|
|
1268
|
+
|
|
1269
|
+
**/App.tsx**
|
|
1270
|
+
|
|
1271
|
+
```tsx
|
|
1272
|
+
import { ButtonIcon, TooltipCondensed } from "@czi-sds/components";
|
|
1273
|
+
import "./styles.css";
|
|
1274
|
+
|
|
1275
|
+
function App() {
|
|
1276
|
+
return (
|
|
1277
|
+
<div className="app">
|
|
1278
|
+
<TooltipCondensed
|
|
1279
|
+
indicator
|
|
1280
|
+
indicatorColor="DodgerBlue"
|
|
1281
|
+
title="Tooltip title"
|
|
1282
|
+
>
|
|
1283
|
+
<ButtonIcon
|
|
1284
|
+
sdsType="secondary"
|
|
1285
|
+
sdsSize="large"
|
|
1286
|
+
sdsIcon="InfoCircle"
|
|
1287
|
+
/>
|
|
1288
|
+
</TooltipCondensed>
|
|
1289
|
+
</div>
|
|
1290
|
+
);
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
export default App;
|
|
1294
|
+
```
|
|
1295
|
+
|
|
1296
|
+
**/index.tsx**
|
|
1297
|
+
|
|
1298
|
+
```tsx
|
|
1299
|
+
import React from "react";
|
|
1300
|
+
import { createRoot } from "react-dom/client";
|
|
1301
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
1302
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
1303
|
+
import { Theme } from "@czi-sds/components";
|
|
1304
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
1305
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
1306
|
+
|
|
1307
|
+
import App from "./App";
|
|
1308
|
+
|
|
1309
|
+
const container = document.getElementById("root");
|
|
1310
|
+
const root = createRoot(container!);
|
|
1311
|
+
|
|
1312
|
+
const RootApp = () => {
|
|
1313
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
1314
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
1315
|
+
|
|
1316
|
+
return (
|
|
1317
|
+
<StyledEngineProvider injectFirst>
|
|
1318
|
+
<ThemeProvider theme={theme}>
|
|
1319
|
+
<EmotionThemeProvider theme={theme}>
|
|
1320
|
+
<CssBaseline />
|
|
1321
|
+
<App />
|
|
1322
|
+
</EmotionThemeProvider>
|
|
1323
|
+
</ThemeProvider>
|
|
1324
|
+
</StyledEngineProvider>
|
|
1325
|
+
);
|
|
1326
|
+
};
|
|
1327
|
+
|
|
1328
|
+
root.render(
|
|
1329
|
+
<React.StrictMode>
|
|
1330
|
+
<RootApp />
|
|
1331
|
+
</React.StrictMode>
|
|
1332
|
+
);
|
|
1333
|
+
|
|
1334
|
+
```
|
|
1335
|
+
|
|
1336
|
+
**/public/index.html**
|
|
1337
|
+
|
|
1338
|
+
```html
|
|
1339
|
+
<!DOCTYPE html>
|
|
1340
|
+
<html lang="en">
|
|
1341
|
+
<head>
|
|
1342
|
+
<meta charset="UTF-8" />
|
|
1343
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1344
|
+
<title>Tooltips</title>
|
|
1345
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
1346
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
1347
|
+
<link
|
|
1348
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
1349
|
+
rel="stylesheet"
|
|
1350
|
+
/>
|
|
1351
|
+
<link
|
|
1352
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
1353
|
+
rel="stylesheet"
|
|
1354
|
+
/>
|
|
1355
|
+
</head>
|
|
1356
|
+
<body>
|
|
1357
|
+
<div id="root"></div>
|
|
1358
|
+
</body>
|
|
1359
|
+
</html>
|
|
1360
|
+
|
|
1361
|
+
```
|
|
1362
|
+
|
|
1363
|
+
**/package.json**
|
|
1364
|
+
|
|
1365
|
+
```json
|
|
1366
|
+
{"dependencies":{"react":"^18.0.0","react-dom":"^18.0.0","react-scripts":"^4.0.0"},"devDependencies":{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0","typescript":"^4.0.0"},"main":"/index.tsx"}
|
|
1367
|
+
```
|
|
1368
|
+
|
|
1369
|
+
---
|
|
1370
|
+
|
|
1371
|
+
---
|
|
1372
|
+
|
|
1373
|
+
## TooltipTable
|
|
1374
|
+
|
|
1375
|
+
### SDS Source Code
|
|
1376
|
+
|
|
1377
|
+
The component's source code in the SDS codebase can be found here.
|
|
1378
|
+
|
|
1379
|
+
### SDS vs MUI
|
|
1380
|
+
|
|
1381
|
+
The SDS `TooltipTable` is built off of the MUI `Tooltip` component, but it has a built-in way to add tabular data:
|
|
1382
|
+
|
|
1383
|
+
* **`data`****:** This prop takes an array of objects to be formatted within the `TooltipTable` with two columns, one for `label` and one for `value`.
|
|
1384
|
+
* **`itemAlign`****:** This prop specific to SDS positions the `value` contents of each row either the `right` or `left` of their column.
|
|
1385
|
+
* **`contentAlert`****:** This SDS-specific prop takes a value of `String` (a message), `Element` (such as a link), or `None` (the default).
|
|
1386
|
+
|
|
1387
|
+
### MUI Documentation
|
|
1388
|
+
|
|
1389
|
+
Documentation for the underlying MUI component can be found here.
|
|
1390
|
+
|
|
1391
|
+
### Props
|
|
1392
|
+
|
|
1393
|
+
Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
|
|
1394
|
+
|
|
1395
|
+
| Name | Type | Default | Description |
|
|
1396
|
+
| --- | --- | --- | --- |
|
|
1397
|
+
| `contentAlert` | `string | JSX.Element` | `-` | This SDS-specific prop takes a value of String (a message), Element (such as a link), or None (the default) |
|
|
1398
|
+
| `data` | `Array<{` `label?: string;` `dataRows: {` `label: string;` `value: string | number;` `}[];` `disabled?: boolean;` `}>` | `-` | This prop takes an array of objects to be formatted within the TooltipTable with two columns, one for label and one for value. |
|
|
1399
|
+
| `itemAlign` | `"left" | "right"` | `"right"` | This prop specific to SDS positions the value contents of each row either the `right` or `left` of their column. |
|
|
1400
|
+
|
|
1401
|
+
### Code examples
|
|
1402
|
+
|
|
1403
|
+
#### Default TooltipTable
|
|
1404
|
+
|
|
1405
|
+
This example showcases the implementation of a `TooltipTable` component.
|
|
1406
|
+
|
|
1407
|
+
**/styles.css**
|
|
1408
|
+
|
|
1409
|
+
```css
|
|
1410
|
+
body {
|
|
1411
|
+
font-size: 13px;
|
|
1412
|
+
font-weight: 400;
|
|
1413
|
+
letter-spacing: 0.08px;
|
|
1414
|
+
line-height: 20px;
|
|
1415
|
+
text-transform: none;
|
|
1416
|
+
font-family: "Inter", sans-serif;
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
h1 {
|
|
1420
|
+
font-size: 1.5rem;
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
.app {
|
|
1424
|
+
padding: 20px;
|
|
1425
|
+
display: flex;
|
|
1426
|
+
justify-content: center;
|
|
1427
|
+
}
|
|
1428
|
+
```
|
|
1429
|
+
|
|
1430
|
+
**tsconfig.json**
|
|
1431
|
+
|
|
1432
|
+
```json
|
|
1433
|
+
{
|
|
1434
|
+
"include": [
|
|
1435
|
+
"./**/*"
|
|
1436
|
+
],
|
|
1437
|
+
"compilerOptions": {
|
|
1438
|
+
"strict": true,
|
|
1439
|
+
"esModuleInterop": true,
|
|
1440
|
+
"lib": [ "dom", "es2015" ],
|
|
1441
|
+
"jsx": "react-jsx"
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
```
|
|
1445
|
+
|
|
1446
|
+
**/App.tsx**
|
|
1447
|
+
|
|
1448
|
+
```tsx
|
|
1449
|
+
import { ButtonIcon, Tooltip, TooltipTable } from "@czi-sds/components";
|
|
1450
|
+
import "./styles.css";
|
|
1451
|
+
|
|
1452
|
+
function App() {
|
|
1453
|
+
const data = [
|
|
1454
|
+
{
|
|
1455
|
+
dataRows: [
|
|
1456
|
+
{ label: "First", value: 1 },
|
|
1457
|
+
{ label: "Second", value: 2 },
|
|
1458
|
+
],
|
|
1459
|
+
label: "Section 1",
|
|
1460
|
+
},
|
|
1461
|
+
{
|
|
1462
|
+
dataRows: [
|
|
1463
|
+
{ label: "Third", value: 3 },
|
|
1464
|
+
],
|
|
1465
|
+
label: "Section 2",
|
|
1466
|
+
}
|
|
1467
|
+
];
|
|
1468
|
+
return (
|
|
1469
|
+
<div className="app">
|
|
1470
|
+
<Tooltip
|
|
1471
|
+
arrow
|
|
1472
|
+
title={
|
|
1473
|
+
<TooltipTable itemAlign="right" data={data} />
|
|
1474
|
+
}
|
|
1475
|
+
placement="right-end"
|
|
1476
|
+
>
|
|
1477
|
+
<ButtonIcon
|
|
1478
|
+
sdsType="secondary"
|
|
1479
|
+
sdsSize="large"
|
|
1480
|
+
sdsIcon="InfoCircle"
|
|
1481
|
+
/>
|
|
1482
|
+
</Tooltip>
|
|
1483
|
+
</div>
|
|
1484
|
+
);
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
export default App;
|
|
1488
|
+
```
|
|
1489
|
+
|
|
1490
|
+
**/index.tsx**
|
|
1491
|
+
|
|
1492
|
+
```tsx
|
|
1493
|
+
import React from "react";
|
|
1494
|
+
import { createRoot } from "react-dom/client";
|
|
1495
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
1496
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
1497
|
+
import { Theme } from "@czi-sds/components";
|
|
1498
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
1499
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
1500
|
+
|
|
1501
|
+
import App from "./App";
|
|
1502
|
+
|
|
1503
|
+
const container = document.getElementById("root");
|
|
1504
|
+
const root = createRoot(container!);
|
|
1505
|
+
|
|
1506
|
+
const RootApp = () => {
|
|
1507
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
1508
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
1509
|
+
|
|
1510
|
+
return (
|
|
1511
|
+
<StyledEngineProvider injectFirst>
|
|
1512
|
+
<ThemeProvider theme={theme}>
|
|
1513
|
+
<EmotionThemeProvider theme={theme}>
|
|
1514
|
+
<CssBaseline />
|
|
1515
|
+
<App />
|
|
1516
|
+
</EmotionThemeProvider>
|
|
1517
|
+
</ThemeProvider>
|
|
1518
|
+
</StyledEngineProvider>
|
|
1519
|
+
);
|
|
1520
|
+
};
|
|
1521
|
+
|
|
1522
|
+
root.render(
|
|
1523
|
+
<React.StrictMode>
|
|
1524
|
+
<RootApp />
|
|
1525
|
+
</React.StrictMode>
|
|
1526
|
+
);
|
|
1527
|
+
|
|
1528
|
+
```
|
|
1529
|
+
|
|
1530
|
+
**/public/index.html**
|
|
1531
|
+
|
|
1532
|
+
```html
|
|
1533
|
+
<!DOCTYPE html>
|
|
1534
|
+
<html lang="en">
|
|
1535
|
+
<head>
|
|
1536
|
+
<meta charset="UTF-8" />
|
|
1537
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1538
|
+
<title>Tooltips</title>
|
|
1539
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
1540
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
1541
|
+
<link
|
|
1542
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
1543
|
+
rel="stylesheet"
|
|
1544
|
+
/>
|
|
1545
|
+
<link
|
|
1546
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
1547
|
+
rel="stylesheet"
|
|
1548
|
+
/>
|
|
1549
|
+
</head>
|
|
1550
|
+
<body>
|
|
1551
|
+
<div id="root"></div>
|
|
1552
|
+
</body>
|
|
1553
|
+
</html>
|
|
1554
|
+
|
|
1555
|
+
```
|
|
1556
|
+
|
|
1557
|
+
**/package.json**
|
|
1558
|
+
|
|
1559
|
+
```json
|
|
1560
|
+
{"dependencies":{"react":"^18.0.0","react-dom":"^18.0.0","react-scripts":"^4.0.0"},"devDependencies":{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0","typescript":"^4.0.0"},"main":"/index.tsx"}
|
|
1561
|
+
```
|
|
1562
|
+
|
|
1563
|
+
---
|
|
1564
|
+
|