4 <meta name=
"viewport" content=
"width=device-width, initial-scale=1, user-scalable=no">
6 <title>core-input
</title>
8 <script src=
"../platform/platform.js"></script>
10 <link href=
"core-input.html" rel=
"import">
16 -webkit-transform: translateZ(
0);
17 font-family: sans-serif;
38 core-input[multiline] {
39 border:
1px dotted #ccc;
47 .validation core-input,
48 .validation core-input[multiline] {
49 border: solid
1px lime;
52 .validation core-input.invalid,
53 .validation core-input[multiline].invalid {
54 border: solid
1px red;
62 <section horizontal start layout
>
63 <aside>A single-line text input. See console for committed values.
</aside>
64 <core-input id=
"single" placeholder=
"Type something..."></core-input>
66 var single
= document
.getElementById('single');
67 single
.addEventListener('change', function() {
68 console
.log('single: value committed: ', single
.value
);
73 <section horizontal start layout
>
74 <aside>The
<code>type
</code> attribute is supported. This is a single-line input with
<code>type = password
</code>. See console for committed values.
</aside>
75 <core-input id=
"password" type=
"password" placeholder=
"Enter password..."></core-input>
77 var password
= document
.getElementById('password');
78 password
.addEventListener('change', function() {
79 console
.log('password: value committed: ', password
.value
);
84 <section horizontal start layout
>
85 <aside>A multi-line text input with
3 rows. The input is normally unstyled but here is styled with a dotted border to show its size.
</aside>
86 <core-input multiline
rows=
"3" placeholder=
"Type many lines here..."></core-input>
89 <section horizontal start layout
>
90 <aside>A multi-line text input sized with CSS. The input is normally unstyled but here is styled with a dotted border to show its size.
</aside>
91 <core-input class=
"sized" multiline
rows=
"fit" placeholder=
"This input is 500px * 200px"></core-input>
94 <section horizontal start layout
>
95 <aside>Inputs with the
<code>tabindex
</code> attribute.
</aside>
97 <core-input tabindex=
"2" placeholder=
"tabindex = 2"></core-input>
99 <core-input tabindex=
"3" placeholder=
"tabindex = 3"></core-input>
101 <core-input tabindex=
"1" placeholder=
"tabindex = 1"></core-input>
105 <section horizontal start layout
>
106 <aside>Validation examples. The border color reflects the current validation state. See console for validation events.
</aside>
107 <div class=
"validation">
108 <core-input id=
"validate-number" type=
"number" placeholder=
"type = number"></core-input>
110 <core-input id=
"validate-email" type=
"email" placeholder=
"type = email"></core-input>
112 <core-input id=
"validate-required" required
placeholder=
"required"></core-input>
114 <core-input id=
"validate-ml-required" multiline
rows=
"3" required
placeholder=
"required (multiline)"></core-input>
116 <core-input id=
"validate-pattern" pattern=
"a*bc" placeholder=
"with pattern = a*bc"></core-input>
118 <core-input id=
"validate-min-max" type=
"number" min=
"5" max=
"10" placeholder=
"type = number, min = 5, max = 10"></core-input>
120 <core-input id=
"validate-step" type=
"number" step=
"2" placeholder=
"type = number, step = 2"></core-input>
123 document
.querySelector('.validation').addEventListener('input-invalid', function(e
, value
, s
) {
124 console
.log(e
.target
.id
, 'invalid, inputValue:', e
.detail
.value
, e
.target
.validity
);
126 document
.querySelector('.validation').addEventListener('input-valid', function(e
, value
, s
) {
127 console
.log(e
.target
.id
, 'valid, inputValue:', e
.detail
.value
, e
.target
.validity
);