@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,2260 @@
|
|
|
1
|
+
# Buttons
|
|
2
|
+
|
|
3
|
+
Buttons are one of the primary ways users interact with and provide input to the product's UI, serving as the main elements to solicit user action.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
## Button Variants
|
|
8
|
+
|
|
9
|
+
| There are a range of Button variants available for designers to use in their layouts depending on the amount of emphasis the Button needs to have, its location in the UI, and whether it is existing alone or alongside other Buttons. Follow the usage criteria accompanying each variant as a guide for selecting the correct Button for any given use case. | | **Jump to variant:** Square Copy Icon |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
|
|
12
|
+
### Visual Preview
|
|
13
|
+
|
|
14
|
+
Use the links below to jump to information on a specific Button variant:
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Square Button
|
|
19
|
+
|
|
20
|
+
| | In Figma | | | Meets Accessibility | | | In napari hub + .org Codebases |
|
|
21
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
22
|
+
|
|
23
|
+
### Large Primary Square Button
|
|
24
|
+
|
|
25
|
+
Use for primary or emphasized actions.
|
|
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
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
30
|
+
| --- | --- | --- | --- |
|
|
31
|
+
|
|
32
|
+
### Small Primary Square Button
|
|
33
|
+
|
|
34
|
+
Use for actions that are lower importance or don't require as much emphasis on the page such as actions taken in the page footer.
|
|
35
|
+
|
|
36
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
37
|
+
|
|
38
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
39
|
+
| --- | --- | --- | --- |
|
|
40
|
+
|
|
41
|
+
### Secondary Square Button
|
|
42
|
+
|
|
43
|
+
Use for a secondary action, or deemphasized Button. Often paired with primary Button.
|
|
44
|
+
|
|
45
|
+
Note: there is no small secondary square Button.
|
|
46
|
+
|
|
47
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
48
|
+
|
|
49
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
50
|
+
| --- | --- | --- | --- |
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
### Square Button Spacing
|
|
55
|
+
|
|
56
|
+
These rules establish how much margin should exist between and around elements.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Copy Button
|
|
61
|
+
|
|
62
|
+
| | In Figma | | | Meets Accessibility | | | In napari hub + .org Codebases |
|
|
63
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
64
|
+
|
|
65
|
+
Used inline within body copy when providing instructions to users that involve copying content. Any content that would need to be easily accessible by the user can be tied to the Copy Button. When clicked, the content tied to it is copied to the user's clipboard.
|
|
66
|
+
|
|
67
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
68
|
+
|
|
69
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
70
|
+
| --- | --- | --- | --- |
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### Copy Button Spacing
|
|
75
|
+
|
|
76
|
+
These rules establish how much margin should exist between and around elements.
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Icon Button
|
|
83
|
+
|
|
84
|
+
| | In Figma | | | Meets Accessibility | | | In napari hub + .org Codebase |
|
|
85
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
86
|
+
|
|
87
|
+
### Large Icon Button
|
|
88
|
+
|
|
89
|
+
The Icon Button should be used for lowest level actions that are not a part of the user's main workflow, such as closing a Dialog or expanding an Accordion (documentation coming soon).
|
|
90
|
+
|
|
91
|
+
Use the Icon Button size that is most appropriate for the design it is being used in.
|
|
92
|
+
|
|
93
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
94
|
+
|
|
95
|
+
| **Default** | **Hover** | **Pressed** |
|
|
96
|
+
| --- | --- | --- |
|
|
97
|
+
|
|
98
|
+
### Medium Icon Button
|
|
99
|
+
|
|
100
|
+
The Icon Button should be used for lowest level actions that are not a part of the user's main workflow, such as closing a Dialog or expanding an Accordion (documentation coming soon).
|
|
101
|
+
|
|
102
|
+
Use the Icon Button size that is most appropriate for the design it is being used in.
|
|
103
|
+
|
|
104
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
105
|
+
|
|
106
|
+
| **Default** | **Hover** | **Pressed** |
|
|
107
|
+
| --- | --- | --- |
|
|
108
|
+
|
|
109
|
+
### Small Icon Button
|
|
110
|
+
|
|
111
|
+
The Icon Button should be used for lowest level actions that are not a part of the user's main workflow, such as closing a Dialog or expanding an Accordion (documentation coming soon).
|
|
112
|
+
|
|
113
|
+
Use the Icon Button size that is most appropriate for the design it is being used in.
|
|
114
|
+
|
|
115
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
116
|
+
|
|
117
|
+
| **Default** | **Hover** | **Pressed** |
|
|
118
|
+
| --- | --- | --- |
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
### Icon Button Spacing
|
|
123
|
+
|
|
124
|
+
These rules establish how much margin should exist between and around elements.
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
## Code
|
|
129
|
+
|
|
130
|
+
## Button Components
|
|
131
|
+
|
|
132
|
+
| Below you will find interactive Storybook iframes for each component within the Button 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:** Button ButtonIcon |
|
|
133
|
+
| --- | --- | --- |
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
>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.
|
|
138
|
+
|
|
139
|
+
### Button
|
|
140
|
+
|
|
141
|
+
Storybook
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
### ButtonIcon
|
|
146
|
+
|
|
147
|
+
Storybook
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
Buttons are one of the primary ways users interact with and provide input to the product's UI, serving as the main elements to solicit user action.
|
|
152
|
+
|
|
153
|
+
## Overview
|
|
154
|
+
|
|
155
|
+
## Button Variants
|
|
156
|
+
|
|
157
|
+
| There are a range of Button variants available for designers to use in their layouts depending on the amount of emphasis the Button needs to have, its location in the UI, and whether it is existing alone or alongside other Buttons. Follow the usage criteria accompanying each variant as a guide for selecting the correct Button for any given use case. | | **Jump to variant:** Rounded Square Minimal Icon Rounded Dropdown Square Dropdown |
|
|
158
|
+
| --- | --- | --- |
|
|
159
|
+
|
|
160
|
+
### Visual Preview
|
|
161
|
+
|
|
162
|
+
Use the links below to jump to information on a specific Button variant:
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Rounded Button
|
|
167
|
+
|
|
168
|
+
| | In Figma | | | Meets Accessibility | | | In CZ GEN EPI Codebase |
|
|
169
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
170
|
+
|
|
171
|
+
### Primary Rounded Button
|
|
172
|
+
|
|
173
|
+
General use for a primary or emphasized action.
|
|
174
|
+
|
|
175
|
+
Include an icon when needing to provide additional context to users of what action the Button has.
|
|
176
|
+
|
|
177
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
178
|
+
|
|
179
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
180
|
+
| --- | --- | --- | --- |
|
|
181
|
+
|
|
182
|
+
| **Default + Icon** | **Hover** | **Pressed** | **Disabled** |
|
|
183
|
+
| --- | --- | --- | --- |
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
### Secondary Rounded Button
|
|
190
|
+
|
|
191
|
+
Use for a secondary action, or deemphasized Button. Often paired with primary Button.
|
|
192
|
+
|
|
193
|
+
Include an icon when needing to provide additional context to users of what action the Button has.
|
|
194
|
+
|
|
195
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
196
|
+
|
|
197
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
198
|
+
| --- | --- | --- | --- |
|
|
199
|
+
|
|
200
|
+
| **Default + Icon** | **Hover** | **Pressed** | **Disabled** |
|
|
201
|
+
| --- | --- | --- | --- |
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
### Error Rounded Button
|
|
206
|
+
|
|
207
|
+
Use the error Button when the outcome of the user clicking the button will result in something being removed or deleted.
|
|
208
|
+
|
|
209
|
+
Include an icon when needing to provide additional context to users of what action the Button has.
|
|
210
|
+
|
|
211
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
212
|
+
|
|
213
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
214
|
+
| --- | --- | --- | --- |
|
|
215
|
+
|
|
216
|
+
| **Default + Icon** | **Hover** | **Pressed** | **Disabled** |
|
|
217
|
+
| --- | --- | --- | --- |
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
### Rounded Button Spacing
|
|
222
|
+
|
|
223
|
+
These rules establish how much margin should exist between and around elements.
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Square Button
|
|
228
|
+
|
|
229
|
+
| | In Figma | | | Meets Accessibility | | | In CZ GEN EPI Codebase |
|
|
230
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
231
|
+
|
|
232
|
+
### Primary Square Button
|
|
233
|
+
|
|
234
|
+
Used to complete primary actions within Forms and Dropdown Menus; paired with Text Inputs.
|
|
235
|
+
|
|
236
|
+
Include an icon when needing to provide additional context to users of what action the Button has.
|
|
237
|
+
|
|
238
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
239
|
+
|
|
240
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
241
|
+
| --- | --- | --- | --- |
|
|
242
|
+
|
|
243
|
+
| **Default + Icon** | **Hover** | **Pressed** | **Disabled** |
|
|
244
|
+
| --- | --- | --- | --- |
|
|
245
|
+
|
|
246
|
+
### Secondary Square Button
|
|
247
|
+
|
|
248
|
+
Used to complete secondary actions within Forms and Dropdown Menus; paired with Text Inputs.
|
|
249
|
+
|
|
250
|
+
Include an icon when needing to provide additional context to users of what action the Button has.
|
|
251
|
+
|
|
252
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
253
|
+
|
|
254
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
255
|
+
| --- | --- | --- | --- |
|
|
256
|
+
|
|
257
|
+
| **Default + Icon** | **Hover** | **Pressed** | **Disabled** |
|
|
258
|
+
| --- | --- | --- | --- |
|
|
259
|
+
|
|
260
|
+
### Error Square Button
|
|
261
|
+
|
|
262
|
+
Use the error Button when the outcome of the user clicking the button will result in something being removed or deleted.
|
|
263
|
+
|
|
264
|
+
Include an icon when needing to provide additional context to users of what action the Button has.
|
|
265
|
+
|
|
266
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
267
|
+
|
|
268
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
269
|
+
| --- | --- | --- | --- |
|
|
270
|
+
|
|
271
|
+
| **Default + Icon** | **Hover** | **Pressed** | **Disabled** |
|
|
272
|
+
| --- | --- | --- | --- |
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
### Square Button Spacing
|
|
277
|
+
|
|
278
|
+
These rules establish how much margin should exist between and around elements.
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Minimal Button
|
|
283
|
+
|
|
284
|
+
| | In Figma | | | Meets Accessibility | | | In CZ GEN EPI Codebase |
|
|
285
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
286
|
+
|
|
287
|
+
### Primary Minimal Button
|
|
288
|
+
|
|
289
|
+
Text Buttons initiate actions that keep the user on the same page, such as opening or closing dialog windows or overlays. They should contain a maximum of 2-3 words.
|
|
290
|
+
|
|
291
|
+
If a longer or inline call to action with a similar visual style is needed, a Text Link might be more appropriate. In addition to containing more words, Text Links navigate the user away from their current page to a new one, whereas Minimal Buttons keep users on the same page.
|
|
292
|
+
|
|
293
|
+
Include an icon when needing to provide additional context to users of what action the Button has.
|
|
294
|
+
|
|
295
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
296
|
+
|
|
297
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
298
|
+
| --- | --- | --- | --- |
|
|
299
|
+
|
|
300
|
+
| **Default + Icon** | **Hover** | **Pressed** | **Disabled** |
|
|
301
|
+
| --- | --- | --- | --- |
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
### Secondary Minimal Button
|
|
306
|
+
|
|
307
|
+
Use for a deemphasized action or when paired with a Primary Minimal Button.
|
|
308
|
+
|
|
309
|
+
Note: only Primary Minimal Buttons can be paired with icons.
|
|
310
|
+
|
|
311
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
312
|
+
|
|
313
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
314
|
+
| --- | --- | --- | --- |
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
### Minimal Button Spacing
|
|
319
|
+
|
|
320
|
+
These rules establish how much margin should exist between and around elements.
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Icon Button
|
|
325
|
+
|
|
326
|
+
| | In Figma | | | Meets Accessibility | | | In CZ GEN EPI Codebase |
|
|
327
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
328
|
+
|
|
329
|
+
### Large Primary Icon Button
|
|
330
|
+
|
|
331
|
+
Use in instances where a standard sized Button won't fit or doesn't seem necessary such as in charts, tables, navigation bars, etc.
|
|
332
|
+
|
|
333
|
+
The Primary Icon Button should be used in places that require the user's primary attention or to emphasize a primary action.
|
|
334
|
+
|
|
335
|
+
Icon Buttons can be coupled with a Dropdown Menu when there are multiple options available to the user upon triggering the Button.
|
|
336
|
+
|
|
337
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
338
|
+
|
|
339
|
+
| **Default (Off)** | **Hover (Off)** | **Pressed** | **Default (On)** | **Hover (On)** | **Disabled** |
|
|
340
|
+
| --- | --- | --- | --- | --- | --- |
|
|
341
|
+
|
|
342
|
+
### Small Primary Icon Button
|
|
343
|
+
|
|
344
|
+
Use in instances where a standard sized Button won't fit or doesn't seem necessary such as in charts, tables, navigation bars, etc.
|
|
345
|
+
|
|
346
|
+
The Primary Icon Button should be used in places that require the user's primary attention or to emphasize a primary action.
|
|
347
|
+
|
|
348
|
+
Icon Buttons can be coupled with a Dropdown Menu when there are multiple options available to the user upon triggering the Button.
|
|
349
|
+
|
|
350
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
351
|
+
|
|
352
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
353
|
+
| --- | --- | --- | --- |
|
|
354
|
+
|
|
355
|
+
### Large Secondary Icon Button
|
|
356
|
+
|
|
357
|
+
Use in instances where a standard sized Button won't fit or doesn't seem necessary such as in charts, tables, navigation bars, etc.
|
|
358
|
+
|
|
359
|
+
The Secondary Icon Button should be used for deemphasized or secondary actions; often paired with the Primary Icon Button.
|
|
360
|
+
|
|
361
|
+
Icon Buttons can be coupled with a Dropdown Menu when there are multiple options available to the user upon triggering the Button.
|
|
362
|
+
|
|
363
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
364
|
+
|
|
365
|
+
| **Default (Off)** | **Hover (Off)** | **Default (On)** | **Hover (On)** | **Disabled** |
|
|
366
|
+
| --- | --- | --- | --- | --- |
|
|
367
|
+
|
|
368
|
+
### Small Secondary Icon Button
|
|
369
|
+
|
|
370
|
+
Use in instances where a standard sized Button won't fit or doesn't seem necessary such as in charts, tables, navigation bars, etc.
|
|
371
|
+
|
|
372
|
+
The Secondary Icon Button should be used for deemphasized or secondary actions; often paired with the Primary Icon Button.
|
|
373
|
+
|
|
374
|
+
Icon Buttons can be coupled with a Dropdown Menu when there are multiple options available to the user upon triggering the Button.
|
|
375
|
+
|
|
376
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
377
|
+
|
|
378
|
+
| **Default (Off)** | **Hover (Off)** | **Default (On)** | **Hover (On)** | **Disabled** |
|
|
379
|
+
| --- | --- | --- | --- | --- |
|
|
380
|
+
|
|
381
|
+
### Large Tertiary Icon Button
|
|
382
|
+
|
|
383
|
+
The Tertiary Icon Button should be used for lowest level actions that are not a part of the user's main workflow, such as closing a Dialog or expanding an Accordion (documentation coming soon). It is not usually paired with other Icon Buttons.
|
|
384
|
+
|
|
385
|
+
Use the Tertiary Icon Button size that is most appropriate for the design it is being used in.
|
|
386
|
+
|
|
387
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
388
|
+
|
|
389
|
+
| **Default** | **Hover** | **Pressed** |
|
|
390
|
+
| --- | --- | --- |
|
|
391
|
+
|
|
392
|
+
### Medium Tertiary Icon Button
|
|
393
|
+
|
|
394
|
+
The Tertiary Icon Button should be used for lowest level actions that are not a part of the user's main workflow, such as closing a Dialog or expanding an Accordion (documentation coming soon). It is not usually paired with other Icon Buttons.
|
|
395
|
+
|
|
396
|
+
Use the Tertiary Icon Button size that is most appropriate for the design it is being used in.
|
|
397
|
+
|
|
398
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
399
|
+
|
|
400
|
+
| **Default** | **Hover** | **Pressed** |
|
|
401
|
+
| --- | --- | --- |
|
|
402
|
+
|
|
403
|
+
### Small Tertiary Icon Button
|
|
404
|
+
|
|
405
|
+
The Tertiary Icon Button should be used for lowest level actions that are not a part of the user's main workflow, such as closing a Dialog or expanding an Accordion (documentation coming soon). It is not usually paired with other Icon Buttons.
|
|
406
|
+
|
|
407
|
+
Use the Tertiary Icon Button size that is most appropriate for the design it is being used in.
|
|
408
|
+
|
|
409
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
410
|
+
|
|
411
|
+
| **Default** | **Hover** | **Pressed** |
|
|
412
|
+
| --- | --- | --- |
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
### Icon Button Spacing
|
|
417
|
+
|
|
418
|
+
These rules establish how much margin should exist between and around elements.
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
## Rounded Dropdown Button
|
|
423
|
+
|
|
424
|
+
| | In Figma | | | Meets Accessibility | | | In CZ GEN EPI Codebase |
|
|
425
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
426
|
+
|
|
427
|
+
### Primary Rounded Dropdown Button
|
|
428
|
+
|
|
429
|
+
Use when there is a need to present the user with multiple options for actions that can be performed using a Button (generally in a similar context as Icon Buttons).
|
|
430
|
+
|
|
431
|
+
The Primary Rounded Dropdown Button should be used in places that require the user's primary attention or to emphasize a primary action.
|
|
432
|
+
|
|
433
|
+
The options are presented in a dropdown menu; use in conjunction with Dropdown Menu component.
|
|
434
|
+
|
|
435
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
436
|
+
|
|
437
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
438
|
+
| --- | --- | --- | --- |
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
### Secondary Rounded Dropdown Button
|
|
443
|
+
|
|
444
|
+
Use for Header-level Actions with multiple result options (generally in same context as Icon Buttons).
|
|
445
|
+
|
|
446
|
+
The options are presented in a dropdown menu; use in conjunction with Dropdown Menu component.
|
|
447
|
+
|
|
448
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
449
|
+
|
|
450
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
451
|
+
| --- | --- | --- | --- |
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
### Rounded Dropdown Button Spacing
|
|
456
|
+
|
|
457
|
+
These rules establish how much margin should exist between and around elements.
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
## Square Dropdown Button
|
|
464
|
+
|
|
465
|
+
| | In Figma | | | Meets Accessibility | | | In CZ GEN EPI Codebase |
|
|
466
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
467
|
+
|
|
468
|
+
### Primary Square Dropdown Button
|
|
469
|
+
|
|
470
|
+
Use when there is a need to present the user with multiple options for actions that can be performed using a Button (generally in a similar context as icon Buttons).
|
|
471
|
+
|
|
472
|
+
The Primary Square Dropdown Button should be used in places that require the user's primary attention or to emphasize a primary action.
|
|
473
|
+
|
|
474
|
+
The options are presented in a dropdown menu; use in conjunction with Dropdown Menu component.
|
|
475
|
+
|
|
476
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
477
|
+
|
|
478
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
479
|
+
| --- | --- | --- | --- |
|
|
480
|
+
|
|
481
|
+
### Secondary Square Dropdown Button
|
|
482
|
+
|
|
483
|
+
Use when there is a need to present the user with multiple options for actions that can be performed using a Button (generally in a similar context as icon Buttons).
|
|
484
|
+
|
|
485
|
+
The Secondary Square Dropdown Button should be used for deemphasized or secondary actions
|
|
486
|
+
|
|
487
|
+
The options are presented in a dropdown menu; use in conjunction with Dropdown Menu component.
|
|
488
|
+
|
|
489
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
490
|
+
|
|
491
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
492
|
+
| --- | --- | --- | --- |
|
|
493
|
+
|
|
494
|
+
---
|
|
495
|
+
|
|
496
|
+
### Square Dropdown Button Spacing
|
|
497
|
+
|
|
498
|
+
These rules establish how much margin should exist between and around elements.
|
|
499
|
+
|
|
500
|
+
## Code
|
|
501
|
+
|
|
502
|
+
## Button Components
|
|
503
|
+
|
|
504
|
+
| Below you will find interactive Storybook iframes for each component within the Button 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:** Button ButtonIcon ButtonDropdown |
|
|
505
|
+
| --- | --- | --- |
|
|
506
|
+
|
|
507
|
+
---
|
|
508
|
+
|
|
509
|
+
>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.
|
|
510
|
+
|
|
511
|
+
### Button
|
|
512
|
+
|
|
513
|
+
Storybook
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
### ButtonIcon
|
|
518
|
+
|
|
519
|
+
Storybook
|
|
520
|
+
|
|
521
|
+
---
|
|
522
|
+
|
|
523
|
+
### ButtonDropdown
|
|
524
|
+
|
|
525
|
+
Storybook
|
|
526
|
+
|
|
527
|
+
---
|
|
528
|
+
|
|
529
|
+
Buttons are one of the primary ways users interact with and provide input to the product's UI, serving as the main elements to solicit user action.
|
|
530
|
+
|
|
531
|
+
## Overview
|
|
532
|
+
|
|
533
|
+
## Button Variants
|
|
534
|
+
|
|
535
|
+
| There are a range of Button variants available for designers to use in their layouts depending on the amount of emphasis the Button needs to have, its location in the UI, and whether it is existing alone or alongside other Buttons. Follow the usage criteria accompanying each variant as a guide for selecting the correct Button for any given use case. | | **Jump to variant:** Rounded Square Minimal Icon Rounded Dropdown |
|
|
536
|
+
| --- | --- | --- |
|
|
537
|
+
|
|
538
|
+
### Visual Preview
|
|
539
|
+
|
|
540
|
+
Use the links below to jump to information on a specific Button variant:
|
|
541
|
+
|
|
542
|
+
---
|
|
543
|
+
|
|
544
|
+
## Rounded Button
|
|
545
|
+
|
|
546
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
547
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
548
|
+
|
|
549
|
+
### Primary Rounded Button
|
|
550
|
+
|
|
551
|
+
General use for a primary or emphasized action.
|
|
552
|
+
|
|
553
|
+
Include an icon when needing to provide additional context to users of what action the Button has.
|
|
554
|
+
|
|
555
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
556
|
+
|
|
557
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
558
|
+
| --- | --- | --- | --- |
|
|
559
|
+
|
|
560
|
+
| **Default + Icon** | **Hover** | **Pressed** | **Disabled** |
|
|
561
|
+
| --- | --- | --- | --- |
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
### Secondary Rounded Button
|
|
566
|
+
|
|
567
|
+
Use for a secondary action, or deemphasized Button. Often paired with primary Button.
|
|
568
|
+
|
|
569
|
+
Include an icon when needing to provide additional context to users of what action the Button has.
|
|
570
|
+
|
|
571
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
572
|
+
|
|
573
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
574
|
+
| --- | --- | --- | --- |
|
|
575
|
+
|
|
576
|
+
| **Default + Icon** | **Hover** | **Pressed** | **Disabled** |
|
|
577
|
+
| --- | --- | --- | --- |
|
|
578
|
+
|
|
579
|
+
### Error Rounded Button
|
|
580
|
+
|
|
581
|
+
Use the error Button when the outcome of the user clicking the button will result in something being removed or deleted.
|
|
582
|
+
|
|
583
|
+
Include an icon when needing to provide additional context to users of what action the Button has.
|
|
584
|
+
|
|
585
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
586
|
+
|
|
587
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
588
|
+
| --- | --- | --- | --- |
|
|
589
|
+
|
|
590
|
+
| **Default + Icon** | **Hover** | **Pressed** | **Disabled** |
|
|
591
|
+
| --- | --- | --- | --- |
|
|
592
|
+
|
|
593
|
+
---
|
|
594
|
+
|
|
595
|
+
### Rounded Button Spacing
|
|
596
|
+
|
|
597
|
+
These rules establish how much margin should exist between and around elements.
|
|
598
|
+
|
|
599
|
+
---
|
|
600
|
+
|
|
601
|
+
## Square Button
|
|
602
|
+
|
|
603
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
604
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
605
|
+
|
|
606
|
+
### Primary Square Button
|
|
607
|
+
|
|
608
|
+
Used to complete primary actions within Forms and Dropdown Menus; paired with Text Inputs.
|
|
609
|
+
|
|
610
|
+
Include an icon when needing to provide additional context to users of what action the Button has.
|
|
611
|
+
|
|
612
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
613
|
+
|
|
614
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
615
|
+
| --- | --- | --- | --- |
|
|
616
|
+
|
|
617
|
+
| **Default + Icon** | **Hover** | **Pressed** | **Disabled** |
|
|
618
|
+
| --- | --- | --- | --- |
|
|
619
|
+
|
|
620
|
+
### Secondary Square Button
|
|
621
|
+
|
|
622
|
+
Used to complete secondary actions within Forms and Dropdown Menus; paired with Text Inputs.
|
|
623
|
+
|
|
624
|
+
Include an icon when needing to provide additional context to users of what action the Button has.
|
|
625
|
+
|
|
626
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
627
|
+
|
|
628
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
629
|
+
| --- | --- | --- | --- |
|
|
630
|
+
|
|
631
|
+
| **Default + Icon** | **Hover** | **Pressed** | **Disabled** |
|
|
632
|
+
| --- | --- | --- | --- |
|
|
633
|
+
|
|
634
|
+
### Error Square Button
|
|
635
|
+
|
|
636
|
+
Use the error Button when the outcome of the user clicking the button will result in something being removed or deleted.
|
|
637
|
+
|
|
638
|
+
Include an icon when needing to provide additional context to users of what action the Button has.
|
|
639
|
+
|
|
640
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
641
|
+
|
|
642
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
643
|
+
| --- | --- | --- | --- |
|
|
644
|
+
|
|
645
|
+
| **Default + Icon** | **Hover** | **Pressed** | **Disabled** |
|
|
646
|
+
| --- | --- | --- | --- |
|
|
647
|
+
|
|
648
|
+
---
|
|
649
|
+
|
|
650
|
+
### Square Button Spacing
|
|
651
|
+
|
|
652
|
+
These rules establish how much margin should exist between and around elements.
|
|
653
|
+
|
|
654
|
+
---
|
|
655
|
+
|
|
656
|
+
## Minimal Button
|
|
657
|
+
|
|
658
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
659
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
660
|
+
|
|
661
|
+
### Primary Minimal Button
|
|
662
|
+
|
|
663
|
+
Text Buttons initiate actions that keep the user on the same page, such as opening or closing dialog windows or overlays. They should contain a maximum of 2-3 words.
|
|
664
|
+
|
|
665
|
+
If a longer or inline call to action with a similar visual style is needed, a Text Link might be more appropriate. In addition to containing more words, Text Links navigate the user away from their current page to a new one, whereas Minimal Buttons keep users on the same page.
|
|
666
|
+
|
|
667
|
+
Include an icon when needing to provide additional context to users of what action the Button has.
|
|
668
|
+
|
|
669
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
670
|
+
|
|
671
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
672
|
+
| --- | --- | --- | --- |
|
|
673
|
+
|
|
674
|
+
| **Default + Icon** | **Hover** | **Pressed** | **Disabled** |
|
|
675
|
+
| --- | --- | --- | --- |
|
|
676
|
+
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
### Secondary Minimal Button
|
|
680
|
+
|
|
681
|
+
Use for a deemphasized action or when paired with a Primary Minimal Button
|
|
682
|
+
|
|
683
|
+
Note: only Primary Minimal Buttons can be paired with icons.
|
|
684
|
+
|
|
685
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
686
|
+
|
|
687
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
688
|
+
| --- | --- | --- | --- |
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
---
|
|
693
|
+
|
|
694
|
+
### Minimal Button Spacing
|
|
695
|
+
|
|
696
|
+
These rules establish how much margin should exist between and around elements.
|
|
697
|
+
|
|
698
|
+
---
|
|
699
|
+
|
|
700
|
+
## Icon Button
|
|
701
|
+
|
|
702
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
703
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
704
|
+
|
|
705
|
+
### Large Primary Icon Button
|
|
706
|
+
|
|
707
|
+
Use in instances where a standard sized Button won't fit or doesn't seem necessary such as in charts, tables, navigation bars, etc.
|
|
708
|
+
|
|
709
|
+
The Primary Icon Button should be used in places that require the user's primary attention or to emphasize a primary action.
|
|
710
|
+
|
|
711
|
+
Icon Buttons can be coupled with a Dropdown Menu when there are multiple options available to the user upon triggering the Button.
|
|
712
|
+
|
|
713
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
714
|
+
|
|
715
|
+
| **Default (Off)** | **Hover (Off)** | **Pressed** | **Default (On)** | **Hover (On)** | **Disabled** |
|
|
716
|
+
| --- | --- | --- | --- | --- | --- |
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
### Small Primary Icon Button
|
|
721
|
+
|
|
722
|
+
Use in instances where a standard sized Button won't fit or doesn't seem necessary such as in charts, tables, navigation bars, etc.
|
|
723
|
+
|
|
724
|
+
The Primary Icon Button should be used in places that require the user's primary attention or to emphasize a primary action.
|
|
725
|
+
|
|
726
|
+
Icon Buttons can be coupled with a Dropdown Menu when there are multiple options available to the user upon triggering the Button.
|
|
727
|
+
|
|
728
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
729
|
+
|
|
730
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
731
|
+
| --- | --- | --- | --- |
|
|
732
|
+
|
|
733
|
+
### Large Secondary Icon Button
|
|
734
|
+
|
|
735
|
+
Use in instances where a standard sized Button won't fit or doesn't seem necessary such as in charts, tables, navigation bars, etc.
|
|
736
|
+
|
|
737
|
+
The Secondary Icon Button should be used for deemphasized or secondary actions; often paired with the Primary Icon Button.
|
|
738
|
+
|
|
739
|
+
Icon Buttons can be coupled with a Dropdown Menu when there are multiple options available to the user upon triggering the Button.
|
|
740
|
+
|
|
741
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
742
|
+
|
|
743
|
+
| **Default (Off)** | **Hover (Off)** | **Default (On)** | **Hover (On)** | **Disabled** |
|
|
744
|
+
| --- | --- | --- | --- | --- |
|
|
745
|
+
|
|
746
|
+
### Small Secondary Icon Button
|
|
747
|
+
|
|
748
|
+
Use in instances where a standard sized Button won't fit or doesn't seem necessary such as in charts, tables, navigation bars, etc.
|
|
749
|
+
|
|
750
|
+
The Secondary Icon Button should be used for deemphasized or secondary actions; often paired with the Primary Icon Button.
|
|
751
|
+
|
|
752
|
+
Icon Buttons can be coupled with a Dropdown Menu when there are multiple options available to the user upon triggering the Button.
|
|
753
|
+
|
|
754
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
755
|
+
|
|
756
|
+
| **Default (Off)** | **Hover (Off)** | **Default (On)** | **Hover (On)** | **Disabled** |
|
|
757
|
+
| --- | --- | --- | --- | --- |
|
|
758
|
+
|
|
759
|
+
### Large Tertiary Icon Button
|
|
760
|
+
|
|
761
|
+
The Tertiary Icon Button should be used for lowest level actions that are not a part of the user's main workflow, such as closing a Dialog or expanding an Accordion (documentation coming soon). It is not usually paired with other Icon Buttons.
|
|
762
|
+
|
|
763
|
+
Use the Tertiary Icon Button size that is most appropriate for the design it is being used in.
|
|
764
|
+
|
|
765
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
766
|
+
|
|
767
|
+
| **Default** | **Hover** | **Pressed** |
|
|
768
|
+
| --- | --- | --- |
|
|
769
|
+
|
|
770
|
+
### Medium Tertiary Icon Button
|
|
771
|
+
|
|
772
|
+
The Tertiary Icon Button should be used for lowest level actions that are not a part of the user's main workflow, such as closing a Dialog or expanding an Accordion (documentation coming soon). It is not usually paired with other Icon Buttons.
|
|
773
|
+
|
|
774
|
+
Use the Tertiary Icon Button size that is most appropriate for the design it is being used in.
|
|
775
|
+
|
|
776
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
777
|
+
|
|
778
|
+
| **Default** | **Hover** | **Pressed** |
|
|
779
|
+
| --- | --- | --- |
|
|
780
|
+
|
|
781
|
+
### Small Tertiary Icon Button
|
|
782
|
+
|
|
783
|
+
The Tertiary Icon Button should be used for lowest level actions that are not a part of the user's main workflow, such as closing a Dialog or expanding an Accordion (documentation coming soon). It is not usually paired with other Icon Buttons.
|
|
784
|
+
|
|
785
|
+
Use the Tertiary Icon Button size that is most appropriate for the design it is being used in.
|
|
786
|
+
|
|
787
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
788
|
+
|
|
789
|
+
| **Default** | **Hover** | **Pressed** |
|
|
790
|
+
| --- | --- | --- |
|
|
791
|
+
|
|
792
|
+
---
|
|
793
|
+
|
|
794
|
+
### Icon Button Spacing
|
|
795
|
+
|
|
796
|
+
These rules establish how much margin should exist between and around elements.
|
|
797
|
+
|
|
798
|
+
---
|
|
799
|
+
|
|
800
|
+
## Rounded Dropdown Button
|
|
801
|
+
|
|
802
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
803
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
804
|
+
|
|
805
|
+
### Primary Rounded Dropdown Button
|
|
806
|
+
|
|
807
|
+
Use when there is a need to present the user with multiple options for actions that can be performed using a Button (generally in a similar context as Icon Buttons).
|
|
808
|
+
|
|
809
|
+
The Primary Rounded Dropdown Button should be used in places that require the user's primary attention or to emphasize a primary action.
|
|
810
|
+
|
|
811
|
+
The options are presented in a dropdown menu; use in conjunction with Dropdown Menu component.
|
|
812
|
+
|
|
813
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
814
|
+
|
|
815
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
816
|
+
| --- | --- | --- | --- |
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
### Secondary Rounded Dropdown Button
|
|
821
|
+
|
|
822
|
+
Use for Header-level Actions with multiple result options (generally in same context as Icon Buttons).
|
|
823
|
+
|
|
824
|
+
The options are presented in a dropdown menu; use in conjunction with Dropdown Menu component.
|
|
825
|
+
|
|
826
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
827
|
+
|
|
828
|
+
| **Default** | **Hover** | **Pressed** | **Disabled** |
|
|
829
|
+
| --- | --- | --- | --- |
|
|
830
|
+
|
|
831
|
+
---
|
|
832
|
+
|
|
833
|
+
### Rounded Dropdown Button Spacing
|
|
834
|
+
|
|
835
|
+
These rules establish how much margin should exist between and around elements.
|
|
836
|
+
|
|
837
|
+
## Code
|
|
838
|
+
|
|
839
|
+
## Button Components
|
|
840
|
+
|
|
841
|
+
| Below you will find interactive Storybook iframes for each component within the Button 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:** Button ButtonIcon ButtonDropdown |
|
|
842
|
+
| --- | --- | --- |
|
|
843
|
+
|
|
844
|
+
---
|
|
845
|
+
|
|
846
|
+
### Button
|
|
847
|
+
|
|
848
|
+
Storybook
|
|
849
|
+
|
|
850
|
+
---
|
|
851
|
+
|
|
852
|
+
### ButtonIcon
|
|
853
|
+
|
|
854
|
+
Storybook
|
|
855
|
+
|
|
856
|
+
---
|
|
857
|
+
|
|
858
|
+
### ButtonDropdown
|
|
859
|
+
|
|
860
|
+
Storybook
|
|
861
|
+
|
|
862
|
+
---
|
|
863
|
+
|
|
864
|
+
Buttons are one of the primary ways users interact with and provide input to the product's UI, serving as the main elements to solicit user action.
|
|
865
|
+
|
|
866
|
+
## Guidelines
|
|
867
|
+
|
|
868
|
+
## Button Components
|
|
869
|
+
|
|
870
|
+
| There are a range of Button types available to use depending on the amount of emphasis the Button needs to have, its location in the UI, and whether it is existing alone or alongside other Buttons. | | **Jump to variant:** Button Dropdown Button Toggle Button |
|
|
871
|
+
| --- | --- | --- |
|
|
872
|
+
|
|
873
|
+
### Visual Preview
|
|
874
|
+
|
|
875
|
+
---
|
|
876
|
+
|
|
877
|
+
## Button
|
|
878
|
+
|
|
879
|
+
| | In Figma | | | Meets Accessibility | | | In Code |
|
|
880
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
881
|
+
|
|
882
|
+
### Button Styles
|
|
883
|
+
|
|
884
|
+
All of the available Button styles are shown below, demonstrated here using the primary type.
|
|
885
|
+
|
|
886
|
+
---
|
|
887
|
+
|
|
888
|
+
### Live Instance
|
|
889
|
+
|
|
890
|
+
Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
|
|
891
|
+
|
|
892
|
+
Default
|
|
893
|
+
|
|
894
|
+
---
|
|
895
|
+
|
|
896
|
+
### Button – Rounded
|
|
897
|
+
|
|
898
|
+
Use Button – Rounded as part of top-level or primary application navigation.
|
|
899
|
+
|
|
900
|
+
#### Primary
|
|
901
|
+
|
|
902
|
+
Use for primary or emphasized actions.
|
|
903
|
+
|
|
904
|
+
Include an icon when needing to provide additional context to users of what action the Button has. Label text is available in all caps or title case; title case used by default.
|
|
905
|
+
|
|
906
|
+
*Title Case*
|
|
907
|
+
|
|
908
|
+
| Default | Hover | Pressed | Disabled |
|
|
909
|
+
| --- | --- | --- | --- |
|
|
910
|
+
|
|
911
|
+
*All Caps*
|
|
912
|
+
|
|
913
|
+
| Default | Hover | Pressed | Disabled |
|
|
914
|
+
| --- | --- | --- | --- |
|
|
915
|
+
|
|
916
|
+
#### Secondary
|
|
917
|
+
|
|
918
|
+
Use for a secondary or deemphasized action; often paired with a primary Button.
|
|
919
|
+
|
|
920
|
+
Include an icon when needing to provide additional context to users of what action the Button has. Label text is available in all caps or title case; title case used by default.
|
|
921
|
+
|
|
922
|
+
*Title Case*
|
|
923
|
+
|
|
924
|
+
| Default | Hover | Pressed | Disabled |
|
|
925
|
+
| --- | --- | --- | --- |
|
|
926
|
+
|
|
927
|
+
*All Caps*
|
|
928
|
+
|
|
929
|
+
| Default | Hover | Pressed | Disabled |
|
|
930
|
+
| --- | --- | --- | --- |
|
|
931
|
+
|
|
932
|
+
#### Destructive
|
|
933
|
+
|
|
934
|
+
Use the destructive Button when the outcome of the user clicking the button will result in something being removed or deleted.
|
|
935
|
+
|
|
936
|
+
Include an icon when needing to provide additional context to users of what action the Button has. Label text is available in all caps or title case; title case used by default.
|
|
937
|
+
|
|
938
|
+
*Title Case*
|
|
939
|
+
|
|
940
|
+
| Default | Hover | Pressed | Disabled |
|
|
941
|
+
| --- | --- | --- | --- |
|
|
942
|
+
|
|
943
|
+
*All Caps*
|
|
944
|
+
|
|
945
|
+
| Default | Hover | Pressed | Disabled |
|
|
946
|
+
| --- | --- | --- | --- |
|
|
947
|
+
|
|
948
|
+
---
|
|
949
|
+
|
|
950
|
+
### Button – Square
|
|
951
|
+
|
|
952
|
+
Use Button – Square in the body or main content area of applications.
|
|
953
|
+
|
|
954
|
+
#### **Primary**
|
|
955
|
+
|
|
956
|
+
Alternate Button style for primary or emphasized actions.
|
|
957
|
+
|
|
958
|
+
Include an icon when needing to provide additional context to users of what action the Button has. Label text is available in all caps or title case; title case used by default.
|
|
959
|
+
|
|
960
|
+
*Title Case*
|
|
961
|
+
|
|
962
|
+
| Default | Hover | Pressed | Disabled |
|
|
963
|
+
| --- | --- | --- | --- |
|
|
964
|
+
|
|
965
|
+
*All Caps*
|
|
966
|
+
|
|
967
|
+
| Default | Hover | Pressed | Disabled |
|
|
968
|
+
| --- | --- | --- | --- |
|
|
969
|
+
|
|
970
|
+
#### **Secondary**
|
|
971
|
+
|
|
972
|
+
Use for a secondary or deemphasized action; often paired with a primary Button.
|
|
973
|
+
|
|
974
|
+
Include an icon when needing to provide additional context to users of what action the Button has. Label text is available in all caps or title case; title case used by default.
|
|
975
|
+
|
|
976
|
+
*Title Case*
|
|
977
|
+
|
|
978
|
+
| Default | Hover | Pressed | Disabled |
|
|
979
|
+
| --- | --- | --- | --- |
|
|
980
|
+
|
|
981
|
+
*All Caps*
|
|
982
|
+
|
|
983
|
+
| Default | Hover | Pressed | Disabled |
|
|
984
|
+
| --- | --- | --- | --- |
|
|
985
|
+
|
|
986
|
+
#### Destructive
|
|
987
|
+
|
|
988
|
+
Use the destructive Button when the outcome of the user clicking the button will result in something being removed or deleted.
|
|
989
|
+
|
|
990
|
+
Include an icon when needing to provide additional context to users of what action the Button has. Label text is available in all caps or title case; title case used by default.
|
|
991
|
+
|
|
992
|
+
*Title Case*
|
|
993
|
+
|
|
994
|
+
| Default | Hover | Pressed | Disabled |
|
|
995
|
+
| --- | --- | --- | --- |
|
|
996
|
+
|
|
997
|
+
*All Caps*
|
|
998
|
+
|
|
999
|
+
| Default | Hover | Pressed | Disabled |
|
|
1000
|
+
| --- | --- | --- | --- |
|
|
1001
|
+
|
|
1002
|
+
---
|
|
1003
|
+
|
|
1004
|
+
### Button – Minimal
|
|
1005
|
+
|
|
1006
|
+
Minimal Buttons initiate actions that keep the user on the same page, such as opening or closing Dialogs. They should contain a maximum of 2-3 words.
|
|
1007
|
+
|
|
1008
|
+
If a longer or inline call to action with a similar visual style is needed, a Link might be more appropriate. In addition to containing more words, Text Links navigate the user away from their current page to a new one, whereas Minimal Buttons keep users on the same page.
|
|
1009
|
+
|
|
1010
|
+
#### Primary
|
|
1011
|
+
|
|
1012
|
+
Use for primary or emphasized actions.
|
|
1013
|
+
|
|
1014
|
+
Include an icon when needing to provide additional context to users of what action the Button has. Label text is available in all caps or title case; all caps is used by default.
|
|
1015
|
+
|
|
1016
|
+
*Title Case*
|
|
1017
|
+
|
|
1018
|
+
| Default | Hover | Pressed | Disabled |
|
|
1019
|
+
| --- | --- | --- | --- |
|
|
1020
|
+
|
|
1021
|
+
*All Caps*
|
|
1022
|
+
|
|
1023
|
+
| Default | Hover | Pressed | Disabled |
|
|
1024
|
+
| --- | --- | --- | --- |
|
|
1025
|
+
|
|
1026
|
+
#### Secondary
|
|
1027
|
+
|
|
1028
|
+
Use for a secondary or deemphasized action; often paired with a primary Button.
|
|
1029
|
+
|
|
1030
|
+
Label text is available in all caps or title case; all caps is used by default.
|
|
1031
|
+
|
|
1032
|
+
*Title Case*
|
|
1033
|
+
|
|
1034
|
+
| Default | Hover | Pressed | Disabled |
|
|
1035
|
+
| --- | --- | --- | --- |
|
|
1036
|
+
|
|
1037
|
+
*All Caps*
|
|
1038
|
+
|
|
1039
|
+
| Default | Hover | Pressed | Disabled |
|
|
1040
|
+
| --- | --- | --- | --- |
|
|
1041
|
+
|
|
1042
|
+
---
|
|
1043
|
+
|
|
1044
|
+
### Button – Icon
|
|
1045
|
+
|
|
1046
|
+
Use when a standard Button doesn't seem necessary or won't fit such as when used as part of complex components like Tables. Button – Icon should generally be coupled with a Tooltip that is displayed on hover to provide a label indicating the Button's functionality.
|
|
1047
|
+
|
|
1048
|
+
Optionally, pair Button – Icon with a Tooltip to use as a label to communicate the button's functionality.
|
|
1049
|
+
|
|
1050
|
+
#### Primary
|
|
1051
|
+
|
|
1052
|
+
Primary Button – Icon should be used in places that require the user's primary attention or to emphasize a primary action. Can be paired with other Button components.
|
|
1053
|
+
|
|
1054
|
+
*Large*
|
|
1055
|
+
|
|
1056
|
+
| Default | Hover | Pressed | Disabled |
|
|
1057
|
+
| --- | --- | --- | --- |
|
|
1058
|
+
|
|
1059
|
+
*Medium*
|
|
1060
|
+
|
|
1061
|
+
| Default | Hover | Pressed | Disabled |
|
|
1062
|
+
| --- | --- | --- | --- |
|
|
1063
|
+
|
|
1064
|
+
*Small*
|
|
1065
|
+
|
|
1066
|
+
| Default | Hover | Pressed | Disabled |
|
|
1067
|
+
| --- | --- | --- | --- |
|
|
1068
|
+
|
|
1069
|
+
#### Secondary
|
|
1070
|
+
|
|
1071
|
+
Secondary Button – Icon should be used for deemphasized or secondary actions. Can be paired with other Button components.
|
|
1072
|
+
|
|
1073
|
+
*Large*
|
|
1074
|
+
|
|
1075
|
+
| Default | Hover | Pressed | Disabled |
|
|
1076
|
+
| --- | --- | --- | --- |
|
|
1077
|
+
|
|
1078
|
+
*Medium*
|
|
1079
|
+
|
|
1080
|
+
| Default | Hover | Pressed | Disabled |
|
|
1081
|
+
| --- | --- | --- | --- |
|
|
1082
|
+
|
|
1083
|
+
*Small*
|
|
1084
|
+
|
|
1085
|
+
| Default | Hover | Pressed | Disabled |
|
|
1086
|
+
| --- | --- | --- | --- |
|
|
1087
|
+
|
|
1088
|
+
#### Tertiary
|
|
1089
|
+
|
|
1090
|
+
The tertiary Icon Button should be used for lowest level actions that are not a part of the user's main workflow, such as closing a Dialog or expanding an Accordion. It is not usually used in combination with other Buttons or Tooltips.
|
|
1091
|
+
|
|
1092
|
+
*Large*
|
|
1093
|
+
|
|
1094
|
+
| Default | Hover | Pressed | Disabled |
|
|
1095
|
+
| --- | --- | --- | --- |
|
|
1096
|
+
|
|
1097
|
+
*Medium*
|
|
1098
|
+
|
|
1099
|
+
| Default | Hover | Pressed | Disabled |
|
|
1100
|
+
| --- | --- | --- | --- |
|
|
1101
|
+
|
|
1102
|
+
*Small*
|
|
1103
|
+
|
|
1104
|
+
| Default | Hover | Pressed | Disabled |
|
|
1105
|
+
| --- | --- | --- | --- |
|
|
1106
|
+
|
|
1107
|
+
---
|
|
1108
|
+
|
|
1109
|
+
### Button Spacing
|
|
1110
|
+
|
|
1111
|
+
These rules establish how much margin should exist between and around elements.
|
|
1112
|
+
|
|
1113
|
+
---
|
|
1114
|
+
|
|
1115
|
+
## Dropdown Button
|
|
1116
|
+
|
|
1117
|
+
| | In Figma | | | Meets Accessibility | | | In Code |
|
|
1118
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
1119
|
+
|
|
1120
|
+
### Dropdown Button Styles
|
|
1121
|
+
|
|
1122
|
+
All of the available Dropdown Button styles are shown below, demonstrated here using the primary type.
|
|
1123
|
+
|
|
1124
|
+
---
|
|
1125
|
+
|
|
1126
|
+
### Live Instance
|
|
1127
|
+
|
|
1128
|
+
Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
|
|
1129
|
+
|
|
1130
|
+
Default
|
|
1131
|
+
|
|
1132
|
+
---
|
|
1133
|
+
|
|
1134
|
+
### Dropdown Button – Rounded
|
|
1135
|
+
|
|
1136
|
+
Use when there is a need to present the user with multiple options for actions that can be performed using a Button; the options are presented in a Dropdown Menu.
|
|
1137
|
+
|
|
1138
|
+
#### Primary
|
|
1139
|
+
|
|
1140
|
+
The Primary variant should be used in places that require the user's primary attention or to emphasize a primary action.
|
|
1141
|
+
|
|
1142
|
+
| Default | Hover | Pressed | Disabled |
|
|
1143
|
+
| --- | --- | --- | --- |
|
|
1144
|
+
|
|
1145
|
+
#### Secondary
|
|
1146
|
+
|
|
1147
|
+
The Secondary Rounded Dropdown Button should be used for deemphasized or secondary actions.
|
|
1148
|
+
|
|
1149
|
+
| Default | Hover | Pressed | Disabled |
|
|
1150
|
+
| --- | --- | --- | --- |
|
|
1151
|
+
|
|
1152
|
+
---
|
|
1153
|
+
|
|
1154
|
+
### Dropdown Button – Square
|
|
1155
|
+
|
|
1156
|
+
Alternate Dropdown Button style for use when there is a need to present the user with multiple options for actions that can be performed using a Button; the options are presented in a Dropdown Menu.
|
|
1157
|
+
|
|
1158
|
+
#### Primary
|
|
1159
|
+
|
|
1160
|
+
The Primary variant should be used in places that require the user's primary attention or to emphasize a primary action.
|
|
1161
|
+
|
|
1162
|
+
| Default | Hover | Pressed | Disabled |
|
|
1163
|
+
| --- | --- | --- | --- |
|
|
1164
|
+
|
|
1165
|
+
#### Secondary
|
|
1166
|
+
|
|
1167
|
+
The Secondary Rounded Dropdown Button should be used for deemphasized or secondary actions.
|
|
1168
|
+
|
|
1169
|
+
| Default | Hover | Pressed | Disabled |
|
|
1170
|
+
| --- | --- | --- | --- |
|
|
1171
|
+
|
|
1172
|
+
---
|
|
1173
|
+
|
|
1174
|
+
### Dropdown Button – Icon
|
|
1175
|
+
|
|
1176
|
+
Use when there is a need to present the user with multiple options for actions that can be performed and a standard Dropdown Button doesn't seem necessary or won't fit such as when used as part of complex components like Tables; the options are presented in a Dropdown Menu. Dropdown Buttons should generally be coupled with a Tooltip that is displayed on hover to provide a label indicating the Button's functionality.
|
|
1177
|
+
|
|
1178
|
+
Optionally, pair Dropdown Button – Icon with a Tooltip to use as a label to communicate the button's functionality.
|
|
1179
|
+
|
|
1180
|
+
#### Primary
|
|
1181
|
+
|
|
1182
|
+
Primary Dropdown Button – Icon should be used in places that require the user's primary attention or to emphasize a primary action. Can be paired with other Button components.
|
|
1183
|
+
|
|
1184
|
+
*Large*
|
|
1185
|
+
|
|
1186
|
+
| Default | Hover | Pressed | Disabled |
|
|
1187
|
+
| --- | --- | --- | --- |
|
|
1188
|
+
|
|
1189
|
+
*Medium*
|
|
1190
|
+
|
|
1191
|
+
| Default | Hover | Pressed | Disabled |
|
|
1192
|
+
| --- | --- | --- | --- |
|
|
1193
|
+
|
|
1194
|
+
*Small*
|
|
1195
|
+
|
|
1196
|
+
| Default | Hover | Pressed | Disabled |
|
|
1197
|
+
| --- | --- | --- | --- |
|
|
1198
|
+
|
|
1199
|
+
#### Secondary
|
|
1200
|
+
|
|
1201
|
+
Secondary Dropdown Button – Icon should be used for deemphasized or secondary actions. Can be paired with other Button components.
|
|
1202
|
+
|
|
1203
|
+
*Large*
|
|
1204
|
+
|
|
1205
|
+
| Default | Hover | Pressed | Disabled |
|
|
1206
|
+
| --- | --- | --- | --- |
|
|
1207
|
+
|
|
1208
|
+
*Medium*
|
|
1209
|
+
|
|
1210
|
+
| Default | Hover | Pressed | Disabled |
|
|
1211
|
+
| --- | --- | --- | --- |
|
|
1212
|
+
|
|
1213
|
+
*Small*
|
|
1214
|
+
|
|
1215
|
+
| Default | Hover | Pressed | Disabled |
|
|
1216
|
+
| --- | --- | --- | --- |
|
|
1217
|
+
|
|
1218
|
+
---
|
|
1219
|
+
|
|
1220
|
+
### Dropdown Button Spacing
|
|
1221
|
+
|
|
1222
|
+
These rules establish how much margin should exist between and around elements.
|
|
1223
|
+
|
|
1224
|
+
---
|
|
1225
|
+
|
|
1226
|
+
## Toggle Button
|
|
1227
|
+
|
|
1228
|
+
| | In Figma | | | Meets Accessibility | | | In Code |
|
|
1229
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
1230
|
+
|
|
1231
|
+
### Live Instance
|
|
1232
|
+
|
|
1233
|
+
Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
|
|
1234
|
+
|
|
1235
|
+
Default
|
|
1236
|
+
|
|
1237
|
+
---
|
|
1238
|
+
|
|
1239
|
+
### Overview
|
|
1240
|
+
|
|
1241
|
+
Use Toggle Button when there is a need to enable or disable an element in the UI (such as toggling visibility of a Panel). If users need to indicate true or false as part of a form or flip a setting or option from off to on (and vise versa), use Toggle Input.
|
|
1242
|
+
|
|
1243
|
+
Optionally, pair Toggle Button with a Tooltip to use as a label to communicate the button's functionality.
|
|
1244
|
+
|
|
1245
|
+
#### Primary
|
|
1246
|
+
|
|
1247
|
+
Toggle Button – Primary should be used in places that require the user's primary attention or to emphasize a primary action. Can be paired with other Button components.
|
|
1248
|
+
|
|
1249
|
+
*Large*
|
|
1250
|
+
|
|
1251
|
+
| Default (Off) | Hover (Off) | Pressed (On) | Default (On) | Hover (On) | Pressed (Off) | Disabled |
|
|
1252
|
+
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
1253
|
+
|
|
1254
|
+
*Medium*
|
|
1255
|
+
|
|
1256
|
+
| Default (Off) | Hover (Off) | Pressed (On) | Default (On) | Hover (On) | Pressed (Off) | Disabled |
|
|
1257
|
+
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
1258
|
+
|
|
1259
|
+
*Small*
|
|
1260
|
+
|
|
1261
|
+
| Default (Off) | Hover (Off) | Pressed (On) | Default (On) | Hover (On) | Pressed (Off) | Disabled |
|
|
1262
|
+
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
1263
|
+
|
|
1264
|
+
#### Secondary
|
|
1265
|
+
|
|
1266
|
+
Toggle Button – Secondary should be used for deemphasized or secondary actions. Can be paired with other Button components.
|
|
1267
|
+
|
|
1268
|
+
*Large*
|
|
1269
|
+
|
|
1270
|
+
| Default (Off) | Hover (Off) | Pressed (On) | Default (On) | Hover (On) | Pressed (Off) | Disabled |
|
|
1271
|
+
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
1272
|
+
|
|
1273
|
+
*Medium*
|
|
1274
|
+
|
|
1275
|
+
| Default (Off) | Hover (Off) | Pressed (On) | Default (On) | Hover (On) | Pressed (Off) | Disabled |
|
|
1276
|
+
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
1277
|
+
|
|
1278
|
+
*Small*
|
|
1279
|
+
|
|
1280
|
+
| Default (Off) | Hover (Off) | Pressed (On) | Default (On) | Hover (On) | Pressed (Off) | Disabled |
|
|
1281
|
+
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
1282
|
+
|
|
1283
|
+
---
|
|
1284
|
+
|
|
1285
|
+
### Toggle Button Spacing
|
|
1286
|
+
|
|
1287
|
+
These rules establish how much margin should exist between and around elements.
|
|
1288
|
+
|
|
1289
|
+
## Code
|
|
1290
|
+
|
|
1291
|
+
## Button Components
|
|
1292
|
+
|
|
1293
|
+
| There are a range of Button types available to use depending on the amount of emphasis the button needs to have, its location in the UI, and whether it is existing alone or alongside other Buttons. | | **Jump to component:** Button ButtonDropdown ButtonToggle |
|
|
1294
|
+
| --- | --- | --- |
|
|
1295
|
+
|
|
1296
|
+
### Visual Preview
|
|
1297
|
+
|
|
1298
|
+
>**Note:** The code examples below must install dependencies before displaying and may take extra time to load
|
|
1299
|
+
|
|
1300
|
+
---
|
|
1301
|
+
|
|
1302
|
+
## Button
|
|
1303
|
+
|
|
1304
|
+
### SDS Source Code
|
|
1305
|
+
|
|
1306
|
+
The component's source code in the SDS codebase can be found here.
|
|
1307
|
+
|
|
1308
|
+
### SDS vs MUI
|
|
1309
|
+
|
|
1310
|
+
The following props are available to MUI's `Button` component, but produce no effect (or unexpected effects) for SDS's `Button` component, so **it is recommended to not use them**:
|
|
1311
|
+
|
|
1312
|
+
* **`variant`****:** This prop is intended to set the `Button` to either `text` only, `contained`, or `outlined`. With SDS's `Button`, they do not function as described in the MUI documentation; however, similar effects, specific to SDS's styles, can be achieved through a combination of the SDS-only props: `sdsStyle` and `sdsType` (see details below).
|
|
1313
|
+
* **`color`****:** SDS'S`Button`does not support this colors or intents that would be expected through this prop. However, the `sdsType` prop can be used to set the button color as `primary` or `secondary`.
|
|
1314
|
+
* **`size`****:** This prop is not supported for SDS's `Button`
|
|
1315
|
+
* **`disableElevation`****:** The SDS `Button` component doesn't have a visual "elevation" or shadowed treatment by default (which this prop disables for MUI's `Button`). Setting `disableElevation={false}` will not render the MUI default elevation treatment.
|
|
1316
|
+
|
|
1317
|
+
Icons can be used in both MUI and SDS `Button` component, but are called in slightly different ways:
|
|
1318
|
+
|
|
1319
|
+
* **`startIcon`** and **`endIcon`****:** Both of these props are supported by both MUI and SDS's `Buttons`. However, MUI expects the prop to receive an individual icon as its own component (for example`startIcon={<DeleteIcon />}`), whereas SDS takes the `Icon` component which references which specific icon to call, as one of its props, as such:
|
|
1320
|
+
|
|
1321
|
+
`startIcon={<Icon sdsIcon="download" sdsSize="s" sdsType="button" />}`
|
|
1322
|
+
|
|
1323
|
+
SDS's `Button` has additional props to allow flexibility while maintaining the SDS styles:
|
|
1324
|
+
|
|
1325
|
+
* **`sdsStyle`****:** takes `minimal` (default), `rounded`, or `square` or `icon` as values
|
|
1326
|
+
* **`sdsType`****:** takes `primary` (default, filled) or `secondary` (outlined) as values
|
|
1327
|
+
|
|
1328
|
+
### MUI Documentation
|
|
1329
|
+
|
|
1330
|
+
Documentation for the underlying MUI `Button` component can be found here.
|
|
1331
|
+
|
|
1332
|
+
### Props
|
|
1333
|
+
|
|
1334
|
+
Any custom SDS props and MUI props required for implementation are found on the tables below. See the MUI documentation for additional optional props.
|
|
1335
|
+
|
|
1336
|
+
If `sdsStyle` is set to either `rounded` or `squared`, the props are as follows:
|
|
1337
|
+
|
|
1338
|
+
| Name | Type | Default | Description |
|
|
1339
|
+
| --- | --- | --- | --- |
|
|
1340
|
+
| `isAllCaps` | `bool` | `false` | When set to `true`, the button text will be displayed in all capital letters. Please note that the `isAllCaps` attribute only applies to buttons with the `sdsStyle` set to `minimal`. |
|
|
1341
|
+
| `sdsStyle` | `"rounded" | "square"` | `-` | Style of the button. |
|
|
1342
|
+
| `sdsType` | `"primary"` `| "secondary"` `| "destructive"` | `-` | Type of the button. |
|
|
1343
|
+
|
|
1344
|
+
If `sdsStyle` is set to `minimal`, the props are listed below:
|
|
1345
|
+
|
|
1346
|
+
| Name | Type | Default | Description |
|
|
1347
|
+
| --- | --- | --- | --- |
|
|
1348
|
+
| `isAllCaps` | `bool` | `false` | When set to `true`, the button text will be displayed in all capital letters. Please note that the `isAllCaps` attribute only applies to buttons with the `sdsStyle` set to `minimal`. |
|
|
1349
|
+
| `sdsStyle` | `"minimal"` | `-` | Style of the button. |
|
|
1350
|
+
| `sdsType` | `"primary"` `| "secondary"` | `-` | Type of the button. |
|
|
1351
|
+
|
|
1352
|
+
And if the `sdsStyle` is set to `icon`, the props are listed below:
|
|
1353
|
+
|
|
1354
|
+
| Name | Type | Default | Description |
|
|
1355
|
+
| --- | --- | --- | --- |
|
|
1356
|
+
| `sdsSize` | `"small"` `| "medium"` `| "large"` | `medium` | Determines the size of the button icon. |
|
|
1357
|
+
| `sdsStyle` | `"icon"` | `-` | Style of the button. |
|
|
1358
|
+
| `sdsType` | `"primary"` `| "secondary"` `| "tertiary"` | `-` | Type of the button icon. |
|
|
1359
|
+
| `icon` | `SDSIcon | React.ReactElement<CustomSVGProps>` | `-` | The actual icon |
|
|
1360
|
+
| `sdsIconProps` | `Partial<IconProps>` | `-` | Props for the icon if an sds icon is used. |
|
|
1361
|
+
|
|
1362
|
+
### Code examples
|
|
1363
|
+
|
|
1364
|
+
#### **Default Button**
|
|
1365
|
+
|
|
1366
|
+
This example has the minimum props needed for the `Button` component.
|
|
1367
|
+
|
|
1368
|
+
**/styles.css**
|
|
1369
|
+
|
|
1370
|
+
```css
|
|
1371
|
+
body {
|
|
1372
|
+
font-size: 13px;
|
|
1373
|
+
font-weight: 400;
|
|
1374
|
+
letter-spacing: 0.08px;
|
|
1375
|
+
line-height: 20px;
|
|
1376
|
+
text-transform: none;
|
|
1377
|
+
font-family: "Inter", sans-serif;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
h1 {
|
|
1381
|
+
font-size: 1.5rem;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
.app {
|
|
1385
|
+
padding: 20px;
|
|
1386
|
+
}
|
|
1387
|
+
```
|
|
1388
|
+
|
|
1389
|
+
**tsconfig.json**
|
|
1390
|
+
|
|
1391
|
+
```json
|
|
1392
|
+
{
|
|
1393
|
+
"include": [
|
|
1394
|
+
"./**/*"
|
|
1395
|
+
],
|
|
1396
|
+
"compilerOptions": {
|
|
1397
|
+
"strict": true,
|
|
1398
|
+
"esModuleInterop": true,
|
|
1399
|
+
"lib": [ "dom", "es2015" ],
|
|
1400
|
+
"jsx": "react-jsx"
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
```
|
|
1404
|
+
|
|
1405
|
+
**/App.tsx**
|
|
1406
|
+
|
|
1407
|
+
```tsx
|
|
1408
|
+
import { Button } from "@czi-sds/components";
|
|
1409
|
+
import "./styles.css";
|
|
1410
|
+
|
|
1411
|
+
function App() {
|
|
1412
|
+
return (
|
|
1413
|
+
<div className="app">
|
|
1414
|
+
<Button sdsType="primary" sdsStyle="square">Label</Button>
|
|
1415
|
+
</div>
|
|
1416
|
+
);
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
export default App;
|
|
1420
|
+
```
|
|
1421
|
+
|
|
1422
|
+
**/index.tsx**
|
|
1423
|
+
|
|
1424
|
+
```tsx
|
|
1425
|
+
import React from "react";
|
|
1426
|
+
import { createRoot } from "react-dom/client";
|
|
1427
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
1428
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
1429
|
+
import { Theme } from "@czi-sds/components";
|
|
1430
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
1431
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
1432
|
+
|
|
1433
|
+
import App from "./App";
|
|
1434
|
+
|
|
1435
|
+
const container = document.getElementById("root");
|
|
1436
|
+
const root = createRoot(container!);
|
|
1437
|
+
|
|
1438
|
+
const RootApp = () => {
|
|
1439
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
1440
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
1441
|
+
|
|
1442
|
+
return (
|
|
1443
|
+
<StyledEngineProvider injectFirst>
|
|
1444
|
+
<ThemeProvider theme={theme}>
|
|
1445
|
+
<EmotionThemeProvider theme={theme}>
|
|
1446
|
+
<CssBaseline />
|
|
1447
|
+
<App />
|
|
1448
|
+
</EmotionThemeProvider>
|
|
1449
|
+
</ThemeProvider>
|
|
1450
|
+
</StyledEngineProvider>
|
|
1451
|
+
);
|
|
1452
|
+
};
|
|
1453
|
+
|
|
1454
|
+
root.render(
|
|
1455
|
+
<React.StrictMode>
|
|
1456
|
+
<RootApp />
|
|
1457
|
+
</React.StrictMode>
|
|
1458
|
+
);
|
|
1459
|
+
|
|
1460
|
+
```
|
|
1461
|
+
|
|
1462
|
+
**/public/index.html**
|
|
1463
|
+
|
|
1464
|
+
```html
|
|
1465
|
+
<!DOCTYPE html>
|
|
1466
|
+
<html lang="en">
|
|
1467
|
+
<head>
|
|
1468
|
+
<meta charset="UTF-8" />
|
|
1469
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1470
|
+
<title>Button</title>
|
|
1471
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
1472
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
1473
|
+
<link
|
|
1474
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
1475
|
+
rel="stylesheet"
|
|
1476
|
+
/>
|
|
1477
|
+
<link
|
|
1478
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
1479
|
+
rel="stylesheet"
|
|
1480
|
+
/>
|
|
1481
|
+
</head>
|
|
1482
|
+
<body>
|
|
1483
|
+
<div id="root"></div>
|
|
1484
|
+
</body>
|
|
1485
|
+
</html>
|
|
1486
|
+
|
|
1487
|
+
```
|
|
1488
|
+
|
|
1489
|
+
**/package.json**
|
|
1490
|
+
|
|
1491
|
+
```json
|
|
1492
|
+
{"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"}
|
|
1493
|
+
```
|
|
1494
|
+
|
|
1495
|
+
---
|
|
1496
|
+
|
|
1497
|
+
#### Button + Icon
|
|
1498
|
+
|
|
1499
|
+
This example shows a `Secondary` button component with an icon.
|
|
1500
|
+
|
|
1501
|
+
**/styles.css**
|
|
1502
|
+
|
|
1503
|
+
```css
|
|
1504
|
+
body {
|
|
1505
|
+
font-size: 13px;
|
|
1506
|
+
font-weight: 400;
|
|
1507
|
+
letter-spacing: 0.08px;
|
|
1508
|
+
line-height: 20px;
|
|
1509
|
+
text-transform: none;
|
|
1510
|
+
font-family: "Inter", sans-serif;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
h1 {
|
|
1514
|
+
font-size: 1.5rem;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
.app {
|
|
1518
|
+
padding: 20px;
|
|
1519
|
+
}
|
|
1520
|
+
```
|
|
1521
|
+
|
|
1522
|
+
**tsconfig.json**
|
|
1523
|
+
|
|
1524
|
+
```json
|
|
1525
|
+
{
|
|
1526
|
+
"include": [
|
|
1527
|
+
"./**/*"
|
|
1528
|
+
],
|
|
1529
|
+
"compilerOptions": {
|
|
1530
|
+
"strict": true,
|
|
1531
|
+
"esModuleInterop": true,
|
|
1532
|
+
"lib": [ "dom", "es2015" ],
|
|
1533
|
+
"jsx": "react-jsx"
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
```
|
|
1537
|
+
|
|
1538
|
+
**/App.tsx**
|
|
1539
|
+
|
|
1540
|
+
```tsx
|
|
1541
|
+
import { Button, Icon } from "@czi-sds/components";
|
|
1542
|
+
import "./styles.css";
|
|
1543
|
+
|
|
1544
|
+
function App() {
|
|
1545
|
+
return (
|
|
1546
|
+
<div className="app">
|
|
1547
|
+
<Button
|
|
1548
|
+
sdsType="secondary"
|
|
1549
|
+
sdsStyle="square"
|
|
1550
|
+
startIcon={<Icon sdsIcon="Download" sdsSize="s" sdsType="button" />}
|
|
1551
|
+
>
|
|
1552
|
+
Download
|
|
1553
|
+
</Button>
|
|
1554
|
+
</div>
|
|
1555
|
+
);
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
export default App;
|
|
1559
|
+
```
|
|
1560
|
+
|
|
1561
|
+
**/index.tsx**
|
|
1562
|
+
|
|
1563
|
+
```tsx
|
|
1564
|
+
import React from "react";
|
|
1565
|
+
import { createRoot } from "react-dom/client";
|
|
1566
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
1567
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
1568
|
+
import { Theme } from "@czi-sds/components";
|
|
1569
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
1570
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
1571
|
+
|
|
1572
|
+
import App from "./App";
|
|
1573
|
+
|
|
1574
|
+
const container = document.getElementById("root");
|
|
1575
|
+
const root = createRoot(container!);
|
|
1576
|
+
|
|
1577
|
+
const RootApp = () => {
|
|
1578
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
1579
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
1580
|
+
|
|
1581
|
+
return (
|
|
1582
|
+
<StyledEngineProvider injectFirst>
|
|
1583
|
+
<ThemeProvider theme={theme}>
|
|
1584
|
+
<EmotionThemeProvider theme={theme}>
|
|
1585
|
+
<CssBaseline />
|
|
1586
|
+
<App />
|
|
1587
|
+
</EmotionThemeProvider>
|
|
1588
|
+
</ThemeProvider>
|
|
1589
|
+
</StyledEngineProvider>
|
|
1590
|
+
);
|
|
1591
|
+
};
|
|
1592
|
+
|
|
1593
|
+
root.render(
|
|
1594
|
+
<React.StrictMode>
|
|
1595
|
+
<RootApp />
|
|
1596
|
+
</React.StrictMode>
|
|
1597
|
+
);
|
|
1598
|
+
|
|
1599
|
+
```
|
|
1600
|
+
|
|
1601
|
+
**/public/index.html**
|
|
1602
|
+
|
|
1603
|
+
```html
|
|
1604
|
+
<!DOCTYPE html>
|
|
1605
|
+
<html lang="en">
|
|
1606
|
+
<head>
|
|
1607
|
+
<meta charset="UTF-8" />
|
|
1608
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1609
|
+
<title>Button</title>
|
|
1610
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
1611
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
1612
|
+
<link
|
|
1613
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
1614
|
+
rel="stylesheet"
|
|
1615
|
+
/>
|
|
1616
|
+
<link
|
|
1617
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
1618
|
+
rel="stylesheet"
|
|
1619
|
+
/>
|
|
1620
|
+
</head>
|
|
1621
|
+
<body>
|
|
1622
|
+
<div id="root"></div>
|
|
1623
|
+
</body>
|
|
1624
|
+
</html>
|
|
1625
|
+
|
|
1626
|
+
```
|
|
1627
|
+
|
|
1628
|
+
**/package.json**
|
|
1629
|
+
|
|
1630
|
+
```json
|
|
1631
|
+
{"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"}
|
|
1632
|
+
```
|
|
1633
|
+
|
|
1634
|
+
---
|
|
1635
|
+
|
|
1636
|
+
#### Icon Button
|
|
1637
|
+
|
|
1638
|
+
This example shows a `icon` style button component.
|
|
1639
|
+
|
|
1640
|
+
**/styles.css**
|
|
1641
|
+
|
|
1642
|
+
```css
|
|
1643
|
+
body {
|
|
1644
|
+
font-size: 13px;
|
|
1645
|
+
font-weight: 400;
|
|
1646
|
+
letter-spacing: 0.08px;
|
|
1647
|
+
line-height: 20px;
|
|
1648
|
+
text-transform: none;
|
|
1649
|
+
font-family: "Inter", sans-serif;
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
h1 {
|
|
1653
|
+
font-size: 1.5rem;
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
.app {
|
|
1657
|
+
padding: 20px;
|
|
1658
|
+
}
|
|
1659
|
+
```
|
|
1660
|
+
|
|
1661
|
+
**tsconfig.json**
|
|
1662
|
+
|
|
1663
|
+
```json
|
|
1664
|
+
{
|
|
1665
|
+
"include": [
|
|
1666
|
+
"./**/*"
|
|
1667
|
+
],
|
|
1668
|
+
"compilerOptions": {
|
|
1669
|
+
"strict": true,
|
|
1670
|
+
"esModuleInterop": true,
|
|
1671
|
+
"lib": [ "dom", "es2015" ],
|
|
1672
|
+
"jsx": "react-jsx"
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
```
|
|
1676
|
+
|
|
1677
|
+
**/App.tsx**
|
|
1678
|
+
|
|
1679
|
+
```tsx
|
|
1680
|
+
import { Button, Icon } from "@czi-sds/components";
|
|
1681
|
+
import "./styles.css";
|
|
1682
|
+
|
|
1683
|
+
function App() {
|
|
1684
|
+
return (
|
|
1685
|
+
<div className="app">
|
|
1686
|
+
<Button
|
|
1687
|
+
sdsType="primary"
|
|
1688
|
+
sdsStyle="icon"
|
|
1689
|
+
icon="Download"
|
|
1690
|
+
/>
|
|
1691
|
+
</div>
|
|
1692
|
+
);
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
export default App;
|
|
1696
|
+
```
|
|
1697
|
+
|
|
1698
|
+
**/index.tsx**
|
|
1699
|
+
|
|
1700
|
+
```tsx
|
|
1701
|
+
import React from "react";
|
|
1702
|
+
import { createRoot } from "react-dom/client";
|
|
1703
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
1704
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
1705
|
+
import { Theme } from "@czi-sds/components";
|
|
1706
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
1707
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
1708
|
+
|
|
1709
|
+
import App from "./App";
|
|
1710
|
+
|
|
1711
|
+
const container = document.getElementById("root");
|
|
1712
|
+
const root = createRoot(container!);
|
|
1713
|
+
|
|
1714
|
+
const RootApp = () => {
|
|
1715
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
1716
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
1717
|
+
|
|
1718
|
+
return (
|
|
1719
|
+
<StyledEngineProvider injectFirst>
|
|
1720
|
+
<ThemeProvider theme={theme}>
|
|
1721
|
+
<EmotionThemeProvider theme={theme}>
|
|
1722
|
+
<CssBaseline />
|
|
1723
|
+
<App />
|
|
1724
|
+
</EmotionThemeProvider>
|
|
1725
|
+
</ThemeProvider>
|
|
1726
|
+
</StyledEngineProvider>
|
|
1727
|
+
);
|
|
1728
|
+
};
|
|
1729
|
+
|
|
1730
|
+
root.render(
|
|
1731
|
+
<React.StrictMode>
|
|
1732
|
+
<RootApp />
|
|
1733
|
+
</React.StrictMode>
|
|
1734
|
+
);
|
|
1735
|
+
|
|
1736
|
+
```
|
|
1737
|
+
|
|
1738
|
+
**/public/index.html**
|
|
1739
|
+
|
|
1740
|
+
```html
|
|
1741
|
+
<!DOCTYPE html>
|
|
1742
|
+
<html lang="en">
|
|
1743
|
+
<head>
|
|
1744
|
+
<meta charset="UTF-8" />
|
|
1745
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1746
|
+
<title>Button</title>
|
|
1747
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
1748
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
1749
|
+
<link
|
|
1750
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
1751
|
+
rel="stylesheet"
|
|
1752
|
+
/>
|
|
1753
|
+
<link
|
|
1754
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
1755
|
+
rel="stylesheet"
|
|
1756
|
+
/>
|
|
1757
|
+
</head>
|
|
1758
|
+
<body>
|
|
1759
|
+
<div id="root"></div>
|
|
1760
|
+
</body>
|
|
1761
|
+
</html>
|
|
1762
|
+
|
|
1763
|
+
```
|
|
1764
|
+
|
|
1765
|
+
**/package.json**
|
|
1766
|
+
|
|
1767
|
+
```json
|
|
1768
|
+
{"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"}
|
|
1769
|
+
```
|
|
1770
|
+
|
|
1771
|
+
---
|
|
1772
|
+
|
|
1773
|
+
---
|
|
1774
|
+
|
|
1775
|
+
## ButtonDropdown
|
|
1776
|
+
|
|
1777
|
+
### SDS Source Code
|
|
1778
|
+
|
|
1779
|
+
The component's source code in the SDS codebase can be found here.
|
|
1780
|
+
|
|
1781
|
+
### SDS vs MUI
|
|
1782
|
+
|
|
1783
|
+
The SDS `ButtonDropdown` component is just the regular `Button` component, with the `chevronDown` icon added at the end of the button after the label text, via the MUI `endIcon` prop. Additionally, `ButtonDropdown` requires a `startIcon`. In SDS, both the `endIcon` and `startIcon` props take the `Icon` component, which references the specific icon to call as one of its props, like so:
|
|
1784
|
+
|
|
1785
|
+
`startIcon={<Icon sdsIcon="download" sdsSize="s" sdsType="button" />}`
|
|
1786
|
+
|
|
1787
|
+
whereas MUI expects the prop to receive an individual icon as its own component (for example`startIcon={<DeleteIcon />}`).
|
|
1788
|
+
|
|
1789
|
+
Since `ButtonIcon` is very similar to SDS's `Button` component, similar caveats apply in terms of the MUI props. The following props are available to MUI's `Button` component, but produce no effect (or unexpected effects) for SDS's `ButtonIcon` component, so it is recommended to not use them:
|
|
1790
|
+
|
|
1791
|
+
* **`variant`****:** This prop is intended to set the `Button` to either `text` only, `contained`, or `outlined`. With SDS's `ButtonIcon`, however, they do not function as described in the MUI documentation; however, similar effects, specific to SDS's styles, can be achieved through a combination of the SDS-only `sdsStyle` and `sdsType` props (see below).
|
|
1792
|
+
* **`color`****:** This prop doesn't work as expected for SDS's `ButtonIcon`, which doesn't support colors or intents. The `sdsType` prop can be used to set the button as `primary` or `secondary`, though.
|
|
1793
|
+
* **`size`****:** This prop is not supported for SDS's `ButtonIcon`
|
|
1794
|
+
* **`disableElevation`****:** The SDS `ButtonIcon` component doesn't have a visual "elevation" or shadowed treatment by default (which this prop disables for MUI's `Button`). However, setting `disableElevation={false}` will not render the MUI default elevation treatment.
|
|
1795
|
+
|
|
1796
|
+
SDS's `ButtonIcon` has additional props to allow flexibility while maintaining the SDS styles:
|
|
1797
|
+
|
|
1798
|
+
* **`sdsStyle`****:** takes `minimal` (default), `rounded`, or `square` as values
|
|
1799
|
+
* **`sdsType`****:** takes `primary` (default, filled) or `secondary` (outlined) as values
|
|
1800
|
+
|
|
1801
|
+
### MUI Documentation
|
|
1802
|
+
|
|
1803
|
+
Documentation for the underlying MUI component can be found here.
|
|
1804
|
+
|
|
1805
|
+
### Props
|
|
1806
|
+
|
|
1807
|
+
Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
|
|
1808
|
+
|
|
1809
|
+
| Name | Type | Default | Description |
|
|
1810
|
+
| --- | --- | --- | --- |
|
|
1811
|
+
| `icon` | `SDSIcon | React.ReactElement<CustomSVGProps>` | `-` | An `icon` element placed before the children. |
|
|
1812
|
+
| `sdsStyle` | `"icon"` `| "rounded"` `| "square"` | `-` | Style of the button. |
|
|
1813
|
+
| `sdsType` | `"primary" | "secondary"` | `-` | Type of the button. |
|
|
1814
|
+
| `sdsSize` | `"small" | "medium" | "large"` | `"medium"` | Size of the icon. |
|
|
1815
|
+
| `sdsIconProps` | `Partial<IconProps>` | `-` | Props for the icon if an SDS icon is used. |
|
|
1816
|
+
|
|
1817
|
+
### Code examples
|
|
1818
|
+
|
|
1819
|
+
#### **Default ButtonDropdown**
|
|
1820
|
+
|
|
1821
|
+
This example has the minimum props needed for the `ButtonDropdown` component.
|
|
1822
|
+
|
|
1823
|
+
**/styles.css**
|
|
1824
|
+
|
|
1825
|
+
```css
|
|
1826
|
+
body {
|
|
1827
|
+
font-size: 13px;
|
|
1828
|
+
font-weight: 400;
|
|
1829
|
+
letter-spacing: 0.08px;
|
|
1830
|
+
line-height: 20px;
|
|
1831
|
+
text-transform: none;
|
|
1832
|
+
font-family: "Inter", sans-serif;
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
h1 {
|
|
1836
|
+
font-size: 1.5rem;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
.app {
|
|
1840
|
+
padding: 20px;
|
|
1841
|
+
}
|
|
1842
|
+
```
|
|
1843
|
+
|
|
1844
|
+
**tsconfig.json**
|
|
1845
|
+
|
|
1846
|
+
```json
|
|
1847
|
+
{
|
|
1848
|
+
"include": [
|
|
1849
|
+
"./**/*"
|
|
1850
|
+
],
|
|
1851
|
+
"compilerOptions": {
|
|
1852
|
+
"strict": true,
|
|
1853
|
+
"esModuleInterop": true,
|
|
1854
|
+
"lib": [ "dom", "es2015" ],
|
|
1855
|
+
"jsx": "react-jsx"
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
```
|
|
1859
|
+
|
|
1860
|
+
**/App.tsx**
|
|
1861
|
+
|
|
1862
|
+
```tsx
|
|
1863
|
+
import { ButtonDropdown } from "@czi-sds/components";
|
|
1864
|
+
import "./styles.css";
|
|
1865
|
+
|
|
1866
|
+
function App() {
|
|
1867
|
+
return (
|
|
1868
|
+
<div className="app">
|
|
1869
|
+
<ButtonDropdown sdsType="primary" sdsStyle="square">
|
|
1870
|
+
Label
|
|
1871
|
+
</ButtonDropdown>
|
|
1872
|
+
</div>
|
|
1873
|
+
);
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
export default App;
|
|
1877
|
+
```
|
|
1878
|
+
|
|
1879
|
+
**/index.tsx**
|
|
1880
|
+
|
|
1881
|
+
```tsx
|
|
1882
|
+
import React from "react";
|
|
1883
|
+
import { createRoot } from "react-dom/client";
|
|
1884
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
1885
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
1886
|
+
import { Theme } from "@czi-sds/components";
|
|
1887
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
1888
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
1889
|
+
|
|
1890
|
+
import App from "./App";
|
|
1891
|
+
|
|
1892
|
+
const container = document.getElementById("root");
|
|
1893
|
+
const root = createRoot(container!);
|
|
1894
|
+
|
|
1895
|
+
const RootApp = () => {
|
|
1896
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
1897
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
1898
|
+
|
|
1899
|
+
return (
|
|
1900
|
+
<StyledEngineProvider injectFirst>
|
|
1901
|
+
<ThemeProvider theme={theme}>
|
|
1902
|
+
<EmotionThemeProvider theme={theme}>
|
|
1903
|
+
<CssBaseline />
|
|
1904
|
+
<App />
|
|
1905
|
+
</EmotionThemeProvider>
|
|
1906
|
+
</ThemeProvider>
|
|
1907
|
+
</StyledEngineProvider>
|
|
1908
|
+
);
|
|
1909
|
+
};
|
|
1910
|
+
|
|
1911
|
+
root.render(
|
|
1912
|
+
<React.StrictMode>
|
|
1913
|
+
<RootApp />
|
|
1914
|
+
</React.StrictMode>
|
|
1915
|
+
);
|
|
1916
|
+
|
|
1917
|
+
```
|
|
1918
|
+
|
|
1919
|
+
**/public/index.html**
|
|
1920
|
+
|
|
1921
|
+
```html
|
|
1922
|
+
<!DOCTYPE html>
|
|
1923
|
+
<html lang="en">
|
|
1924
|
+
<head>
|
|
1925
|
+
<meta charset="UTF-8" />
|
|
1926
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1927
|
+
<title>Button</title>
|
|
1928
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
1929
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
1930
|
+
<link
|
|
1931
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
1932
|
+
rel="stylesheet"
|
|
1933
|
+
/>
|
|
1934
|
+
<link
|
|
1935
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
1936
|
+
rel="stylesheet"
|
|
1937
|
+
/>
|
|
1938
|
+
</head>
|
|
1939
|
+
<body>
|
|
1940
|
+
<div id="root"></div>
|
|
1941
|
+
</body>
|
|
1942
|
+
</html>
|
|
1943
|
+
|
|
1944
|
+
```
|
|
1945
|
+
|
|
1946
|
+
**/package.json**
|
|
1947
|
+
|
|
1948
|
+
```json
|
|
1949
|
+
{"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"}
|
|
1950
|
+
```
|
|
1951
|
+
|
|
1952
|
+
---
|
|
1953
|
+
|
|
1954
|
+
#### ButtonDropdown with a start icon
|
|
1955
|
+
|
|
1956
|
+
This example shows how to incorporate a starting icon within a `ButtonDropdown` component.
|
|
1957
|
+
|
|
1958
|
+
**/styles.css**
|
|
1959
|
+
|
|
1960
|
+
```css
|
|
1961
|
+
body {
|
|
1962
|
+
font-size: 13px;
|
|
1963
|
+
font-weight: 400;
|
|
1964
|
+
letter-spacing: 0.08px;
|
|
1965
|
+
line-height: 20px;
|
|
1966
|
+
text-transform: none;
|
|
1967
|
+
font-family: "Inter", sans-serif;
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
h1 {
|
|
1971
|
+
font-size: 1.5rem;
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
.app {
|
|
1975
|
+
padding: 20px;
|
|
1976
|
+
}
|
|
1977
|
+
```
|
|
1978
|
+
|
|
1979
|
+
**tsconfig.json**
|
|
1980
|
+
|
|
1981
|
+
```json
|
|
1982
|
+
{
|
|
1983
|
+
"include": [
|
|
1984
|
+
"./**/*"
|
|
1985
|
+
],
|
|
1986
|
+
"compilerOptions": {
|
|
1987
|
+
"strict": true,
|
|
1988
|
+
"esModuleInterop": true,
|
|
1989
|
+
"lib": [ "dom", "es2015" ],
|
|
1990
|
+
"jsx": "react-jsx"
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
```
|
|
1994
|
+
|
|
1995
|
+
**/App.tsx**
|
|
1996
|
+
|
|
1997
|
+
```tsx
|
|
1998
|
+
import { ButtonDropdown, Icon } from "@czi-sds/components";
|
|
1999
|
+
import "./styles.css";
|
|
2000
|
+
|
|
2001
|
+
function App() {
|
|
2002
|
+
return (
|
|
2003
|
+
<div className="app">
|
|
2004
|
+
<ButtonDropdown
|
|
2005
|
+
icon={<Icon sdsIcon="Bacteria" sdsSize="s" sdsType="button" />}
|
|
2006
|
+
sdsType="primary"
|
|
2007
|
+
sdsStyle="square"
|
|
2008
|
+
>
|
|
2009
|
+
Bacteria Types
|
|
2010
|
+
</ButtonDropdown>
|
|
2011
|
+
</div>
|
|
2012
|
+
);
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
export default App;
|
|
2016
|
+
```
|
|
2017
|
+
|
|
2018
|
+
**/index.tsx**
|
|
2019
|
+
|
|
2020
|
+
```tsx
|
|
2021
|
+
import React from "react";
|
|
2022
|
+
import { createRoot } from "react-dom/client";
|
|
2023
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
2024
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
2025
|
+
import { Theme } from "@czi-sds/components";
|
|
2026
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
2027
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
2028
|
+
|
|
2029
|
+
import App from "./App";
|
|
2030
|
+
|
|
2031
|
+
const container = document.getElementById("root");
|
|
2032
|
+
const root = createRoot(container!);
|
|
2033
|
+
|
|
2034
|
+
const RootApp = () => {
|
|
2035
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
2036
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
2037
|
+
|
|
2038
|
+
return (
|
|
2039
|
+
<StyledEngineProvider injectFirst>
|
|
2040
|
+
<ThemeProvider theme={theme}>
|
|
2041
|
+
<EmotionThemeProvider theme={theme}>
|
|
2042
|
+
<CssBaseline />
|
|
2043
|
+
<App />
|
|
2044
|
+
</EmotionThemeProvider>
|
|
2045
|
+
</ThemeProvider>
|
|
2046
|
+
</StyledEngineProvider>
|
|
2047
|
+
);
|
|
2048
|
+
};
|
|
2049
|
+
|
|
2050
|
+
root.render(
|
|
2051
|
+
<React.StrictMode>
|
|
2052
|
+
<RootApp />
|
|
2053
|
+
</React.StrictMode>
|
|
2054
|
+
);
|
|
2055
|
+
|
|
2056
|
+
```
|
|
2057
|
+
|
|
2058
|
+
**/public/index.html**
|
|
2059
|
+
|
|
2060
|
+
```html
|
|
2061
|
+
<!DOCTYPE html>
|
|
2062
|
+
<html lang="en">
|
|
2063
|
+
<head>
|
|
2064
|
+
<meta charset="UTF-8" />
|
|
2065
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
2066
|
+
<title>Button</title>
|
|
2067
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
2068
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
2069
|
+
<link
|
|
2070
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
2071
|
+
rel="stylesheet"
|
|
2072
|
+
/>
|
|
2073
|
+
<link
|
|
2074
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
2075
|
+
rel="stylesheet"
|
|
2076
|
+
/>
|
|
2077
|
+
</head>
|
|
2078
|
+
<body>
|
|
2079
|
+
<div id="root"></div>
|
|
2080
|
+
</body>
|
|
2081
|
+
</html>
|
|
2082
|
+
|
|
2083
|
+
```
|
|
2084
|
+
|
|
2085
|
+
**/package.json**
|
|
2086
|
+
|
|
2087
|
+
```json
|
|
2088
|
+
{"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"}
|
|
2089
|
+
```
|
|
2090
|
+
|
|
2091
|
+
---
|
|
2092
|
+
|
|
2093
|
+
---
|
|
2094
|
+
|
|
2095
|
+
## ButtonToggle
|
|
2096
|
+
|
|
2097
|
+
### SDS Source Code
|
|
2098
|
+
|
|
2099
|
+
The component's source code in the SDS codebase can be found here.
|
|
2100
|
+
|
|
2101
|
+
### MUI Documentation
|
|
2102
|
+
|
|
2103
|
+
Documentation for the underlying MUI component can be found here.
|
|
2104
|
+
|
|
2105
|
+
### Props
|
|
2106
|
+
|
|
2107
|
+
Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
|
|
2108
|
+
|
|
2109
|
+
| Name | Type | Default | Description |
|
|
2110
|
+
| --- | --- | --- | --- |
|
|
2111
|
+
| `icon` | `SDSIcon | React.ReactElement<CustomSVGProps>` | `-` | The `icon` element displayed within the component. |
|
|
2112
|
+
| `sdsStage` | `"on"` `| "off"` | `off` | Controls the toggle stage. |
|
|
2113
|
+
| `sdsType` | `"primary" | "secondary"` | `-` | Type of the button. |
|
|
2114
|
+
| `sdsSize` | `"small" | "medium" | "large"` | `"medium"` | Size of the icon. |
|
|
2115
|
+
| `disabled` | `bool` | `false` | Disables the toggle button when set to `true`. |
|
|
2116
|
+
|
|
2117
|
+
### Code examples
|
|
2118
|
+
|
|
2119
|
+
#### **Default ButtonToggle**
|
|
2120
|
+
|
|
2121
|
+
This example has the minimum props needed for the `ButtonToggle` component.
|
|
2122
|
+
|
|
2123
|
+
**/styles.css**
|
|
2124
|
+
|
|
2125
|
+
```css
|
|
2126
|
+
body {
|
|
2127
|
+
font-size: 13px;
|
|
2128
|
+
font-weight: 400;
|
|
2129
|
+
letter-spacing: 0.08px;
|
|
2130
|
+
line-height: 20px;
|
|
2131
|
+
text-transform: none;
|
|
2132
|
+
font-family: "Inter", sans-serif;
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
h1 {
|
|
2136
|
+
font-size: 1.5rem;
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
.app {
|
|
2140
|
+
padding: 20px;
|
|
2141
|
+
}
|
|
2142
|
+
```
|
|
2143
|
+
|
|
2144
|
+
**tsconfig.json**
|
|
2145
|
+
|
|
2146
|
+
```json
|
|
2147
|
+
{
|
|
2148
|
+
"include": [
|
|
2149
|
+
"./**/*"
|
|
2150
|
+
],
|
|
2151
|
+
"compilerOptions": {
|
|
2152
|
+
"strict": true,
|
|
2153
|
+
"esModuleInterop": true,
|
|
2154
|
+
"lib": [ "dom", "es2015" ],
|
|
2155
|
+
"jsx": "react-jsx"
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
```
|
|
2159
|
+
|
|
2160
|
+
**/App.tsx**
|
|
2161
|
+
|
|
2162
|
+
```tsx
|
|
2163
|
+
import * as React from "react";
|
|
2164
|
+
import { ButtonToggle } from "@czi-sds/components";
|
|
2165
|
+
import "./styles.css";
|
|
2166
|
+
|
|
2167
|
+
function App() {
|
|
2168
|
+
const [toggle, setToggle] = React.useState(0);
|
|
2169
|
+
|
|
2170
|
+
return (
|
|
2171
|
+
<div className="app">
|
|
2172
|
+
<ButtonToggle
|
|
2173
|
+
icon="InfoCircle"
|
|
2174
|
+
sdsStage={toggle ? "on" : "off"}
|
|
2175
|
+
onClick={() => setToggle((prev) => !prev)}
|
|
2176
|
+
>
|
|
2177
|
+
Label
|
|
2178
|
+
</ButtonToggle>
|
|
2179
|
+
</div>
|
|
2180
|
+
);
|
|
2181
|
+
}
|
|
2182
|
+
|
|
2183
|
+
export default App;
|
|
2184
|
+
```
|
|
2185
|
+
|
|
2186
|
+
**/index.tsx**
|
|
2187
|
+
|
|
2188
|
+
```tsx
|
|
2189
|
+
import React from "react";
|
|
2190
|
+
import { createRoot } from "react-dom/client";
|
|
2191
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
2192
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
2193
|
+
import { Theme } from "@czi-sds/components";
|
|
2194
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
2195
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
2196
|
+
|
|
2197
|
+
import App from "./App";
|
|
2198
|
+
|
|
2199
|
+
const container = document.getElementById("root");
|
|
2200
|
+
const root = createRoot(container!);
|
|
2201
|
+
|
|
2202
|
+
const RootApp = () => {
|
|
2203
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
2204
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
2205
|
+
|
|
2206
|
+
return (
|
|
2207
|
+
<StyledEngineProvider injectFirst>
|
|
2208
|
+
<ThemeProvider theme={theme}>
|
|
2209
|
+
<EmotionThemeProvider theme={theme}>
|
|
2210
|
+
<CssBaseline />
|
|
2211
|
+
<App />
|
|
2212
|
+
</EmotionThemeProvider>
|
|
2213
|
+
</ThemeProvider>
|
|
2214
|
+
</StyledEngineProvider>
|
|
2215
|
+
);
|
|
2216
|
+
};
|
|
2217
|
+
|
|
2218
|
+
root.render(
|
|
2219
|
+
<React.StrictMode>
|
|
2220
|
+
<RootApp />
|
|
2221
|
+
</React.StrictMode>
|
|
2222
|
+
);
|
|
2223
|
+
|
|
2224
|
+
```
|
|
2225
|
+
|
|
2226
|
+
**/public/index.html**
|
|
2227
|
+
|
|
2228
|
+
```html
|
|
2229
|
+
<!DOCTYPE html>
|
|
2230
|
+
<html lang="en">
|
|
2231
|
+
<head>
|
|
2232
|
+
<meta charset="UTF-8" />
|
|
2233
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
2234
|
+
<title>Button</title>
|
|
2235
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
2236
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
2237
|
+
<link
|
|
2238
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
2239
|
+
rel="stylesheet"
|
|
2240
|
+
/>
|
|
2241
|
+
<link
|
|
2242
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
2243
|
+
rel="stylesheet"
|
|
2244
|
+
/>
|
|
2245
|
+
</head>
|
|
2246
|
+
<body>
|
|
2247
|
+
<div id="root"></div>
|
|
2248
|
+
</body>
|
|
2249
|
+
</html>
|
|
2250
|
+
|
|
2251
|
+
```
|
|
2252
|
+
|
|
2253
|
+
**/package.json**
|
|
2254
|
+
|
|
2255
|
+
```json
|
|
2256
|
+
{"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"}
|
|
2257
|
+
```
|
|
2258
|
+
|
|
2259
|
+
---
|
|
2260
|
+
|