|
| 1 | +[](https://www.npmjs.com/package/@polymer/paper-input) |
1 | 2 | [](https://travis-ci.org/PolymerElements/paper-input)
|
2 |
| -[](https://beta.webcomponents.org/element/PolymerElements/paper-input) |
| 3 | +[](https://webcomponents.org/element/@polymer/paper-input) |
3 | 4 |
|
4 | 5 | ## <paper-input>
|
| 6 | +`<paper-input>` is a single-line text field with Material Design styling. |
5 | 7 |
|
6 |
| -Material design: [Text fields](https://www.google.com/design/spec/components/text-fields.html) |
| 8 | +See: [Documentation](https://www.webcomponents.org/element/@polymer/paper-input), |
| 9 | + [Demo](https://www.webcomponents.org/element/@polymer/paper-input/demo/demo/index.html). |
7 | 10 |
|
8 |
| -`<paper-input>` is a single-line text field with Material Design styling. |
| 11 | +## Usage |
9 | 12 |
|
10 |
| -<!--- |
| 13 | +### Installation |
11 | 14 | ```
|
12 |
| -<custom-element-demo> |
13 |
| - <template> |
14 |
| - <script src="../webcomponentsjs/webcomponents-lite.js"></script> |
15 |
| - <link rel="import" href="paper-input.html"> |
16 |
| - <link rel="import" href="../iron-icons/iron-icons.html"> |
17 |
| - <style> |
18 |
| - paper-input { |
19 |
| - max-width: 400px; |
20 |
| - margin: auto; |
21 |
| - } |
22 |
| - iron-icon, div[suffix] { |
23 |
| - color: hsl(0, 0%, 50%); |
24 |
| - margin-right: 12px; |
25 |
| - } |
26 |
| - </style> |
27 |
| - <next-code-block></next-code-block> |
28 |
| - </template> |
29 |
| -</custom-element-demo> |
| 15 | +npm install --save @polymer/paper-input |
30 | 16 | ```
|
31 |
| ---> |
| 17 | + |
| 18 | +### In an html file |
32 | 19 | ```html
|
33 |
| -<paper-input always-float-label label="Floating label"></paper-input> |
34 |
| -<paper-input label="username"> |
35 |
| - <iron-icon icon="mail" slot="prefix"></iron-icon> |
36 |
| - <div slot="suffix">@email.com</div> |
37 |
| -</paper-input> |
| 20 | +<html> |
| 21 | + <head> |
| 22 | + <script type="module"> |
| 23 | + import '@polymer/paper-input/paper-input.js'; |
| 24 | + </script> |
| 25 | + </head> |
| 26 | + <body> |
| 27 | + <paper-input always-float-label label="Floating label"></paper-input> |
| 28 | + </body> |
| 29 | +</html> |
| 30 | +``` |
| 31 | +### In a Polymer 3 element |
| 32 | +```js |
| 33 | +import {PolymerElement, html} from '@polymer/polymer'; |
| 34 | +import '@polymer/paper-input/paper-input.js'; |
| 35 | + |
| 36 | +class SampleElement extends PolymerElement { |
| 37 | + static get template() { |
| 38 | + return html` |
| 39 | + <paper-input always-float-label label="Floating label"></paper-input> |
| 40 | + `; |
| 41 | + } |
| 42 | +} |
| 43 | +customElements.define('sample-element', SampleElement); |
38 | 44 | ```
|
39 | 45 |
|
40 |
| -### Changes in 2.0 |
41 |
| -- Distribution is now done with slots, so things have changed because of that (before: <label>foo</label>, now <label slot="label">foo</label>; same for input, prefix and suffix) |
42 |
| -- Since type extensions are not available, any use of `<input is="iron-input">` has been replaced by `<iron-input><input></iron-input>`. See [iron-input](https://github.com/PolymerElements/iron-input) for more details about that change |
43 |
| -- `prevent-invalid-input` and `allowed-pattern` had to be always used together; deleted `prevent-invalid-input`, so that only `allowed-pattern` is needed |
| 46 | +## Contributing |
| 47 | +If you want to send a PR to this element, here are |
| 48 | +the instructions for running the tests and demo locally: |
44 | 49 |
|
| 50 | +### Installation |
| 51 | +```sh |
| 52 | +git clone https://github.com/PolymerElements/paper-input |
| 53 | +cd paper-input |
| 54 | +npm install |
| 55 | +npm install -g polymer-cli |
| 56 | +``` |
| 57 | + |
| 58 | +### Running the demo locally |
| 59 | +```sh |
| 60 | +polymer serve --npm |
| 61 | +open http://127.0.0.1:<port>/demo/ |
| 62 | +``` |
| 63 | + |
| 64 | +### Running the tests |
| 65 | +```sh |
| 66 | +polymer test --npm |
| 67 | +``` |
0 commit comments