3 Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 Code distributed by Google as part of the polymer project is also
8 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
14 <meta name=
"viewport" content=
"width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
16 <title>paper-input
</title>
18 <script src=
"../webcomponentsjs/webcomponents.js"></script>
20 <link href=
"../font-roboto/roboto.html" rel=
"import">
21 <link href=
"paper-autogrow-textarea.html" rel=
"import">
22 <link href=
"paper-input-decorator.html" rel=
"import">
23 <link href=
"paper-input.html" rel=
"import">
25 <style shim-shadowdom
>
28 font-family: RobotoDraft, 'Helvetica Neue', Helvetica, Arial;
32 -webkit-tap-highlight-color: rgba(
0,
0,
0,
0);
33 -webkit-touch-callout: none;
49 paper-input-decorator {
57 .custom /deep/ ::-webkit-input-placeholder {
61 .custom /deep/ ::-moz-placeholder {
65 .custom /deep/ :-ms-input-placeholder {
69 .custom /deep/ .label-text,
70 .custom /deep/ .error {
74 .custom /deep/ .unfocused-underline {
75 background-color: #f4b400;
78 .custom[focused] /deep/ .floated-label .label-text {
82 .custom /deep/ .focused-underline {
83 background-color: #
0f9d58;
86 .custom.invalid /deep/ .floated-label .label-text,
87 .custom /deep/ .error {
91 .custom.invalid /deep/ .focused-underline {
92 background-color: #f06292;
106 <div>Standalone
</div>
110 <paper-input label=
"label"></paper-input>
114 <paper-input label=
"floating label" floatingLabel
></paper-input>
124 <paper-input-decorator label=
"with core-input">
125 <input is=
"core-input">
126 </paper-input-decorator>
130 <paper-input-decorator label=
"with core-input + floatingLabel" floatingLabel
>
131 <input is=
"core-input">
132 </paper-input-decorator>
136 <paper-input-decorator label=
"with autogrowing text area">
137 <paper-autogrow-textarea>
138 <textarea></textarea>
139 </paper-autogrow-textarea>
140 </paper-input-decorator>
144 <paper-input-decorator label=
"with autogrowing text area + floatingLabel" floatingLabel
>
145 <paper-autogrow-textarea>
146 <textarea></textarea>
147 </paper-autogrow-textarea>
148 </paper-input-decorator>
152 <section id=
"validate">
154 <div>Validation
</div>
156 <button onclick=
"validateAll()">click me to validate all
</button>
158 <paper-input-decorator label=
"required" floatingLabel
error=
"input is required!">
159 <input is=
"core-input" required
>
160 </paper-input-decorator>
163 function validateAll() {
164 var $d
= document
.getElementById('validate').querySelectorAll('paper-input-decorator');
165 Array
.prototype.forEach
.call($d
, function(d
) {
166 d
.isInvalid
= !d
.querySelector('input').validity
.valid
;
175 <div>Custom styling
</div>
179 <paper-input class=
"custom" label=
"paper-input"></paper-input>
183 <paper-input-decorator class=
"custom" label=
"decorator">
184 <input is=
"core-input">
185 </paper-input-decorator>