File tree Expand file tree Collapse file tree 2 files changed +78
-0
lines changed Expand file tree Collapse file tree 2 files changed +78
-0
lines changed Original file line number Diff line number Diff line change 61
61
}
62
62
}
63
63
64
+ /* *
65
+ * @summary Modifier for number input with increment and decrement buttons
66
+ *
67
+ * @selector .slds-input_counter
68
+ * @restrict .slds-input, input
69
+ * @modifier
70
+ */
71
+ & _counter {
72
+ text-align : center ;
73
+ padding : 0 $spacing-xx-large ;
74
+
75
+ & [type = ' number' ] {
76
+ appearance : textfield;
77
+ }
78
+
79
+ & ::-webkit-outer-spin-button ,
80
+ & ::-webkit-inner-spin-button {
81
+ appearance : none ;
82
+ margin : 0 ;
83
+ }
84
+ }
85
+
64
86
/* *
65
87
* Used to apply an input size to another element thats a non input
66
88
* Because sometimes I need elements the same height as inputs
287
309
color : $color-text-error ;
288
310
}
289
311
}
312
+
313
+ /* *
314
+ * @summary Positions decrement button within counter input field
315
+ *
316
+ * @selector .slds-input__button_decrement
317
+ * @restrict button
318
+ */
319
+ .slds-input__button_decrement {
320
+ position : absolute ;
321
+ bottom : 0.25rem ;
322
+ left : 0.75rem ;
323
+ }
324
+
325
+ /* *
326
+ * @summary Positions increment button within counter input field
327
+ *
328
+ * @selector .slds-input__button_increment
329
+ * @restrict button
330
+ */
331
+ .slds-input__button_increment {
332
+ position : absolute ;
333
+ bottom : 0.25rem ;
334
+ right : 0.75rem ;
335
+ }
Original file line number Diff line number Diff line change 3
3
4
4
import React from 'react' ;
5
5
import SvgIcon from '../../../shared/svg-icon' ;
6
+ import ButtonIcon from '../../button-icons/' ;
6
7
import classNames from 'classnames' ;
7
8
import { SpinnerContainer , Spinner } from '../../spinners/base/example' ;
8
9
@@ -369,5 +370,36 @@ export let examples = [
369
370
</ div >
370
371
</ div >
371
372
)
373
+ } ,
374
+ {
375
+ id : 'counter' ,
376
+ label : 'Counter' ,
377
+ element : (
378
+ < FormElement className = "slds-text-align_center" >
379
+ < ButtonIcon
380
+ className = "slds-button_icon-small slds-input__button_decrement"
381
+ symbol = "error"
382
+ assistiveText = { 'Decrement counter' }
383
+ title = { 'Decrement counter' }
384
+ />
385
+ < FormElementLabel id = "user-count-01" className = "slds-m-right_none" >
386
+ Input Label
387
+ </ FormElementLabel >
388
+ < FormElementControl >
389
+ < Input
390
+ className = "slds-input_counter"
391
+ id = "user-count-01"
392
+ type = "number"
393
+ placeholder = { 1 }
394
+ />
395
+ </ FormElementControl >
396
+ < ButtonIcon
397
+ className = "slds-button_icon-small slds-input__button_increment"
398
+ symbol = "new"
399
+ assistiveText = { 'Increment counter' }
400
+ title = { 'Increment counter' }
401
+ />
402
+ </ FormElement >
403
+ )
372
404
}
373
405
] ;
You can’t perform that action at this time.
0 commit comments