File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export let maxlength = undefined
11
11
export let autofocus = false
12
12
export let disabled = false
13
13
export let required = false
14
+ export let icon = ' '
14
15
15
16
const labelID = generateRandomID (' text-label-' )
16
17
@@ -28,12 +29,24 @@ const focus = (node) => autofocus && node.focus()
28
29
</script >
29
30
30
31
<style >
32
+ .material-icons {
33
+ color : rgb (133 , 140 , 148 );
34
+ position : relative ;
35
+ top : 0.4rem ;
36
+ right : 0.6rem ;
37
+ }
31
38
.required {
32
39
color : var (--mdc-required-input , var (--mdc-theme-status-error ));
33
40
font-size : small ;
34
41
margin-left : 1rem ;
35
42
margin-top : 0.2rem ;
36
43
}
44
+ .label-margin {
45
+ margin-left : 1.1rem ;
46
+ }
47
+ .mdc-text-field--label-floating .mdc-floating-label {
48
+ margin-left : 0 ;
49
+ }
37
50
</style >
38
51
39
52
<label
@@ -42,6 +55,7 @@ const focus = (node) => autofocus && node.focus()
42
55
class:mdc-text-field--disabled ={disabled }
43
56
bind:this ={element }
44
57
>
58
+ <i class ="material-icons" aria-hidden ="true" >{icon }</i >
45
59
<input
46
60
type =" text"
47
61
class =" mdc-text-field__input"
@@ -61,7 +75,7 @@ const focus = (node) => autofocus && node.focus()
61
75
<span class =" mdc-notched-outline__leading" />
62
76
{#if label }
63
77
<span class =" mdc-notched-outline__notch" >
64
- <span class ="mdc-floating-label" id ={labelID }>
78
+ <span class ="mdc-floating-label" class:label-margin ={ icon } id ={labelID }>
65
79
{label }
66
80
</span >
67
81
</span >
Original file line number Diff line number Diff line change @@ -34,3 +34,7 @@ let lastKey = ''
34
34
<Story name ="Autofocus" args ={copyAndModifyArgs (args , { autofocus: true })} />
35
35
36
36
<Story name ="Disabled" args ={copyAndModifyArgs (args , { disabled: true })} />
37
+
38
+ <Story name ="maxlength" args ={copyAndModifyArgs (args , { maxlength: 50 })} />
39
+
40
+ <Story name ="icon" args ={copyAndModifyArgs (args , { icon: ' home' })} />
You can’t perform that action at this time.
0 commit comments