MacViews: Get c/b/ui/views/tabs to build on Mac
[chromium-blink-merge.git] / third_party / polymer / components-chromium / core-input / demo.html
blobc519f8ea6b057799f6114977214607eaeca227bc
1 <!doctype html>
2 <html>
3 <head>
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">
12 <style>
13 body {
14 padding: 24px;
15 margin: 0;
16 -webkit-transform: translateZ(0);
17 font-family: sans-serif;
18 font-size: 16px;
21 section {
22 margin: 2em 0;
25 aside {
26 background: #ccc;
27 padding: 1em;
28 margin-right: 2em;
29 font-size: 12px;
30 width: 250px;
31 border-radius: 3px;
34 core-input {
35 margin: 1em;
38 core-input[multiline] {
39 border: 1px dotted #ccc;
42 core-input.sized {
43 width: 500px;
44 height: 200px;
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;
57 </style>
59 </head>
60 <body>
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>
65 <script>
66 var single = document.getElementById('single');
67 single.addEventListener('change', function() {
68 console.log('single: value committed: ', single.value);
69 });
70 </script>
71 </section>
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>
76 <script>
77 var password = document.getElementById('password');
78 password.addEventListener('change', function() {
79 console.log('password: value committed: ', password.value);
80 });
81 </script>
82 </section>
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>
87 </section>
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>
92 </section>
94 <section horizontal start layout>
95 <aside>Inputs with the <code>tabindex</code> attribute.</aside>
96 <div>
97 <core-input tabindex="2" placeholder="tabindex = 2"></core-input>
98 <br>
99 <core-input tabindex="3" placeholder="tabindex = 3"></core-input>
100 <br>
101 <core-input tabindex="1" placeholder="tabindex = 1"></core-input>
102 </div>
103 </section>
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>
109 <br>
110 <core-input id="validate-email" type="email" placeholder="type = email"></core-input>
111 <br>
112 <core-input id="validate-required" required placeholder="required"></core-input>
113 <br>
114 <core-input id="validate-ml-required" multiline rows="3" required placeholder="required (multiline)"></core-input>
115 <br>
116 <core-input id="validate-pattern" pattern="a*bc" placeholder="with pattern = a*bc"></core-input>
117 <br>
118 <core-input id="validate-min-max" type="number" min="5" max="10" placeholder="type = number, min = 5, max = 10"></core-input>
119 <br>
120 <core-input id="validate-step" type="number" step="2" placeholder="type = number, step = 2"></core-input>
121 </div>
122 <script>
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);
129 </script>
130 </section>
133 </body>