@czi-sds/mcp 0.2.1 → 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 +515 -12
- package/package.json +4 -3
|
@@ -0,0 +1,2066 @@
|
|
|
1
|
+
# Control Inputs
|
|
2
|
+
|
|
3
|
+
Control Inputs are elements that enable users to make selections and communicate choices when presented with various options in the UI.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
## Control Input Variants
|
|
8
|
+
|
|
9
|
+
| There are two Control Input components available for designers to use depending on the type of action or response they are needing to elicit from the user. Checkbox and Radio Inputs must always be accompanied by a label that communicates the result of the selection. Follow the usage criteria accompanying each variant as a guide for selecting the correct Control Input for any given use case. | | **Jump to variant:** Checkbox Radio |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Checkbox Input
|
|
15
|
+
|
|
16
|
+
| | In Figma | | | Meets Accessibility | | | In napari hub + .org Codebases |
|
|
17
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
18
|
+
|
|
19
|
+
Use when the user can select multiple options from a group of choices. Each Checkbox must be coupled with a label to communicate the result of a selection.
|
|
20
|
+
|
|
21
|
+
Use `sdsStage: indeterminate` to indicate a mixed selection; reserved for cases where "Select All" is an option as part of a group of checkboxes.
|
|
22
|
+
|
|
23
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
24
|
+
|
|
25
|
+
| **Default** | **Hover** | **Disabled** |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
### Checkbox Lockups
|
|
33
|
+
|
|
34
|
+
Each Checkbox must be coupled with a label to communicate the result of a selection.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
### Checkbox Spacing
|
|
41
|
+
|
|
42
|
+
These rules establish how much margin should exist between and around elements.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Radio Input
|
|
49
|
+
|
|
50
|
+
| | In Figma | | | Meets Accessibility | | | In napari hub + .org Codebases |
|
|
51
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
52
|
+
|
|
53
|
+
Use when the user can select only one option from a group of choices. Each Radio Input must be coupled with a label to communicate the result of a selection.
|
|
54
|
+
|
|
55
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
56
|
+
|
|
57
|
+
| **Default** | **Hover** | **Disabled** |
|
|
58
|
+
| --- | --- | --- |
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
### Radio Lockups
|
|
63
|
+
|
|
64
|
+
Each Radio must be coupled with a label to communicate the result of a selection.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
### Radio Spacing
|
|
69
|
+
|
|
70
|
+
These rules establish how much margin should exist between and around elements.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## Code
|
|
75
|
+
|
|
76
|
+
## Control Input Components
|
|
77
|
+
|
|
78
|
+
| Below you will find interactive Storybook iframes for each component within the Control Input element group. 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:** InputCheckbox InputRadio |
|
|
79
|
+
| --- | --- | --- |
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
>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.
|
|
84
|
+
|
|
85
|
+
### InputCheckbox
|
|
86
|
+
|
|
87
|
+
Storybook
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
### InputRadio
|
|
92
|
+
|
|
93
|
+
Storybook
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
Control Inputs are elements that enable users to make selections and communicate choices when presented with various options in the UI.
|
|
98
|
+
|
|
99
|
+
## Overview
|
|
100
|
+
|
|
101
|
+
## Control Input Variants
|
|
102
|
+
|
|
103
|
+
| There is a range of Control Input variants available for designers to use depending on the type of action or response they are needing to elicit from the user. Checkbox and Radio Inputs must always be accompanied by a label that communicates the result of the selection. Follow the usage criteria accompanying each variant as a guide for selecting the correct Control Input for any given use case. | | **Jump to variant:** Checkbox Radio Toggle |
|
|
104
|
+
| --- | --- | --- |
|
|
105
|
+
|
|
106
|
+
### Visual Preview
|
|
107
|
+
|
|
108
|
+
Use the links below to jump to information on a specific Control Input variant:
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Checkbox Input
|
|
113
|
+
|
|
114
|
+
| | In Figma | | | Meets Accessibility | | | In CZ GEN EPI Codebase |
|
|
115
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
116
|
+
|
|
117
|
+
Use when the user can select multiple options from a group of choices. Each Checkbox must be coupled with a label (and optional caption) to communicate the result of a selection.
|
|
118
|
+
|
|
119
|
+
Use `sdsStage: indeterminate` to indicate a mixed selection; reserved for cases where "Select All" is an option as part of a group of checkboxes.
|
|
120
|
+
|
|
121
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
122
|
+
|
|
123
|
+
| **Default** | **Hover** | **Disabled** |
|
|
124
|
+
| --- | --- | --- |
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
### Checkbox Intent States
|
|
135
|
+
|
|
136
|
+
Use `intent: default` to communicate that a user has yet to enter a response.
|
|
137
|
+
|
|
138
|
+
Use `intent: error` to communicate when a user has entered an incorrect or incomplete response.
|
|
139
|
+
|
|
140
|
+
Use `intent: warning` to communicate when a user needs to be alerted that their response needs attention.
|
|
141
|
+
|
|
142
|
+
| **Default** | **Error** | **Warning** |
|
|
143
|
+
| --- | --- | --- |
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
### Checkbox Lockups
|
|
148
|
+
|
|
149
|
+
Each Checkbox must be coupled with a label to communicate the result of a selection. If additional details about the selection need to be communicated, an optional caption can be included.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
### Checkbox Spacing
|
|
154
|
+
|
|
155
|
+
These rules establish how much margin should exist between and around elements.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Radio Input
|
|
160
|
+
|
|
161
|
+
| | In Figma | | | Meets Accessibility | | | In CZ GEN EPI Codebase |
|
|
162
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
163
|
+
|
|
164
|
+
Use when the user can select only one option from a group of choices. Each Radio must be coupled with a label (and optional caption) to communicate the result of a selection.
|
|
165
|
+
|
|
166
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
167
|
+
|
|
168
|
+
| **Default** | **Hover** | **Disabled** |
|
|
169
|
+
| --- | --- | --- |
|
|
170
|
+
|
|
171
|
+
| **Default** | **Disabled** |
|
|
172
|
+
| --- | --- |
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
### Radio Intent States
|
|
177
|
+
|
|
178
|
+
Use `intent: default` to communicate that user has yet to enter a response.
|
|
179
|
+
|
|
180
|
+
Use `intent: error` to communicate when a user has entered an incorrect or incomplete response.
|
|
181
|
+
|
|
182
|
+
Use `intent: warning` to communicate when a user needs to be alerted that their response needs attention.
|
|
183
|
+
|
|
184
|
+
| **Default** | **Error** | **Warning** |
|
|
185
|
+
| --- | --- | --- |
|
|
186
|
+
|
|
187
|
+
### Radio Lockups
|
|
188
|
+
|
|
189
|
+
Each Radio must be coupled with a label to communicate the result of a selection. If additional details about the selection need to be communicated, an optional caption can be included.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
### Radio Spacing
|
|
194
|
+
|
|
195
|
+
These rules establish how much margin should exist between and around elements.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Toggle
|
|
200
|
+
|
|
201
|
+
| | In Figma | | | Meets Accessibility | | | In CZ GEN EPI Codebase |
|
|
202
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
203
|
+
|
|
204
|
+
Use to allow the user to flip a setting or option from off to on and vice versa.
|
|
205
|
+
|
|
206
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
207
|
+
|
|
208
|
+
| **Default** | **Hover** | **Disabled** |
|
|
209
|
+
| --- | --- | --- |
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
### Toggle Spacing
|
|
216
|
+
|
|
217
|
+
These rules establish how much margin should exist between and around elements.
|
|
218
|
+
|
|
219
|
+
## Code
|
|
220
|
+
|
|
221
|
+
## Control Input Components
|
|
222
|
+
|
|
223
|
+
| Below you will find interactive Storybook iframes for each component within the Control Input element group. 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:** InputCheckbox InputRadio InputToggle InputSlider |
|
|
224
|
+
| --- | --- | --- |
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
>These components appear as they are 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.
|
|
229
|
+
|
|
230
|
+
### InputCheckbox
|
|
231
|
+
|
|
232
|
+
Storybook
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
### InputRadio
|
|
237
|
+
|
|
238
|
+
Storybook
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
### InputToggle
|
|
243
|
+
|
|
244
|
+
Storybook
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
Control Inputs are elements that enable users to make selections and communicate choices when presented with various options in the UI.
|
|
249
|
+
|
|
250
|
+
## Overview
|
|
251
|
+
|
|
252
|
+
## Control Input Variants
|
|
253
|
+
|
|
254
|
+
| There is a range of Control Input variants available for designers to use depending on the type of action or response they are needing to elicit from the user. Checkbox and Radio Inputs must always be accompanied by a label that communicates the result of the selection. Follow the usage criteria accompanying each variant as a guide for selecting the correct Control Input for any given use case. | | **Jump to variant:** Checkbox Radio Toggle Slider |
|
|
255
|
+
| --- | --- | --- |
|
|
256
|
+
|
|
257
|
+
### Visual Preview
|
|
258
|
+
|
|
259
|
+
Use the links below to jump to information on a specific Control Input variant:
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## Checkbox Input
|
|
264
|
+
|
|
265
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
266
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
267
|
+
|
|
268
|
+
Use when the user can select multiple options from a group of choices. Each Checkbox must be coupled with a label (and optional caption) to communicate the result of a selection.
|
|
269
|
+
|
|
270
|
+
Use `sdsStage: indeterminate` to indicate a mixed selection; reserved for cases where "Select All" is an option as part of a group of checkboxes.
|
|
271
|
+
|
|
272
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
273
|
+
|
|
274
|
+
| **Default** | **Hover** | **Disabled** |
|
|
275
|
+
| --- | --- | --- |
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
### Checkbox Intent States
|
|
284
|
+
|
|
285
|
+
Use `intent: default` to communicate that user has yet to enter a response.
|
|
286
|
+
|
|
287
|
+
Use `intent: error` to communicate when a user has entered an incorrect or incomplete response.
|
|
288
|
+
|
|
289
|
+
Use `intent: warning` to communicate when a user needs to be alerted that their response needs attention.
|
|
290
|
+
|
|
291
|
+
| **Default** | **Error** | **Warning** |
|
|
292
|
+
| --- | --- | --- |
|
|
293
|
+
|
|
294
|
+
### Checkbox Lockups
|
|
295
|
+
|
|
296
|
+
Each Checkbox must be coupled with a label to communicate the result of a selection. If additional details about the selection need to be communicated, an optional caption can be included.
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
### Checkbox Spacing
|
|
301
|
+
|
|
302
|
+
These rules establish how much margin should exist between and around elements.
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## Radio Input
|
|
307
|
+
|
|
308
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
309
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
310
|
+
|
|
311
|
+
Use when the user can select only one option from a group of choices. Each Radio must be coupled with a label (and optional caption) to communicate the result of a selection.
|
|
312
|
+
|
|
313
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
314
|
+
|
|
315
|
+
| **Default** | **Hover** | **Disabled** |
|
|
316
|
+
| --- | --- | --- |
|
|
317
|
+
|
|
318
|
+
| **Default** | **Disabled** |
|
|
319
|
+
| --- | --- |
|
|
320
|
+
|
|
321
|
+
### Radio Intent States
|
|
322
|
+
|
|
323
|
+
Use `intent: default` to communicate that user has yet to enter a response.
|
|
324
|
+
|
|
325
|
+
Use `intent: error` to communicate when a user has entered an incorrect or incomplete response.
|
|
326
|
+
|
|
327
|
+
Use `intent: warning` to communicate when a user needs to be alerted that their response needs attention.
|
|
328
|
+
|
|
329
|
+
| **Default** | **Error** | **Warning** |
|
|
330
|
+
| --- | --- | --- |
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
### Radio Lockups
|
|
335
|
+
|
|
336
|
+
Each Radio must be coupled with a label to communicate the result of a selection. If additional details about the selection need to be communicated, an optional caption can be included.
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
### Radio Spacing
|
|
341
|
+
|
|
342
|
+
These rules establish how much margin should exist between and around elements.
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## Toggle
|
|
347
|
+
|
|
348
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
349
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
350
|
+
|
|
351
|
+
Use to allow the user to flip a setting or option from off to on and vice versa.
|
|
352
|
+
|
|
353
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
354
|
+
|
|
355
|
+
| **Default** | **Hover** | **Disabled** |
|
|
356
|
+
| --- | --- | --- |
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
### Toggle Switch Spacing
|
|
363
|
+
|
|
364
|
+
These rules establish how much margin should exist between and around elements.
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## Slider
|
|
369
|
+
|
|
370
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
371
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
372
|
+
|
|
373
|
+
### Single-sided Slider
|
|
374
|
+
|
|
375
|
+
Use when there is a specific datapoint or value within a dataset that the user is able to select.
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
### Double-sided Slider
|
|
380
|
+
|
|
381
|
+
Use when users need the ability to select a range between two values within a dataset.
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
### Slider Spacing
|
|
388
|
+
|
|
389
|
+
These rules establish how much margin should exist between and around elements.
|
|
390
|
+
|
|
391
|
+
## Code
|
|
392
|
+
|
|
393
|
+
## Control Input Components
|
|
394
|
+
|
|
395
|
+
| Below you will find interactive Storybook iframes for each component within the Control Input element group. 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:** InputCheckbox InputRadio InputToggle InputSlider |
|
|
396
|
+
| --- | --- | --- |
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
### InputCheckbox
|
|
401
|
+
|
|
402
|
+
Storybook
|
|
403
|
+
|
|
404
|
+
---
|
|
405
|
+
|
|
406
|
+
### InputRadio
|
|
407
|
+
|
|
408
|
+
Storybook
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
### InputToggle
|
|
413
|
+
|
|
414
|
+
Storybook
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
### InputSlider
|
|
419
|
+
|
|
420
|
+
Storybook
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
|
|
424
|
+
Control Inputs are elements that enable users to make selections and communicate choices when presented with various options in the UI.
|
|
425
|
+
|
|
426
|
+
## Guidelines
|
|
427
|
+
|
|
428
|
+
## Control Input Components
|
|
429
|
+
|
|
430
|
+
| There are a range of Control Input components available to use depending on the type of action or response the application needs from the user. | | **Jump to component:** Checkbox Radio Slider Toggle |
|
|
431
|
+
| --- | --- | --- |
|
|
432
|
+
|
|
433
|
+
### Visual Preview
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
## Checkbox
|
|
438
|
+
|
|
439
|
+
| | In Figma | | | Meets Accessibility | | | In Code |
|
|
440
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
441
|
+
|
|
442
|
+
### Live Instance
|
|
443
|
+
|
|
444
|
+
Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
|
|
445
|
+
|
|
446
|
+
Default
|
|
447
|
+
|
|
448
|
+
---
|
|
449
|
+
|
|
450
|
+
### Overview
|
|
451
|
+
|
|
452
|
+
Use Checkboxes when the user can select multiple options from a group of choices. Each Checkbox should be coupled with a label or other indicator communicating what is being selected by checking the box.
|
|
453
|
+
|
|
454
|
+
Use the indeterminate variant to indicate a mixed selection; reserved for cases where "Select All" is an option as part of a group of Checkboxes.
|
|
455
|
+
|
|
456
|
+
#### Checkbox – No Label
|
|
457
|
+
|
|
458
|
+
Use when Checkbox functionality is needed but a custom label is desired.
|
|
459
|
+
|
|
460
|
+
| Default | Hover | Disabled |
|
|
461
|
+
| --- | --- | --- |
|
|
462
|
+
|
|
463
|
+
#### Checkbox – Label
|
|
464
|
+
|
|
465
|
+
| Default | Hover | Disabled |
|
|
466
|
+
| --- | --- | --- |
|
|
467
|
+
|
|
468
|
+
#### Checkbox – Label + Caption
|
|
469
|
+
|
|
470
|
+
| Default | Hover | Disabled |
|
|
471
|
+
| --- | --- | --- |
|
|
472
|
+
|
|
473
|
+
---
|
|
474
|
+
|
|
475
|
+
### Checkbox Spacing
|
|
476
|
+
|
|
477
|
+
These rules establish how much margin should exist between and around elements.
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
### Intent Variations
|
|
482
|
+
|
|
483
|
+
Use Default to communicate that the user has yet to enter a response, Negative to communicate when a user has entered an incorrect or incomplete response, and Notice when a user's response needs attention. Optionally, Intent Messages can be displayed to further communicate why a Negative or Notice intent was triggered. For more information see Intents.
|
|
484
|
+
|
|
485
|
+
| Default | Negative | Negative + Intent Message | Notice | Notice + Intent Message |
|
|
486
|
+
| --- | --- | --- | --- | --- |
|
|
487
|
+
|
|
488
|
+
---
|
|
489
|
+
|
|
490
|
+
## Radio
|
|
491
|
+
|
|
492
|
+
| | In Figma | | | Meets Accessibility | | | In Code |
|
|
493
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
494
|
+
|
|
495
|
+
### Live Instance
|
|
496
|
+
|
|
497
|
+
Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
|
|
498
|
+
|
|
499
|
+
Default
|
|
500
|
+
|
|
501
|
+
---
|
|
502
|
+
|
|
503
|
+
### Overview
|
|
504
|
+
|
|
505
|
+
Use Radios when the user can only select one option from a group of choices. Each Radio must be coupled with a label (and optional caption) to communicate the result of a selection. If using the No Label variant, a custom label must be implemented as a separate element.
|
|
506
|
+
|
|
507
|
+
#### Radio – No Label
|
|
508
|
+
|
|
509
|
+
Use when Radio functionality is needed but a custom label is desired.
|
|
510
|
+
|
|
511
|
+
| Default | Hover | Disabled |
|
|
512
|
+
| --- | --- | --- |
|
|
513
|
+
|
|
514
|
+
| Default | Disabled |
|
|
515
|
+
| --- | --- |
|
|
516
|
+
|
|
517
|
+
#### Radio – Label
|
|
518
|
+
|
|
519
|
+
| Default | Hover | Disabled |
|
|
520
|
+
| --- | --- | --- |
|
|
521
|
+
|
|
522
|
+
| Default | Disabled |
|
|
523
|
+
| --- | --- |
|
|
524
|
+
|
|
525
|
+
#### Radio – Label + Caption
|
|
526
|
+
|
|
527
|
+
| Default | Hover | Disabled |
|
|
528
|
+
| --- | --- | --- |
|
|
529
|
+
|
|
530
|
+
| Default | Disabled |
|
|
531
|
+
| --- | --- |
|
|
532
|
+
|
|
533
|
+
---
|
|
534
|
+
|
|
535
|
+
### Radio Spacing
|
|
536
|
+
|
|
537
|
+
These rules establish how much margin should exist between and around elements.
|
|
538
|
+
|
|
539
|
+
---
|
|
540
|
+
|
|
541
|
+
### Intent Variations
|
|
542
|
+
|
|
543
|
+
Use Default to communicate that the user has yet to enter a response, Negative to communicate when a user has entered an incorrect or incomplete response, and Notice when a user's response needs attention. Optionally, Intent Messages can be displayed to further communicate why a Negative or Notice intent was triggered. For more information see Intents.
|
|
544
|
+
|
|
545
|
+
| Default | Negative | Negative + Intent Message | Notice | Notice + intent Message |
|
|
546
|
+
| --- | --- | --- | --- | --- |
|
|
547
|
+
|
|
548
|
+
---
|
|
549
|
+
|
|
550
|
+
## Slider
|
|
551
|
+
|
|
552
|
+
| | In Figma | | | Meets Accessibility | | | In Code |
|
|
553
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
554
|
+
|
|
555
|
+
### Live Instance
|
|
556
|
+
|
|
557
|
+
Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
|
|
558
|
+
|
|
559
|
+
Default
|
|
560
|
+
|
|
561
|
+
---
|
|
562
|
+
|
|
563
|
+
### Overview
|
|
564
|
+
|
|
565
|
+
Sliders allow users to select specific values or a range of values to input. Optionally, Sliders can include tick marks to provide context to users about the values available for selection.
|
|
566
|
+
|
|
567
|
+
#### Slider – Single-sided
|
|
568
|
+
|
|
569
|
+
Use when there is a specific datapoint or value within a dataset that the user is able to select.
|
|
570
|
+
|
|
571
|
+
| No Tick Marks | Tick Marks |
|
|
572
|
+
| --- | --- |
|
|
573
|
+
|
|
574
|
+
#### Slider – Double-sided
|
|
575
|
+
|
|
576
|
+
Use when users need the ability to select a range between two values within a dataset.
|
|
577
|
+
|
|
578
|
+
| No Tick Marks | Tick Marks |
|
|
579
|
+
| --- | --- |
|
|
580
|
+
|
|
581
|
+
---
|
|
582
|
+
|
|
583
|
+
### Slider Spacing
|
|
584
|
+
|
|
585
|
+
These rules establish how much margin should exist between and around elements.
|
|
586
|
+
|
|
587
|
+
---
|
|
588
|
+
|
|
589
|
+
## Toggle Input
|
|
590
|
+
|
|
591
|
+
| | In Figma | | | Meets Accessibility | | | In Code |
|
|
592
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
593
|
+
|
|
594
|
+
### Live Instance
|
|
595
|
+
|
|
596
|
+
Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
|
|
597
|
+
|
|
598
|
+
Default
|
|
599
|
+
|
|
600
|
+
---
|
|
601
|
+
|
|
602
|
+
### Overview
|
|
603
|
+
|
|
604
|
+
Toggle Inputs allow users to indicate true or false as part of a form or flip a setting or option from off to on (and vise versa). For toggling visibility of UI elements (like Panels), use a Toggle Button.
|
|
605
|
+
|
|
606
|
+
| Default | Hover | Disabled |
|
|
607
|
+
| --- | --- | --- |
|
|
608
|
+
|
|
609
|
+
---
|
|
610
|
+
|
|
611
|
+
### Toggle Input Spacing
|
|
612
|
+
|
|
613
|
+
These rules establish how much margin should exist between and around elements.
|
|
614
|
+
|
|
615
|
+
## Code
|
|
616
|
+
|
|
617
|
+
## Control Input Components
|
|
618
|
+
|
|
619
|
+
| There are a range of Control Input components available to use depending on the type of action or response the application needs from the user. | | **Jump to component:** InputCheckbox InputRadio InputSlider InputToggle |
|
|
620
|
+
| --- | --- | --- |
|
|
621
|
+
|
|
622
|
+
### Visual Preview
|
|
623
|
+
|
|
624
|
+
>**Note:** The code examples below must install dependencies before displaying and may take extra time to load
|
|
625
|
+
|
|
626
|
+
---
|
|
627
|
+
|
|
628
|
+
## InputCheckbox
|
|
629
|
+
|
|
630
|
+
### SDS Source Code
|
|
631
|
+
|
|
632
|
+
The component's source code in the SDS codebase can be found here.
|
|
633
|
+
|
|
634
|
+
### SDS vs MUI
|
|
635
|
+
|
|
636
|
+
The following props and options differ in how they function across the MUI `Checkbox` component and the SDS `InputCheckbox` component:
|
|
637
|
+
|
|
638
|
+
* **`size`****:** Has no effect in SDS
|
|
639
|
+
* **`color`****:** Has no effect in SDS
|
|
640
|
+
* **`labelPlacement`****:** Has no effect in SDS
|
|
641
|
+
* **`icon`****:** SDS's `InputCheckbox` is not currently set up to support icons (if you add one as shown in the MUI documentation, it will replace the empty checkbox square, but clicking the icon will result in the checked checkbox square appearing in the icon's place)
|
|
642
|
+
* **`stage`** **and checkbox state :** This is the SDS prop that sets the checkbox's state as `unchecked`, `checked`, or `indeterminate`. If `stage` is set, interacting with the component has no effect in changing the checkbox state. By contrast, MUI has a boolean `defaultChecked` prop that sets the checkbox's state and *does* allow the user to interact to change the state.
|
|
643
|
+
* **`caption`****:** This is an SDS-specific prop, which takes a string of text that is displayed below the primary `label` text.
|
|
644
|
+
|
|
645
|
+
The following props are available for both the MUI and SDS components: **`required`**, **`disabled`**, and **`indeterminate`****.**
|
|
646
|
+
|
|
647
|
+
### MUI Documentation
|
|
648
|
+
|
|
649
|
+
Documentation for the underlying MUI component can be found here.
|
|
650
|
+
|
|
651
|
+
### Props
|
|
652
|
+
|
|
653
|
+
Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
|
|
654
|
+
|
|
655
|
+
| Name | Type | Default | Description |
|
|
656
|
+
| --- | --- | --- | --- |
|
|
657
|
+
| `caption` | `string` | `-` | The caption of the InputCheckbox appears beneath the label in a lighter text color. |
|
|
658
|
+
| `checkboxProps` | `Partial<MUICheckboxProps>` | `{}` | Directly pass these props to the underlying MUI checkbox. |
|
|
659
|
+
| `label` | `string` | `-` | The label of the InputCheckbox. |
|
|
660
|
+
| `stage` | `"checked"` `| "unchecked"` `| "indeterminate"` | | Defines the stage or state of the checkbox. |
|
|
661
|
+
| `intent` | `"default"` `| "notice"` `| "negative"` `| "positive"` | `"default"` | Defines the color of the `InputCheckbox` |
|
|
662
|
+
| `disabled` | `bool` | `false` | If `true`, the component is disabled. |
|
|
663
|
+
|
|
664
|
+
### Code examples
|
|
665
|
+
|
|
666
|
+
#### **Default InputCheckbox**
|
|
667
|
+
|
|
668
|
+
This example has the minimum props needed for the `InputCheckbox` component.
|
|
669
|
+
|
|
670
|
+
**/styles.css**
|
|
671
|
+
|
|
672
|
+
```css
|
|
673
|
+
body {
|
|
674
|
+
font-size: 13px;
|
|
675
|
+
font-weight: 400;
|
|
676
|
+
letter-spacing: 0.08px;
|
|
677
|
+
line-height: 20px;
|
|
678
|
+
text-transform: none;
|
|
679
|
+
font-family: "Inter", sans-serif;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
h1 {
|
|
683
|
+
font-size: 1.5rem;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
.app {
|
|
687
|
+
padding: 20px;
|
|
688
|
+
}
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
**tsconfig.json**
|
|
692
|
+
|
|
693
|
+
```json
|
|
694
|
+
{
|
|
695
|
+
"include": [
|
|
696
|
+
"./**/*"
|
|
697
|
+
],
|
|
698
|
+
"compilerOptions": {
|
|
699
|
+
"strict": true,
|
|
700
|
+
"esModuleInterop": true,
|
|
701
|
+
"lib": [ "dom", "es2015" ],
|
|
702
|
+
"jsx": "react-jsx"
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
**/App.tsx**
|
|
708
|
+
|
|
709
|
+
```tsx
|
|
710
|
+
import { InputCheckbox } from "@czi-sds/components";
|
|
711
|
+
import "./styles.css";
|
|
712
|
+
|
|
713
|
+
function App() {
|
|
714
|
+
return (
|
|
715
|
+
<div className="app">
|
|
716
|
+
<InputCheckbox
|
|
717
|
+
label="Label"
|
|
718
|
+
/>
|
|
719
|
+
</div>
|
|
720
|
+
);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
export default App;
|
|
724
|
+
```
|
|
725
|
+
|
|
726
|
+
**/index.tsx**
|
|
727
|
+
|
|
728
|
+
```tsx
|
|
729
|
+
import React from "react";
|
|
730
|
+
import { createRoot } from "react-dom/client";
|
|
731
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
732
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
733
|
+
import { Theme } from "@czi-sds/components";
|
|
734
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
735
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
736
|
+
|
|
737
|
+
import App from "./App";
|
|
738
|
+
|
|
739
|
+
const container = document.getElementById("root");
|
|
740
|
+
const root = createRoot(container!);
|
|
741
|
+
|
|
742
|
+
const RootApp = () => {
|
|
743
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
744
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
745
|
+
|
|
746
|
+
return (
|
|
747
|
+
<StyledEngineProvider injectFirst>
|
|
748
|
+
<ThemeProvider theme={theme}>
|
|
749
|
+
<EmotionThemeProvider theme={theme}>
|
|
750
|
+
<CssBaseline />
|
|
751
|
+
<App />
|
|
752
|
+
</EmotionThemeProvider>
|
|
753
|
+
</ThemeProvider>
|
|
754
|
+
</StyledEngineProvider>
|
|
755
|
+
);
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
root.render(
|
|
759
|
+
<React.StrictMode>
|
|
760
|
+
<RootApp />
|
|
761
|
+
</React.StrictMode>
|
|
762
|
+
);
|
|
763
|
+
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
**/public/index.html**
|
|
767
|
+
|
|
768
|
+
```html
|
|
769
|
+
<!DOCTYPE html>
|
|
770
|
+
<html lang="en">
|
|
771
|
+
<head>
|
|
772
|
+
<meta charset="UTF-8" />
|
|
773
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
774
|
+
<title>Control Inputs</title>
|
|
775
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
776
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
777
|
+
<link
|
|
778
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
779
|
+
rel="stylesheet"
|
|
780
|
+
/>
|
|
781
|
+
<link
|
|
782
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
783
|
+
rel="stylesheet"
|
|
784
|
+
/>
|
|
785
|
+
</head>
|
|
786
|
+
<body>
|
|
787
|
+
<div id="root"></div>
|
|
788
|
+
</body>
|
|
789
|
+
</html>
|
|
790
|
+
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
**/package.json**
|
|
794
|
+
|
|
795
|
+
```json
|
|
796
|
+
{"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"}
|
|
797
|
+
```
|
|
798
|
+
|
|
799
|
+
---
|
|
800
|
+
|
|
801
|
+
#### InputCheckbox + Caption
|
|
802
|
+
|
|
803
|
+
This example shows the `InputCheckbox` with an additional caption beneath the label, presented in a lighter text color.
|
|
804
|
+
|
|
805
|
+
**/styles.css**
|
|
806
|
+
|
|
807
|
+
```css
|
|
808
|
+
body {
|
|
809
|
+
font-size: 13px;
|
|
810
|
+
font-weight: 400;
|
|
811
|
+
letter-spacing: 0.08px;
|
|
812
|
+
line-height: 20px;
|
|
813
|
+
text-transform: none;
|
|
814
|
+
font-family: "Inter", sans-serif;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
h1 {
|
|
818
|
+
font-size: 1.5rem;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
.app {
|
|
822
|
+
padding: 20px;
|
|
823
|
+
}
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
**tsconfig.json**
|
|
827
|
+
|
|
828
|
+
```json
|
|
829
|
+
{
|
|
830
|
+
"include": [
|
|
831
|
+
"./**/*"
|
|
832
|
+
],
|
|
833
|
+
"compilerOptions": {
|
|
834
|
+
"strict": true,
|
|
835
|
+
"esModuleInterop": true,
|
|
836
|
+
"lib": [ "dom", "es2015" ],
|
|
837
|
+
"jsx": "react-jsx"
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
```
|
|
841
|
+
|
|
842
|
+
**/App.tsx**
|
|
843
|
+
|
|
844
|
+
```tsx
|
|
845
|
+
import { InputCheckbox } from "@czi-sds/components";
|
|
846
|
+
import "./styles.css";
|
|
847
|
+
|
|
848
|
+
function App() {
|
|
849
|
+
return (
|
|
850
|
+
<div className="app">
|
|
851
|
+
<InputCheckbox
|
|
852
|
+
caption="Caption"
|
|
853
|
+
label="Label"
|
|
854
|
+
/>
|
|
855
|
+
</div>
|
|
856
|
+
);
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
export default App;
|
|
860
|
+
```
|
|
861
|
+
|
|
862
|
+
**/index.tsx**
|
|
863
|
+
|
|
864
|
+
```tsx
|
|
865
|
+
import React from "react";
|
|
866
|
+
import { createRoot } from "react-dom/client";
|
|
867
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
868
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
869
|
+
import { Theme } from "@czi-sds/components";
|
|
870
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
871
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
872
|
+
|
|
873
|
+
import App from "./App";
|
|
874
|
+
|
|
875
|
+
const container = document.getElementById("root");
|
|
876
|
+
const root = createRoot(container!);
|
|
877
|
+
|
|
878
|
+
const RootApp = () => {
|
|
879
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
880
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
881
|
+
|
|
882
|
+
return (
|
|
883
|
+
<StyledEngineProvider injectFirst>
|
|
884
|
+
<ThemeProvider theme={theme}>
|
|
885
|
+
<EmotionThemeProvider theme={theme}>
|
|
886
|
+
<CssBaseline />
|
|
887
|
+
<App />
|
|
888
|
+
</EmotionThemeProvider>
|
|
889
|
+
</ThemeProvider>
|
|
890
|
+
</StyledEngineProvider>
|
|
891
|
+
);
|
|
892
|
+
};
|
|
893
|
+
|
|
894
|
+
root.render(
|
|
895
|
+
<React.StrictMode>
|
|
896
|
+
<RootApp />
|
|
897
|
+
</React.StrictMode>
|
|
898
|
+
);
|
|
899
|
+
|
|
900
|
+
```
|
|
901
|
+
|
|
902
|
+
**/public/index.html**
|
|
903
|
+
|
|
904
|
+
```html
|
|
905
|
+
<!DOCTYPE html>
|
|
906
|
+
<html lang="en">
|
|
907
|
+
<head>
|
|
908
|
+
<meta charset="UTF-8" />
|
|
909
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
910
|
+
<title>Control Inputs</title>
|
|
911
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
912
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
913
|
+
<link
|
|
914
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
915
|
+
rel="stylesheet"
|
|
916
|
+
/>
|
|
917
|
+
<link
|
|
918
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
919
|
+
rel="stylesheet"
|
|
920
|
+
/>
|
|
921
|
+
</head>
|
|
922
|
+
<body>
|
|
923
|
+
<div id="root"></div>
|
|
924
|
+
</body>
|
|
925
|
+
</html>
|
|
926
|
+
|
|
927
|
+
```
|
|
928
|
+
|
|
929
|
+
**/package.json**
|
|
930
|
+
|
|
931
|
+
```json
|
|
932
|
+
{"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"}
|
|
933
|
+
```
|
|
934
|
+
|
|
935
|
+
---
|
|
936
|
+
|
|
937
|
+
#### Indeterminate Checkbox
|
|
938
|
+
|
|
939
|
+
This example demonstrates a parent checkbox initially set to an indeterminate stage. When all the child checkboxes are checked, the parent checkbox transitions to a checked state.
|
|
940
|
+
|
|
941
|
+
**/styles.css**
|
|
942
|
+
|
|
943
|
+
```css
|
|
944
|
+
body {
|
|
945
|
+
font-size: 13px;
|
|
946
|
+
font-weight: 400;
|
|
947
|
+
letter-spacing: 0.08px;
|
|
948
|
+
line-height: 20px;
|
|
949
|
+
text-transform: none;
|
|
950
|
+
font-family: "Inter", sans-serif;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
h1 {
|
|
954
|
+
font-size: 1.5rem;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
.app {
|
|
958
|
+
padding: 20px;
|
|
959
|
+
}
|
|
960
|
+
```
|
|
961
|
+
|
|
962
|
+
**tsconfig.json**
|
|
963
|
+
|
|
964
|
+
```json
|
|
965
|
+
{
|
|
966
|
+
"include": [
|
|
967
|
+
"./**/*"
|
|
968
|
+
],
|
|
969
|
+
"compilerOptions": {
|
|
970
|
+
"strict": true,
|
|
971
|
+
"esModuleInterop": true,
|
|
972
|
+
"lib": [ "dom", "es2015" ],
|
|
973
|
+
"jsx": "react-jsx"
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
```
|
|
977
|
+
|
|
978
|
+
**/App.tsx**
|
|
979
|
+
|
|
980
|
+
```tsx
|
|
981
|
+
import { useState } from "react";
|
|
982
|
+
import { Box } from "@mui/material";
|
|
983
|
+
import { InputCheckbox } from "@czi-sds/components";
|
|
984
|
+
import "./styles.css";
|
|
985
|
+
|
|
986
|
+
function App() {
|
|
987
|
+
const [checked, setChecked] = useState([true, false]);
|
|
988
|
+
|
|
989
|
+
const handleChange1 = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
990
|
+
setChecked([event.target.checked, event.target.checked]);
|
|
991
|
+
};
|
|
992
|
+
|
|
993
|
+
const handleChange2 = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
994
|
+
setChecked([event.target.checked, checked[1]]);
|
|
995
|
+
};
|
|
996
|
+
|
|
997
|
+
const handleChange3 = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
998
|
+
setChecked([checked[0], event.target.checked]);
|
|
999
|
+
};
|
|
1000
|
+
|
|
1001
|
+
const children = (
|
|
1002
|
+
<Box sx={{ display: "flex", flexDirection: "column", ml: 6 }}>
|
|
1003
|
+
<InputCheckbox
|
|
1004
|
+
label="Child 1"
|
|
1005
|
+
checkboxProps={{
|
|
1006
|
+
checked: checked[0],
|
|
1007
|
+
onChange: handleChange2,
|
|
1008
|
+
}}
|
|
1009
|
+
/>
|
|
1010
|
+
<InputCheckbox
|
|
1011
|
+
label="Child 2"
|
|
1012
|
+
checkboxProps={{
|
|
1013
|
+
checked: checked[1],
|
|
1014
|
+
onChange: handleChange3,
|
|
1015
|
+
}}
|
|
1016
|
+
/>
|
|
1017
|
+
</Box>
|
|
1018
|
+
);
|
|
1019
|
+
|
|
1020
|
+
return (
|
|
1021
|
+
<div className="app">
|
|
1022
|
+
<InputCheckbox
|
|
1023
|
+
label="Parent"
|
|
1024
|
+
checkboxProps={{
|
|
1025
|
+
checked: checked[0] && checked[1],
|
|
1026
|
+
indeterminate: checked[0] !== checked[1],
|
|
1027
|
+
onChange: handleChange1,
|
|
1028
|
+
}}
|
|
1029
|
+
/>
|
|
1030
|
+
{children}
|
|
1031
|
+
</div>
|
|
1032
|
+
);
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
export default App;
|
|
1036
|
+
```
|
|
1037
|
+
|
|
1038
|
+
**/index.tsx**
|
|
1039
|
+
|
|
1040
|
+
```tsx
|
|
1041
|
+
import React from "react";
|
|
1042
|
+
import { createRoot } from "react-dom/client";
|
|
1043
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
1044
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
1045
|
+
import { Theme } from "@czi-sds/components";
|
|
1046
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
1047
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
1048
|
+
|
|
1049
|
+
import App from "./App";
|
|
1050
|
+
|
|
1051
|
+
const container = document.getElementById("root");
|
|
1052
|
+
const root = createRoot(container!);
|
|
1053
|
+
|
|
1054
|
+
const RootApp = () => {
|
|
1055
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
1056
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
1057
|
+
|
|
1058
|
+
return (
|
|
1059
|
+
<StyledEngineProvider injectFirst>
|
|
1060
|
+
<ThemeProvider theme={theme}>
|
|
1061
|
+
<EmotionThemeProvider theme={theme}>
|
|
1062
|
+
<CssBaseline />
|
|
1063
|
+
<App />
|
|
1064
|
+
</EmotionThemeProvider>
|
|
1065
|
+
</ThemeProvider>
|
|
1066
|
+
</StyledEngineProvider>
|
|
1067
|
+
);
|
|
1068
|
+
};
|
|
1069
|
+
|
|
1070
|
+
root.render(
|
|
1071
|
+
<React.StrictMode>
|
|
1072
|
+
<RootApp />
|
|
1073
|
+
</React.StrictMode>
|
|
1074
|
+
);
|
|
1075
|
+
|
|
1076
|
+
```
|
|
1077
|
+
|
|
1078
|
+
**/public/index.html**
|
|
1079
|
+
|
|
1080
|
+
```html
|
|
1081
|
+
<!DOCTYPE html>
|
|
1082
|
+
<html lang="en">
|
|
1083
|
+
<head>
|
|
1084
|
+
<meta charset="UTF-8" />
|
|
1085
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1086
|
+
<title>Control Inputs</title>
|
|
1087
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
1088
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
1089
|
+
<link
|
|
1090
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
1091
|
+
rel="stylesheet"
|
|
1092
|
+
/>
|
|
1093
|
+
<link
|
|
1094
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
1095
|
+
rel="stylesheet"
|
|
1096
|
+
/>
|
|
1097
|
+
</head>
|
|
1098
|
+
<body>
|
|
1099
|
+
<div id="root"></div>
|
|
1100
|
+
</body>
|
|
1101
|
+
</html>
|
|
1102
|
+
|
|
1103
|
+
```
|
|
1104
|
+
|
|
1105
|
+
**/package.json**
|
|
1106
|
+
|
|
1107
|
+
```json
|
|
1108
|
+
{"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"}
|
|
1109
|
+
```
|
|
1110
|
+
|
|
1111
|
+
---
|
|
1112
|
+
|
|
1113
|
+
---
|
|
1114
|
+
|
|
1115
|
+
## InputRadio
|
|
1116
|
+
|
|
1117
|
+
### SDS Source Code
|
|
1118
|
+
|
|
1119
|
+
The component's source code in the SDS codebase can be found here.
|
|
1120
|
+
|
|
1121
|
+
### SDS vs MUI
|
|
1122
|
+
|
|
1123
|
+
The following props and options differ in whether and how they function across MUI versus SDS's `InputRadio` component:
|
|
1124
|
+
|
|
1125
|
+
* **`size`****:** Has no effect in SDS
|
|
1126
|
+
* **`color`****:** Has no effect in SDS
|
|
1127
|
+
* **`labelPlacement`****:** Has no effect in SDS
|
|
1128
|
+
* **`caption`****:** This is an SDS-specific prop, which takes a string of text that is desplayed below the primary `label` text.
|
|
1129
|
+
* **`row`****:** This boolean prop functions the same for both MUI and SDS's `InputRadio` component: its presence reformats the radio buttons (and their labels) within the `RadioGroup` parent component into a horizontal row.
|
|
1130
|
+
|
|
1131
|
+
### MUI Documentation
|
|
1132
|
+
|
|
1133
|
+
Documentation for the underlying MUI component can be found here.
|
|
1134
|
+
|
|
1135
|
+
### Props
|
|
1136
|
+
|
|
1137
|
+
Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
|
|
1138
|
+
|
|
1139
|
+
| Name | Type | Default | Description |
|
|
1140
|
+
| --- | --- | --- | --- |
|
|
1141
|
+
| `caption` | `string` | - | The caption of the InputRadio appears beneath the label in a lighter text color. |
|
|
1142
|
+
| `label` | `string` | - | The label of the InputCheckbox. |
|
|
1143
|
+
| `radioProps` | `Partial<MUIRadioProps>` | `{}` | Directly pass these props to the underlying MUI radio. |
|
|
1144
|
+
| `stage` | `"checked" | "unchecked"` | `unchecked` | The stage of the radio input. |
|
|
1145
|
+
| `intent` | `"default"` `| "notice"` `| "negative"` `| "positive"` | `"default"` | Defines the color of the `InputRadio` |
|
|
1146
|
+
| `disabled` | `bool` | `false` | If `true`, the component is disabled. |
|
|
1147
|
+
|
|
1148
|
+
### Code examples
|
|
1149
|
+
|
|
1150
|
+
#### **Default InputRadio**
|
|
1151
|
+
|
|
1152
|
+
This example has the minimum props needed for the `InputRadio` component.
|
|
1153
|
+
|
|
1154
|
+
**/styles.css**
|
|
1155
|
+
|
|
1156
|
+
```css
|
|
1157
|
+
body {
|
|
1158
|
+
font-size: 13px;
|
|
1159
|
+
font-weight: 400;
|
|
1160
|
+
letter-spacing: 0.08px;
|
|
1161
|
+
line-height: 20px;
|
|
1162
|
+
text-transform: none;
|
|
1163
|
+
font-family: "Inter", sans-serif;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
h1 {
|
|
1167
|
+
font-size: 1.5rem;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
.app {
|
|
1171
|
+
padding: 20px;
|
|
1172
|
+
}
|
|
1173
|
+
```
|
|
1174
|
+
|
|
1175
|
+
**tsconfig.json**
|
|
1176
|
+
|
|
1177
|
+
```json
|
|
1178
|
+
{
|
|
1179
|
+
"include": [
|
|
1180
|
+
"./**/*"
|
|
1181
|
+
],
|
|
1182
|
+
"compilerOptions": {
|
|
1183
|
+
"strict": true,
|
|
1184
|
+
"esModuleInterop": true,
|
|
1185
|
+
"lib": [ "dom", "es2015" ],
|
|
1186
|
+
"jsx": "react-jsx"
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
```
|
|
1190
|
+
|
|
1191
|
+
**/App.tsx**
|
|
1192
|
+
|
|
1193
|
+
```tsx
|
|
1194
|
+
import { InputRadio } from "@czi-sds/components";
|
|
1195
|
+
import "./styles.css";
|
|
1196
|
+
|
|
1197
|
+
function App() {
|
|
1198
|
+
return (
|
|
1199
|
+
<div className="app">
|
|
1200
|
+
<InputRadio
|
|
1201
|
+
label="Label"
|
|
1202
|
+
/>
|
|
1203
|
+
</div>
|
|
1204
|
+
);
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
export default App;
|
|
1208
|
+
```
|
|
1209
|
+
|
|
1210
|
+
**/index.tsx**
|
|
1211
|
+
|
|
1212
|
+
```tsx
|
|
1213
|
+
import React from "react";
|
|
1214
|
+
import { createRoot } from "react-dom/client";
|
|
1215
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
1216
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
1217
|
+
import { Theme } from "@czi-sds/components";
|
|
1218
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
1219
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
1220
|
+
|
|
1221
|
+
import App from "./App";
|
|
1222
|
+
|
|
1223
|
+
const container = document.getElementById("root");
|
|
1224
|
+
const root = createRoot(container!);
|
|
1225
|
+
|
|
1226
|
+
const RootApp = () => {
|
|
1227
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
1228
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
1229
|
+
|
|
1230
|
+
return (
|
|
1231
|
+
<StyledEngineProvider injectFirst>
|
|
1232
|
+
<ThemeProvider theme={theme}>
|
|
1233
|
+
<EmotionThemeProvider theme={theme}>
|
|
1234
|
+
<CssBaseline />
|
|
1235
|
+
<App />
|
|
1236
|
+
</EmotionThemeProvider>
|
|
1237
|
+
</ThemeProvider>
|
|
1238
|
+
</StyledEngineProvider>
|
|
1239
|
+
);
|
|
1240
|
+
};
|
|
1241
|
+
|
|
1242
|
+
root.render(
|
|
1243
|
+
<React.StrictMode>
|
|
1244
|
+
<RootApp />
|
|
1245
|
+
</React.StrictMode>
|
|
1246
|
+
);
|
|
1247
|
+
|
|
1248
|
+
```
|
|
1249
|
+
|
|
1250
|
+
**/public/index.html**
|
|
1251
|
+
|
|
1252
|
+
```html
|
|
1253
|
+
<!DOCTYPE html>
|
|
1254
|
+
<html lang="en">
|
|
1255
|
+
<head>
|
|
1256
|
+
<meta charset="UTF-8" />
|
|
1257
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1258
|
+
<title>Control Inputs</title>
|
|
1259
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
1260
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
1261
|
+
<link
|
|
1262
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
1263
|
+
rel="stylesheet"
|
|
1264
|
+
/>
|
|
1265
|
+
<link
|
|
1266
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
1267
|
+
rel="stylesheet"
|
|
1268
|
+
/>
|
|
1269
|
+
</head>
|
|
1270
|
+
<body>
|
|
1271
|
+
<div id="root"></div>
|
|
1272
|
+
</body>
|
|
1273
|
+
</html>
|
|
1274
|
+
|
|
1275
|
+
```
|
|
1276
|
+
|
|
1277
|
+
**/package.json**
|
|
1278
|
+
|
|
1279
|
+
```json
|
|
1280
|
+
{"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"}
|
|
1281
|
+
```
|
|
1282
|
+
|
|
1283
|
+
---
|
|
1284
|
+
|
|
1285
|
+
#### InputRadio + Caption
|
|
1286
|
+
|
|
1287
|
+
This example shows the `InputRadio` with an additional caption beneath the label, presented in a lighter text color.
|
|
1288
|
+
|
|
1289
|
+
**/styles.css**
|
|
1290
|
+
|
|
1291
|
+
```css
|
|
1292
|
+
body {
|
|
1293
|
+
font-size: 13px;
|
|
1294
|
+
font-weight: 400;
|
|
1295
|
+
letter-spacing: 0.08px;
|
|
1296
|
+
line-height: 20px;
|
|
1297
|
+
text-transform: none;
|
|
1298
|
+
font-family: "Inter", sans-serif;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
h1 {
|
|
1302
|
+
font-size: 1.5rem;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
.app {
|
|
1306
|
+
padding: 20px;
|
|
1307
|
+
}
|
|
1308
|
+
```
|
|
1309
|
+
|
|
1310
|
+
**tsconfig.json**
|
|
1311
|
+
|
|
1312
|
+
```json
|
|
1313
|
+
{
|
|
1314
|
+
"include": [
|
|
1315
|
+
"./**/*"
|
|
1316
|
+
],
|
|
1317
|
+
"compilerOptions": {
|
|
1318
|
+
"strict": true,
|
|
1319
|
+
"esModuleInterop": true,
|
|
1320
|
+
"lib": [ "dom", "es2015" ],
|
|
1321
|
+
"jsx": "react-jsx"
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
```
|
|
1325
|
+
|
|
1326
|
+
**/App.tsx**
|
|
1327
|
+
|
|
1328
|
+
```tsx
|
|
1329
|
+
import { InputRadio } from "@czi-sds/components";
|
|
1330
|
+
import "./styles.css";
|
|
1331
|
+
|
|
1332
|
+
function App() {
|
|
1333
|
+
return (
|
|
1334
|
+
<div className="app">
|
|
1335
|
+
<InputRadio
|
|
1336
|
+
caption="Caption"
|
|
1337
|
+
label="Label"
|
|
1338
|
+
/>
|
|
1339
|
+
</div>
|
|
1340
|
+
);
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
export default App;
|
|
1344
|
+
```
|
|
1345
|
+
|
|
1346
|
+
**/index.tsx**
|
|
1347
|
+
|
|
1348
|
+
```tsx
|
|
1349
|
+
import React from "react";
|
|
1350
|
+
import { createRoot } from "react-dom/client";
|
|
1351
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
1352
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
1353
|
+
import { Theme } from "@czi-sds/components";
|
|
1354
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
1355
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
1356
|
+
|
|
1357
|
+
import App from "./App";
|
|
1358
|
+
|
|
1359
|
+
const container = document.getElementById("root");
|
|
1360
|
+
const root = createRoot(container!);
|
|
1361
|
+
|
|
1362
|
+
const RootApp = () => {
|
|
1363
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
1364
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
1365
|
+
|
|
1366
|
+
return (
|
|
1367
|
+
<StyledEngineProvider injectFirst>
|
|
1368
|
+
<ThemeProvider theme={theme}>
|
|
1369
|
+
<EmotionThemeProvider theme={theme}>
|
|
1370
|
+
<CssBaseline />
|
|
1371
|
+
<App />
|
|
1372
|
+
</EmotionThemeProvider>
|
|
1373
|
+
</ThemeProvider>
|
|
1374
|
+
</StyledEngineProvider>
|
|
1375
|
+
);
|
|
1376
|
+
};
|
|
1377
|
+
|
|
1378
|
+
root.render(
|
|
1379
|
+
<React.StrictMode>
|
|
1380
|
+
<RootApp />
|
|
1381
|
+
</React.StrictMode>
|
|
1382
|
+
);
|
|
1383
|
+
|
|
1384
|
+
```
|
|
1385
|
+
|
|
1386
|
+
**/public/index.html**
|
|
1387
|
+
|
|
1388
|
+
```html
|
|
1389
|
+
<!DOCTYPE html>
|
|
1390
|
+
<html lang="en">
|
|
1391
|
+
<head>
|
|
1392
|
+
<meta charset="UTF-8" />
|
|
1393
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1394
|
+
<title>Control Inputs</title>
|
|
1395
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
1396
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
1397
|
+
<link
|
|
1398
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
1399
|
+
rel="stylesheet"
|
|
1400
|
+
/>
|
|
1401
|
+
<link
|
|
1402
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
1403
|
+
rel="stylesheet"
|
|
1404
|
+
/>
|
|
1405
|
+
</head>
|
|
1406
|
+
<body>
|
|
1407
|
+
<div id="root"></div>
|
|
1408
|
+
</body>
|
|
1409
|
+
</html>
|
|
1410
|
+
|
|
1411
|
+
```
|
|
1412
|
+
|
|
1413
|
+
**/package.json**
|
|
1414
|
+
|
|
1415
|
+
```json
|
|
1416
|
+
{"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"}
|
|
1417
|
+
```
|
|
1418
|
+
|
|
1419
|
+
---
|
|
1420
|
+
|
|
1421
|
+
---
|
|
1422
|
+
|
|
1423
|
+
## InputSlider
|
|
1424
|
+
|
|
1425
|
+
### SDS Source Code
|
|
1426
|
+
|
|
1427
|
+
The component's source code in the SDS codebase can be found here.
|
|
1428
|
+
|
|
1429
|
+
### SDS vs MUI
|
|
1430
|
+
|
|
1431
|
+
The following props and options differ in how they function across MUI's `Switch` component versus SDS's `InputToggle` component:
|
|
1432
|
+
|
|
1433
|
+
* **`size`****:** Has no effect in SDS
|
|
1434
|
+
* **`color`****:** Has no effect in SDS
|
|
1435
|
+
|
|
1436
|
+
These are some of the common props that can be used for both the MUI `Switch` component and the SDS `InputToggle` component:
|
|
1437
|
+
|
|
1438
|
+
* **`step`****:** Sets the step distance between selectable stops (and relatedly, if this prop is left out, the toggle is continuous, rather than discrete)
|
|
1439
|
+
* **`marks`****:** When present and set to true, invokes the default marks style. When passed a rich array (of objects containing the value and the custom label to show at that value), sets marks and labels only at the positions specified by the array. See the "InputSlider with custom Marks" example below.
|
|
1440
|
+
* **`valueLabelDisplay`****:** This prop determines whether and when the value label is displayed, and takes the following props: `auto` (the value label will display when the thumb is hovered or focused), `on` (default; labels display persistently), or `off` (labels are never displayed).
|
|
1441
|
+
* **`orientation`****:** This prop controls which direction the slider is shown: `horizontal` (default) or `vertical`
|
|
1442
|
+
|
|
1443
|
+
### MUI Documentation
|
|
1444
|
+
|
|
1445
|
+
Documentation for the underlying MUI component can be found here.
|
|
1446
|
+
|
|
1447
|
+
### Props
|
|
1448
|
+
|
|
1449
|
+
Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
|
|
1450
|
+
|
|
1451
|
+
| Name | Type | Default | Description |
|
|
1452
|
+
| --- | --- | --- | --- |
|
|
1453
|
+
| `defaultValue` | `Array<number> | number` | - | The default value. Use when the component is not controlled. |
|
|
1454
|
+
| `disabled` | `bool` | `false` | If `true`, the component is disabled. |
|
|
1455
|
+
| `marks` | `bool` | `false` | Marks indicate predetermined values to which the user can move the slider. If true the marks are spaced according the value of the step prop. If an array, it should contain objects with value and an optional label keys. |
|
|
1456
|
+
| `max` | `number` | `100` | The maximum allowed value of the slider. Should not be equal to min. |
|
|
1457
|
+
| `min` | `number` | `0` | The minimum allowed value of the slider. Should not be equal to max. |
|
|
1458
|
+
| `orientation` | `"horizontal"` | `horizontal` | The component orientation. |
|
|
1459
|
+
| `step` | `number` | `1` | The granularity with which the slider can step through values. (A "discrete" slider.) The `min` prop serves as the origin for the valid values. We recommend (max - min) to be evenly divisible by the step. When step is `null`, the thumb can only be slid onto marks provided with the `marks` prop. |
|
|
1460
|
+
| `valueLabelDisplay` | `"auto"` `| "off"` `| "on"` | `off` | Controls when the value label is displayed: `auto`. the value label will display when the thumb is hovered or focused. . `on`. will display persistently. . `off`. will never display. |
|
|
1461
|
+
|
|
1462
|
+
### Code examples
|
|
1463
|
+
|
|
1464
|
+
#### **Default InputSlider**
|
|
1465
|
+
|
|
1466
|
+
This example has the minimum props needed for the `InputRadio` component.
|
|
1467
|
+
|
|
1468
|
+
**/styles.css**
|
|
1469
|
+
|
|
1470
|
+
```css
|
|
1471
|
+
body {
|
|
1472
|
+
font-size: 13px;
|
|
1473
|
+
font-weight: 400;
|
|
1474
|
+
letter-spacing: 0.08px;
|
|
1475
|
+
line-height: 20px;
|
|
1476
|
+
text-transform: none;
|
|
1477
|
+
font-family: "Inter", sans-serif;
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
h1 {
|
|
1481
|
+
font-size: 1.5rem;
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
.app {
|
|
1485
|
+
padding: 20px;
|
|
1486
|
+
}
|
|
1487
|
+
```
|
|
1488
|
+
|
|
1489
|
+
**tsconfig.json**
|
|
1490
|
+
|
|
1491
|
+
```json
|
|
1492
|
+
{
|
|
1493
|
+
"include": [
|
|
1494
|
+
"./**/*"
|
|
1495
|
+
],
|
|
1496
|
+
"compilerOptions": {
|
|
1497
|
+
"strict": true,
|
|
1498
|
+
"esModuleInterop": true,
|
|
1499
|
+
"lib": [ "dom", "es2015" ],
|
|
1500
|
+
"jsx": "react-jsx"
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
```
|
|
1504
|
+
|
|
1505
|
+
**/App.tsx**
|
|
1506
|
+
|
|
1507
|
+
```tsx
|
|
1508
|
+
import { InputSlider } from "@czi-sds/components";
|
|
1509
|
+
import { Box } from "@mui/material";
|
|
1510
|
+
import "./styles.css";
|
|
1511
|
+
|
|
1512
|
+
function App() {
|
|
1513
|
+
return (
|
|
1514
|
+
<div className="app">
|
|
1515
|
+
<Box sx={{ width: 200 }}>
|
|
1516
|
+
<InputSlider
|
|
1517
|
+
label="Label"
|
|
1518
|
+
/>
|
|
1519
|
+
</Box>
|
|
1520
|
+
</div>
|
|
1521
|
+
);
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
export default App;
|
|
1525
|
+
```
|
|
1526
|
+
|
|
1527
|
+
**/index.tsx**
|
|
1528
|
+
|
|
1529
|
+
```tsx
|
|
1530
|
+
import React from "react";
|
|
1531
|
+
import { createRoot } from "react-dom/client";
|
|
1532
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
1533
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
1534
|
+
import { Theme } from "@czi-sds/components";
|
|
1535
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
1536
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
1537
|
+
|
|
1538
|
+
import App from "./App";
|
|
1539
|
+
|
|
1540
|
+
const container = document.getElementById("root");
|
|
1541
|
+
const root = createRoot(container!);
|
|
1542
|
+
|
|
1543
|
+
const RootApp = () => {
|
|
1544
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
1545
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
1546
|
+
|
|
1547
|
+
return (
|
|
1548
|
+
<StyledEngineProvider injectFirst>
|
|
1549
|
+
<ThemeProvider theme={theme}>
|
|
1550
|
+
<EmotionThemeProvider theme={theme}>
|
|
1551
|
+
<CssBaseline />
|
|
1552
|
+
<App />
|
|
1553
|
+
</EmotionThemeProvider>
|
|
1554
|
+
</ThemeProvider>
|
|
1555
|
+
</StyledEngineProvider>
|
|
1556
|
+
);
|
|
1557
|
+
};
|
|
1558
|
+
|
|
1559
|
+
root.render(
|
|
1560
|
+
<React.StrictMode>
|
|
1561
|
+
<RootApp />
|
|
1562
|
+
</React.StrictMode>
|
|
1563
|
+
);
|
|
1564
|
+
|
|
1565
|
+
```
|
|
1566
|
+
|
|
1567
|
+
**/public/index.html**
|
|
1568
|
+
|
|
1569
|
+
```html
|
|
1570
|
+
<!DOCTYPE html>
|
|
1571
|
+
<html lang="en">
|
|
1572
|
+
<head>
|
|
1573
|
+
<meta charset="UTF-8" />
|
|
1574
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1575
|
+
<title>Control Inputs</title>
|
|
1576
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
1577
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
1578
|
+
<link
|
|
1579
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
1580
|
+
rel="stylesheet"
|
|
1581
|
+
/>
|
|
1582
|
+
<link
|
|
1583
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
1584
|
+
rel="stylesheet"
|
|
1585
|
+
/>
|
|
1586
|
+
</head>
|
|
1587
|
+
<body>
|
|
1588
|
+
<div id="root"></div>
|
|
1589
|
+
</body>
|
|
1590
|
+
</html>
|
|
1591
|
+
|
|
1592
|
+
```
|
|
1593
|
+
|
|
1594
|
+
**/package.json**
|
|
1595
|
+
|
|
1596
|
+
```json
|
|
1597
|
+
{"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"}
|
|
1598
|
+
```
|
|
1599
|
+
|
|
1600
|
+
---
|
|
1601
|
+
|
|
1602
|
+
#### InputSlider with custom Marks
|
|
1603
|
+
|
|
1604
|
+
This example shows an `InputSlider` component that features custom marks precisely positioned at `0%`, `50%`, and `100%` of the slider's value.
|
|
1605
|
+
|
|
1606
|
+
**/styles.css**
|
|
1607
|
+
|
|
1608
|
+
```css
|
|
1609
|
+
body {
|
|
1610
|
+
font-size: 13px;
|
|
1611
|
+
font-weight: 400;
|
|
1612
|
+
letter-spacing: 0.08px;
|
|
1613
|
+
line-height: 20px;
|
|
1614
|
+
text-transform: none;
|
|
1615
|
+
font-family: "Inter", sans-serif;
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
h1 {
|
|
1619
|
+
font-size: 1.5rem;
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
.app {
|
|
1623
|
+
padding: 20px;
|
|
1624
|
+
}
|
|
1625
|
+
```
|
|
1626
|
+
|
|
1627
|
+
**tsconfig.json**
|
|
1628
|
+
|
|
1629
|
+
```json
|
|
1630
|
+
{
|
|
1631
|
+
"include": [
|
|
1632
|
+
"./**/*"
|
|
1633
|
+
],
|
|
1634
|
+
"compilerOptions": {
|
|
1635
|
+
"strict": true,
|
|
1636
|
+
"esModuleInterop": true,
|
|
1637
|
+
"lib": [ "dom", "es2015" ],
|
|
1638
|
+
"jsx": "react-jsx"
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
```
|
|
1642
|
+
|
|
1643
|
+
**/App.tsx**
|
|
1644
|
+
|
|
1645
|
+
```tsx
|
|
1646
|
+
import { InputSlider } from "@czi-sds/components";
|
|
1647
|
+
import { Box } from "@mui/material";
|
|
1648
|
+
import "./styles.css";
|
|
1649
|
+
|
|
1650
|
+
const generateCustomMarks = (min: number, max: number) => {
|
|
1651
|
+
return [
|
|
1652
|
+
{
|
|
1653
|
+
label: min,
|
|
1654
|
+
value: min,
|
|
1655
|
+
},
|
|
1656
|
+
{
|
|
1657
|
+
label: ((max - min) / 2 + min).toFixed(0),
|
|
1658
|
+
value: (max - min) / 2 + min,
|
|
1659
|
+
},
|
|
1660
|
+
{
|
|
1661
|
+
label: max,
|
|
1662
|
+
value: max,
|
|
1663
|
+
},
|
|
1664
|
+
];
|
|
1665
|
+
};
|
|
1666
|
+
|
|
1667
|
+
function App() {
|
|
1668
|
+
return (
|
|
1669
|
+
<div className="app">
|
|
1670
|
+
<Box sx={{ width: 200 }}>
|
|
1671
|
+
<InputSlider
|
|
1672
|
+
label="Label"
|
|
1673
|
+
marks={generateCustomMarks(0, 100)}
|
|
1674
|
+
min={0}
|
|
1675
|
+
max={100}
|
|
1676
|
+
step={5}
|
|
1677
|
+
valueLabelDisplay
|
|
1678
|
+
/>
|
|
1679
|
+
</Box>
|
|
1680
|
+
</div>
|
|
1681
|
+
);
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
export default App;
|
|
1685
|
+
```
|
|
1686
|
+
|
|
1687
|
+
**/index.tsx**
|
|
1688
|
+
|
|
1689
|
+
```tsx
|
|
1690
|
+
import React from "react";
|
|
1691
|
+
import { createRoot } from "react-dom/client";
|
|
1692
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
1693
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
1694
|
+
import { Theme } from "@czi-sds/components";
|
|
1695
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
1696
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
1697
|
+
|
|
1698
|
+
import App from "./App";
|
|
1699
|
+
|
|
1700
|
+
const container = document.getElementById("root");
|
|
1701
|
+
const root = createRoot(container!);
|
|
1702
|
+
|
|
1703
|
+
const RootApp = () => {
|
|
1704
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
1705
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
1706
|
+
|
|
1707
|
+
return (
|
|
1708
|
+
<StyledEngineProvider injectFirst>
|
|
1709
|
+
<ThemeProvider theme={theme}>
|
|
1710
|
+
<EmotionThemeProvider theme={theme}>
|
|
1711
|
+
<CssBaseline />
|
|
1712
|
+
<App />
|
|
1713
|
+
</EmotionThemeProvider>
|
|
1714
|
+
</ThemeProvider>
|
|
1715
|
+
</StyledEngineProvider>
|
|
1716
|
+
);
|
|
1717
|
+
};
|
|
1718
|
+
|
|
1719
|
+
root.render(
|
|
1720
|
+
<React.StrictMode>
|
|
1721
|
+
<RootApp />
|
|
1722
|
+
</React.StrictMode>
|
|
1723
|
+
);
|
|
1724
|
+
|
|
1725
|
+
```
|
|
1726
|
+
|
|
1727
|
+
**/public/index.html**
|
|
1728
|
+
|
|
1729
|
+
```html
|
|
1730
|
+
<!DOCTYPE html>
|
|
1731
|
+
<html lang="en">
|
|
1732
|
+
<head>
|
|
1733
|
+
<meta charset="UTF-8" />
|
|
1734
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1735
|
+
<title>Control Inputs</title>
|
|
1736
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
1737
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
1738
|
+
<link
|
|
1739
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
1740
|
+
rel="stylesheet"
|
|
1741
|
+
/>
|
|
1742
|
+
<link
|
|
1743
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
1744
|
+
rel="stylesheet"
|
|
1745
|
+
/>
|
|
1746
|
+
</head>
|
|
1747
|
+
<body>
|
|
1748
|
+
<div id="root"></div>
|
|
1749
|
+
</body>
|
|
1750
|
+
</html>
|
|
1751
|
+
|
|
1752
|
+
```
|
|
1753
|
+
|
|
1754
|
+
**/package.json**
|
|
1755
|
+
|
|
1756
|
+
```json
|
|
1757
|
+
{"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"}
|
|
1758
|
+
```
|
|
1759
|
+
|
|
1760
|
+
---
|
|
1761
|
+
|
|
1762
|
+
---
|
|
1763
|
+
|
|
1764
|
+
## InputToggle
|
|
1765
|
+
|
|
1766
|
+
### SDS Source Code
|
|
1767
|
+
|
|
1768
|
+
The component's source code in the SDS codebase can be found here.
|
|
1769
|
+
|
|
1770
|
+
### SDS vs MUI
|
|
1771
|
+
|
|
1772
|
+
The following props and options differ and how they function across the MUI `Switch` component and the SDS `InputToggle` component:
|
|
1773
|
+
|
|
1774
|
+
* **`size`****:** Has no effect in SDS
|
|
1775
|
+
* **`color`****:** Has no effect in SDS
|
|
1776
|
+
* **`label`** **and** **`labelPlacement`****:** Has no effect in SDS
|
|
1777
|
+
* The **`required`** prop is available for both the MUI and SDS components.
|
|
1778
|
+
|
|
1779
|
+
### MUI Documentation
|
|
1780
|
+
|
|
1781
|
+
Documentation for the underlying MUI component can be found here.
|
|
1782
|
+
|
|
1783
|
+
### Props
|
|
1784
|
+
|
|
1785
|
+
Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
|
|
1786
|
+
|
|
1787
|
+
| Name | Type | Default | Description |
|
|
1788
|
+
| --- | --- | --- | --- |
|
|
1789
|
+
| `disabled` | `bool` | `false` | If `true`, the component is disabled. |
|
|
1790
|
+
| `offLabel` | `string` | `"Off"` | The text displayed within the InputToggle when it's off |
|
|
1791
|
+
| `onChange` | `func` | | Sets what happens when a user toggles on the component. |
|
|
1792
|
+
| `onLabel` | `string` | `"On"` | The text displayed within the InputToggle when it's off |
|
|
1793
|
+
| `width` | `number` | `62` | Controls the `width` of the InputToggle element. |
|
|
1794
|
+
|
|
1795
|
+
### Code examples
|
|
1796
|
+
|
|
1797
|
+
#### **Default InputToggle**
|
|
1798
|
+
|
|
1799
|
+
This example has the minimum props needed for the `InputToggle` component.
|
|
1800
|
+
|
|
1801
|
+
**/styles.css**
|
|
1802
|
+
|
|
1803
|
+
```css
|
|
1804
|
+
body {
|
|
1805
|
+
font-size: 13px;
|
|
1806
|
+
font-weight: 400;
|
|
1807
|
+
letter-spacing: 0.08px;
|
|
1808
|
+
line-height: 20px;
|
|
1809
|
+
text-transform: none;
|
|
1810
|
+
font-family: "Inter", sans-serif;
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
h1 {
|
|
1814
|
+
font-size: 1.5rem;
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
.app {
|
|
1818
|
+
padding: 20px;
|
|
1819
|
+
}
|
|
1820
|
+
```
|
|
1821
|
+
|
|
1822
|
+
**tsconfig.json**
|
|
1823
|
+
|
|
1824
|
+
```json
|
|
1825
|
+
{
|
|
1826
|
+
"include": [
|
|
1827
|
+
"./**/*"
|
|
1828
|
+
],
|
|
1829
|
+
"compilerOptions": {
|
|
1830
|
+
"strict": true,
|
|
1831
|
+
"esModuleInterop": true,
|
|
1832
|
+
"lib": [ "dom", "es2015" ],
|
|
1833
|
+
"jsx": "react-jsx"
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
```
|
|
1837
|
+
|
|
1838
|
+
**/App.tsx**
|
|
1839
|
+
|
|
1840
|
+
```tsx
|
|
1841
|
+
import { InputToggle } from "@czi-sds/components";
|
|
1842
|
+
import "./styles.css";
|
|
1843
|
+
|
|
1844
|
+
function App() {
|
|
1845
|
+
return (
|
|
1846
|
+
<div className="app">
|
|
1847
|
+
<InputToggle />
|
|
1848
|
+
</div>
|
|
1849
|
+
);
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
export default App;
|
|
1853
|
+
```
|
|
1854
|
+
|
|
1855
|
+
**/index.tsx**
|
|
1856
|
+
|
|
1857
|
+
```tsx
|
|
1858
|
+
import React from "react";
|
|
1859
|
+
import { createRoot } from "react-dom/client";
|
|
1860
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
1861
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
1862
|
+
import { Theme } from "@czi-sds/components";
|
|
1863
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
1864
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
1865
|
+
|
|
1866
|
+
import App from "./App";
|
|
1867
|
+
|
|
1868
|
+
const container = document.getElementById("root");
|
|
1869
|
+
const root = createRoot(container!);
|
|
1870
|
+
|
|
1871
|
+
const RootApp = () => {
|
|
1872
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
1873
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
1874
|
+
|
|
1875
|
+
return (
|
|
1876
|
+
<StyledEngineProvider injectFirst>
|
|
1877
|
+
<ThemeProvider theme={theme}>
|
|
1878
|
+
<EmotionThemeProvider theme={theme}>
|
|
1879
|
+
<CssBaseline />
|
|
1880
|
+
<App />
|
|
1881
|
+
</EmotionThemeProvider>
|
|
1882
|
+
</ThemeProvider>
|
|
1883
|
+
</StyledEngineProvider>
|
|
1884
|
+
);
|
|
1885
|
+
};
|
|
1886
|
+
|
|
1887
|
+
root.render(
|
|
1888
|
+
<React.StrictMode>
|
|
1889
|
+
<RootApp />
|
|
1890
|
+
</React.StrictMode>
|
|
1891
|
+
);
|
|
1892
|
+
|
|
1893
|
+
```
|
|
1894
|
+
|
|
1895
|
+
**/public/index.html**
|
|
1896
|
+
|
|
1897
|
+
```html
|
|
1898
|
+
<!DOCTYPE html>
|
|
1899
|
+
<html lang="en">
|
|
1900
|
+
<head>
|
|
1901
|
+
<meta charset="UTF-8" />
|
|
1902
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1903
|
+
<title>Control Inputs</title>
|
|
1904
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
1905
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
1906
|
+
<link
|
|
1907
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
1908
|
+
rel="stylesheet"
|
|
1909
|
+
/>
|
|
1910
|
+
<link
|
|
1911
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
1912
|
+
rel="stylesheet"
|
|
1913
|
+
/>
|
|
1914
|
+
</head>
|
|
1915
|
+
<body>
|
|
1916
|
+
<div id="root"></div>
|
|
1917
|
+
</body>
|
|
1918
|
+
</html>
|
|
1919
|
+
|
|
1920
|
+
```
|
|
1921
|
+
|
|
1922
|
+
**/package.json**
|
|
1923
|
+
|
|
1924
|
+
```json
|
|
1925
|
+
{"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"}
|
|
1926
|
+
```
|
|
1927
|
+
|
|
1928
|
+
---
|
|
1929
|
+
|
|
1930
|
+
#### **InputToggle with customized on and off labels**
|
|
1931
|
+
|
|
1932
|
+
This example shows an `InputToggle` component with customized on and off labels.
|
|
1933
|
+
|
|
1934
|
+
**/styles.css**
|
|
1935
|
+
|
|
1936
|
+
```css
|
|
1937
|
+
body {
|
|
1938
|
+
font-size: 13px;
|
|
1939
|
+
font-weight: 400;
|
|
1940
|
+
letter-spacing: 0.08px;
|
|
1941
|
+
line-height: 20px;
|
|
1942
|
+
text-transform: none;
|
|
1943
|
+
font-family: "Inter", sans-serif;
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
h1 {
|
|
1947
|
+
font-size: 1.5rem;
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
.app {
|
|
1951
|
+
padding: 20px;
|
|
1952
|
+
}
|
|
1953
|
+
```
|
|
1954
|
+
|
|
1955
|
+
**tsconfig.json**
|
|
1956
|
+
|
|
1957
|
+
```json
|
|
1958
|
+
{
|
|
1959
|
+
"include": [
|
|
1960
|
+
"./**/*"
|
|
1961
|
+
],
|
|
1962
|
+
"compilerOptions": {
|
|
1963
|
+
"strict": true,
|
|
1964
|
+
"esModuleInterop": true,
|
|
1965
|
+
"lib": [ "dom", "es2015" ],
|
|
1966
|
+
"jsx": "react-jsx"
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
```
|
|
1970
|
+
|
|
1971
|
+
**/App.tsx**
|
|
1972
|
+
|
|
1973
|
+
```tsx
|
|
1974
|
+
import { InputToggle } from "@czi-sds/components";
|
|
1975
|
+
import "./styles.css";
|
|
1976
|
+
|
|
1977
|
+
function App() {
|
|
1978
|
+
return (
|
|
1979
|
+
<div className="app">
|
|
1980
|
+
<InputToggle
|
|
1981
|
+
onLabel="Start"
|
|
1982
|
+
offLabel="Finish"
|
|
1983
|
+
width={72}
|
|
1984
|
+
/>
|
|
1985
|
+
</div>
|
|
1986
|
+
);
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
export default App;
|
|
1990
|
+
```
|
|
1991
|
+
|
|
1992
|
+
**/index.tsx**
|
|
1993
|
+
|
|
1994
|
+
```tsx
|
|
1995
|
+
import React from "react";
|
|
1996
|
+
import { createRoot } from "react-dom/client";
|
|
1997
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
1998
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
1999
|
+
import { Theme } from "@czi-sds/components";
|
|
2000
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
2001
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
2002
|
+
|
|
2003
|
+
import App from "./App";
|
|
2004
|
+
|
|
2005
|
+
const container = document.getElementById("root");
|
|
2006
|
+
const root = createRoot(container!);
|
|
2007
|
+
|
|
2008
|
+
const RootApp = () => {
|
|
2009
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
2010
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
2011
|
+
|
|
2012
|
+
return (
|
|
2013
|
+
<StyledEngineProvider injectFirst>
|
|
2014
|
+
<ThemeProvider theme={theme}>
|
|
2015
|
+
<EmotionThemeProvider theme={theme}>
|
|
2016
|
+
<CssBaseline />
|
|
2017
|
+
<App />
|
|
2018
|
+
</EmotionThemeProvider>
|
|
2019
|
+
</ThemeProvider>
|
|
2020
|
+
</StyledEngineProvider>
|
|
2021
|
+
);
|
|
2022
|
+
};
|
|
2023
|
+
|
|
2024
|
+
root.render(
|
|
2025
|
+
<React.StrictMode>
|
|
2026
|
+
<RootApp />
|
|
2027
|
+
</React.StrictMode>
|
|
2028
|
+
);
|
|
2029
|
+
|
|
2030
|
+
```
|
|
2031
|
+
|
|
2032
|
+
**/public/index.html**
|
|
2033
|
+
|
|
2034
|
+
```html
|
|
2035
|
+
<!DOCTYPE html>
|
|
2036
|
+
<html lang="en">
|
|
2037
|
+
<head>
|
|
2038
|
+
<meta charset="UTF-8" />
|
|
2039
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
2040
|
+
<title>Control Inputs</title>
|
|
2041
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
2042
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
2043
|
+
<link
|
|
2044
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
2045
|
+
rel="stylesheet"
|
|
2046
|
+
/>
|
|
2047
|
+
<link
|
|
2048
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
2049
|
+
rel="stylesheet"
|
|
2050
|
+
/>
|
|
2051
|
+
</head>
|
|
2052
|
+
<body>
|
|
2053
|
+
<div id="root"></div>
|
|
2054
|
+
</body>
|
|
2055
|
+
</html>
|
|
2056
|
+
|
|
2057
|
+
```
|
|
2058
|
+
|
|
2059
|
+
**/package.json**
|
|
2060
|
+
|
|
2061
|
+
```json
|
|
2062
|
+
{"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"}
|
|
2063
|
+
```
|
|
2064
|
+
|
|
2065
|
+
---
|
|
2066
|
+
|