File tree 3 files changed +6
-0
lines changed
3 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ export let disabled = false
17
17
export let selectedID = ' '
18
18
/** @type {boolean} makes a selection required and adds invalid class when none selected */
19
19
export let required = false
20
+ /** @type {boolean} applies the mdc-select--invalid class */
21
+ export let showError = false
20
22
21
23
const dispatch = createEventDispatcher ()
22
24
const labelID = generateRandomID (' select-label-' )
@@ -66,6 +68,7 @@ afterUpdate(() => {
66
68
<div
67
69
class ="mdc-select mdc-select--outlined {$$props .class || ' ' }"
68
70
class:mdc-select--required ={required }
71
+ class:mdc-select--invalid ={showError }
69
72
bind:this ={element }
70
73
style ="width: {width }"
71
74
>
Original file line number Diff line number Diff line change @@ -239,6 +239,7 @@ declare module '@silintl/ui-components' {
239
239
label ?: string
240
240
options ?: { name : string ; id : string } [ ]
241
241
required ?: boolean
242
+ showError ?: boolean
242
243
selectedID ?: string
243
244
width ?: string
244
245
class ?: string
Original file line number Diff line number Diff line change @@ -35,3 +35,5 @@ const args = {
35
35
<Story name ="Disabled" args ={copyAndModifyArgs (args , { disabled: true })} />
36
36
37
37
<Story name ="required" args ={copyAndModifyArgs (args , { required: true })} />
38
+
39
+ <Story name ="showError" args ={copyAndModifyArgs (args , { showError: true })} />
You can’t perform that action at this time.
0 commit comments