@@ -43,6 +43,13 @@ See [API](#api) for all available options.
43
43
- Use button group to group ** related actions** that a user can take. Buttons
44
44
should not be grouped just to save space on the screen.
45
45
46
+ - ** Mixing multiple button priorities** and some other properties within a
47
+ button group is [ not allowed] ( #shared-properties ) . The priority can only be
48
+ set for all buttons in the group at once.
49
+
50
+ - In most use cases, ** secondary action color** is probably the best option for
51
+ buttons in a group as it works good with the colors of the selected state.
52
+
46
53
- Use ** short labels or icons** so the buttons can fit small screens.
47
54
48
55
- For toggling between on/off states, use rather the
@@ -58,11 +65,17 @@ See [API](#api) for all available options.
58
65
### Shared Properties
59
66
60
67
You can set the following properties directly on ButtonGroup to be shared for
61
- all buttons inside the group: size, priority, disabled state, and block width.
68
+ all buttons inside the group:
69
+
70
+ - ` size ` ,
71
+ - ` priority ` ,
72
+ - ` disabled ` state,
73
+ - and ` block ` width.
74
+
62
75
These properties are then passed over to individual buttons. At the same time,
63
- they ** cannot be overridden** on the buttons' level. While technically possible,
64
- from the design point of view it's undesirable to group buttons of totally
65
- different types or sizes.
76
+ they ** cannot be overridden** on the buttons' level. While (in theory)
77
+ technically possible, from the design point of view it's undesirable to group
78
+ buttons of totally different types or sizes.
66
79
67
80
## Priorities
68
81
@@ -73,16 +86,19 @@ priorities of the [Button](/components/button) component:
73
86
2 . outline
74
87
3 . flat
75
88
89
+ 👉 To avoid undesired combinations, the visual priority of the button group
90
+ ** cannot be overridden** on the Button level.
91
+
76
92
### Filled
77
93
78
94
The default, high-emphasis priority should be used for primary actions of your
79
95
app.
80
96
81
97
<Playground >
82
98
<ButtonGroup >
83
- <Button label = " Week" />
84
- <Button label = " Month" />
85
- <Button label = " Year" />
99
+ <Button color = " secondary " label = " Week" />
100
+ <Button color = " secondary " label = " Month" />
101
+ <Button color = " secondary " label = " Year" />
86
102
</ButtonGroup >
87
103
</Playground >
88
104
@@ -93,9 +109,9 @@ in your app.
93
109
94
110
<Playground >
95
111
<ButtonGroup priority = " outline" >
96
- <Button label = " Week" />
97
- <Button label = " Month" />
98
- <Button label = " Year" />
112
+ <Button color = " secondary " label = " Week" />
113
+ <Button color = " secondary " label = " Month" />
114
+ <Button color = " secondary " label = " Year" />
99
115
</ButtonGroup >
100
116
</Playground >
101
117
@@ -106,9 +122,9 @@ the content.
106
122
107
123
<Playground >
108
124
<ButtonGroup priority = " flat" >
109
- <Button label = " Week" />
110
- <Button label = " Month" />
111
- <Button label = " Year" />
125
+ <Button color = " secondary " label = " Week" />
126
+ <Button color = " secondary " label = " Month" />
127
+ <Button color = " secondary " label = " Year" />
112
128
</ButtonGroup >
113
129
</Playground >
114
130
@@ -119,29 +135,29 @@ medium, and large.
119
135
120
136
<Playground >
121
137
<ButtonGroup size = " small" >
122
- <Button label = " Week" />
123
- <Button label = " Month" />
124
- <Button label = " Year" />
138
+ <Button color = " secondary " label = " Week" />
139
+ <Button color = " secondary " label = " Month" />
140
+ <Button color = " secondary " label = " Year" />
125
141
</ButtonGroup >
126
142
<ButtonGroup >
127
- <Button label = " Week" />
128
- <Button label = " Month" />
129
- <Button label = " Year" />
143
+ <Button color = " secondary " label = " Week" />
144
+ <Button color = " secondary " label = " Month" />
145
+ <Button color = " secondary " label = " Year" />
130
146
</ButtonGroup >
131
147
<ButtonGroup size = " large" >
132
- <Button label = " Week" />
133
- <Button label = " Month" />
134
- <Button label = " Year" />
148
+ <Button color = " secondary " label = " Week" />
149
+ <Button color = " secondary " label = " Month" />
150
+ <Button color = " secondary " label = " Year" />
135
151
</ButtonGroup >
136
152
</Playground >
137
153
138
154
Block button groups span the full width of a parent:
139
155
140
156
<Playground >
141
157
<ButtonGroup block >
142
- <Button label = " Week" />
143
- <Button label = " Month" />
144
- <Button label = " Year" />
158
+ <Button color = " secondary " label = " Week" />
159
+ <Button color = " secondary " label = " Month" />
160
+ <Button color = " secondary " label = " Year" />
145
161
</ButtonGroup >
146
162
</Playground >
147
163
@@ -153,19 +169,19 @@ Disables all buttons inside the group.
153
169
154
170
<Playground >
155
171
<ButtonGroup disabled >
156
- <Button label = " Week" />
157
- <Button label = " Month" />
158
- <Button label = " Year" />
172
+ <Button color = " secondary " label = " Week" />
173
+ <Button color = " secondary " label = " Month" />
174
+ <Button color = " secondary " label = " Year" />
159
175
</ButtonGroup >
160
176
<ButtonGroup priority = " outline" disabled >
161
- <Button label = " Week" />
162
- <Button label = " Month" />
163
- <Button label = " Year" />
177
+ <Button color = " secondary " label = " Week" />
178
+ <Button color = " secondary " label = " Month" />
179
+ <Button color = " secondary " label = " Year" />
164
180
</ButtonGroup >
165
181
<ButtonGroup priority = " flat" disabled >
166
- <Button label = " Week" />
167
- <Button label = " Month" />
168
- <Button label = " Year" />
182
+ <Button color = " secondary " label = " Week" />
183
+ <Button color = " secondary " label = " Month" />
184
+ <Button color = " secondary " label = " Year" />
169
185
</ButtonGroup >
170
186
</Playground >
171
187
@@ -176,19 +192,19 @@ state of individual buttons can be indicated by showing an icon.
176
192
177
193
<Playground >
178
194
<ButtonGroup >
179
- <Button label = " Week " color = " success " feedbackIcon = { <Icon icon = " success" />} />
180
- <Button label = " Month" />
181
- <Button label = " Year" />
195
+ <Button color = " success " label = " Week " feedbackIcon = { <Icon icon = " success" />} />
196
+ <Button color = " secondary " label = " Month" />
197
+ <Button color = " secondary " label = " Year" />
182
198
</ButtonGroup >
183
199
<ButtonGroup priority = " outline" >
184
- <Button label = " Week " color = " success " feedbackIcon = { <Icon icon = " success" />} />
185
- <Button label = " Month" />
186
- <Button label = " Year" />
200
+ <Button color = " success " label = " Week " feedbackIcon = { <Icon icon = " success" />} />
201
+ <Button color = " secondary " label = " Month" />
202
+ <Button color = " secondary " label = " Year" />
187
203
</ButtonGroup >
188
204
<ButtonGroup priority = " flat" >
189
- <Button label = " Week " color = " success " feedbackIcon = { <Icon icon = " success" />} />
190
- <Button label = " Month" />
191
- <Button label = " Year" />
205
+ <Button color = " success " label = " Week " feedbackIcon = { <Icon icon = " success" />} />
206
+ <Button color = " secondary " label = " Month" />
207
+ <Button color = " secondary " label = " Year" />
192
208
</ButtonGroup >
193
209
</Playground >
194
210
@@ -200,18 +216,18 @@ the desired item.
200
216
<Playground >
201
217
<ButtonGroup >
202
218
<Button color = " selected" label = " Week" />
203
- <Button label = " Month" />
204
- <Button label = " Year" />
219
+ <Button color = " secondary " label = " Month" />
220
+ <Button color = " secondary " label = " Year" />
205
221
</ButtonGroup >
206
222
<ButtonGroup priority = " outline" >
207
223
<Button color = " selected" label = " Week" />
208
- <Button label = " Month" />
209
- <Button label = " Year" />
224
+ <Button color = " secondary " label = " Month" />
225
+ <Button color = " secondary " label = " Year" />
210
226
</ButtonGroup >
211
227
<ButtonGroup priority = " flat" >
212
228
<Button color = " selected" label = " Week" />
213
- <Button label = " Month" />
214
- <Button label = " Year" />
229
+ <Button color = " secondary " label = " Month" />
230
+ <Button color = " secondary " label = " Year" />
215
231
</ButtonGroup >
216
232
</Playground >
217
233
@@ -224,9 +240,9 @@ and communicating the state of individual options.
224
240
<>
225
241
<span id = " period-label" >Period:</span >
226
242
<ButtonGroup aria-labelledby = " period-label" >
227
- <Button label = " Week" aria-pressed color = " selected " />
228
- <Button label = " Month" aria-pressed = { false } />
229
- <Button label = " Year" aria-pressed = { false } />
243
+ <Button color = " selected " label = " Week" aria-pressed />
244
+ <Button color = " secondary " label = " Month" aria-pressed = { false } />
245
+ <Button color = " secondary " label = " Year" aria-pressed = { false } />
230
246
</ButtonGroup >
231
247
</>
232
248
</Playground >
0 commit comments