@@ -171,62 +171,63 @@ const style = { display: 'inline-block', margin: 10 };
171
171
< / div> ;
172
172
```
173
173
174
- ### Icons
174
+ ### Custom Width
175
175
176
- Specify the ` icon ` prop on each option to display a supported icon to the left of that option, or use the ` svg ` prop to use a custom icon .
176
+ Use the ` width ` prop to customize the width of the button .
177
177
178
178
``` jsx
179
- const customIcon = {
180
- viewBox: ' 0 0 16 16' ,
181
- svg: (
182
- < path
183
- fill= " #818f99"
184
- fillRule= " evenodd"
185
- d= " M8 .2A8 8 0 0 0 5.47 15.79c.4.074.546-.173.546-.385 0-.19-.007-.693-.01-1.36-2.226.483-2.695-1.073-2.695-1.073-.364-.924-.889-1.17-.889-1.17-.726-.496.055-.486.055-.486.803.056 1.226.824 1.226.824.713 1.222 1.872.87 2.328.665.073-.517.279-.87.508-1.07-1.777-.201-3.644-.888-3.644-3.953 0-.874.312-1.588.823-2.147-.082-.202-.357-1.016.078-2.117 0 0 .672-.215 2.2.82A7.662 7.662 0 0 1 8 4.068c.68.004 1.364.092 2.003.27 1.527-1.035 2.198-.82 2.198-.82.436 1.101.162 1.915.08 2.117.512.56.822 1.273.822 2.147 0 3.073-1.87 3.75-3.653 3.947.287.247.543.735.543 1.482 0 1.069-.01 1.932-.01 2.194 0 .214.144.463.55.385A8 8 0 0 0 8 .2"
186
- / >
187
- ),
188
- };
189
-
190
179
const actions = [
191
180
{
192
- id: ' custom-icon ' ,
193
- svg : customIcon . svg ,
194
- label: ' GitHub ' ,
181
+ id: ' one ' ,
182
+ icon : ' pencil ' ,
183
+ label: ' Do thing one ' ,
195
184
onClick () {
196
- console .log (' GitHub ' );
185
+ console .log (' Thing one ' );
197
186
},
198
187
},
199
188
{
200
- id: ' standard-icon ' ,
201
- icon: ' question-circle ' ,
202
- label: ' Other ' ,
189
+ id: ' two ' ,
190
+ icon: ' send ' ,
191
+ label: ' Do thing two ' ,
203
192
onClick () {
204
- console .log (' Other ' );
193
+ console .log (' Thing two ' );
205
194
},
206
195
},
196
+ {
197
+ id: ' three' ,
198
+ as: ' a' ,
199
+ href: ' https://www.google.com' ,
200
+ target: ' _blank' ,
201
+ label: ' Open link' ,
202
+ icon: ' link' ,
203
+ },
207
204
];
208
205
209
206
const style = { display: ' inline-block' , margin: 10 };
210
207
211
208
< div>
212
209
< ActionSelect
213
210
actions= {actions}
214
- label= " Choose a source control "
211
+ label= " Choose an Action "
215
212
style= {style}
213
+ width= " 200px"
216
214
/ >
217
215
< / div> ;
218
216
```
219
217
220
- ### Custom Width
218
+ ## Action properties
221
219
222
- Use the ` width ` prop to customize the width of the button.
220
+ ### Disabled actions
221
+
222
+ Use the ` disabled ` object property to disable a row in a dropdown and prevent onClick actions from happening.
223
223
224
224
``` jsx
225
225
const actions = [
226
226
{
227
227
id: ' one' ,
228
228
icon: ' pencil' ,
229
229
label: ' Do thing one' ,
230
+ disabled: true ,
230
231
onClick () {
231
232
console .log (' Thing one' );
232
233
},
@@ -251,12 +252,53 @@ const actions = [
251
252
252
253
const style = { display: ' inline-block' , margin: 10 };
253
254
255
+ < div>
256
+ < ActionSelect actions= {actions} label= " Choose an Action" style= {style} / >
257
+ < / div> ;
258
+ ```
259
+
260
+ ### Icons
261
+
262
+ Specify the ` icon ` prop on each action to display a supported icon to the left of that option, or use the ` svg ` prop to use a custom icon.
263
+
264
+ ``` jsx
265
+ const customIcon = {
266
+ viewBox: ' 0 0 16 16' ,
267
+ svg: (
268
+ < path
269
+ fill= " #818f99"
270
+ fillRule= " evenodd"
271
+ d= " M8 .2A8 8 0 0 0 5.47 15.79c.4.074.546-.173.546-.385 0-.19-.007-.693-.01-1.36-2.226.483-2.695-1.073-2.695-1.073-.364-.924-.889-1.17-.889-1.17-.726-.496.055-.486.055-.486.803.056 1.226.824 1.226.824.713 1.222 1.872.87 2.328.665.073-.517.279-.87.508-1.07-1.777-.201-3.644-.888-3.644-3.953 0-.874.312-1.588.823-2.147-.082-.202-.357-1.016.078-2.117 0 0 .672-.215 2.2.82A7.662 7.662 0 0 1 8 4.068c.68.004 1.364.092 2.003.27 1.527-1.035 2.198-.82 2.198-.82.436 1.101.162 1.915.08 2.117.512.56.822 1.273.822 2.147 0 3.073-1.87 3.75-3.653 3.947.287.247.543.735.543 1.482 0 1.069-.01 1.932-.01 2.194 0 .214.144.463.55.385A8 8 0 0 0 8 .2"
272
+ / >
273
+ ),
274
+ };
275
+
276
+ const actions = [
277
+ {
278
+ id: ' custom-icon' ,
279
+ svg: customIcon .svg ,
280
+ label: ' GitHub' ,
281
+ onClick () {
282
+ console .log (' GitHub' );
283
+ },
284
+ },
285
+ {
286
+ id: ' standard-icon' ,
287
+ icon: ' question-circle' ,
288
+ label: ' Other' ,
289
+ onClick () {
290
+ console .log (' Other' );
291
+ },
292
+ },
293
+ ];
294
+
295
+ const style = { display: ' inline-block' , margin: 10 };
296
+
254
297
< div>
255
298
< ActionSelect
256
299
actions= {actions}
257
- label= " Choose an Action "
300
+ label= " Choose a source control "
258
301
style= {style}
259
- width= " 200px"
260
302
/ >
261
303
< / div> ;
262
304
```
0 commit comments