|
1 |
| -<!DOCTYPE html> |
| 1 | +<!doctype html> |
2 | 2 | <html lang="en">
|
3 | 3 | <head>
|
4 | 4 | <meta charset="UTF-8" />
|
5 | 5 | <meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
6 | 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
7 | 7 | <title>Select</title>
|
8 | 8 | <script type="module" src="./common.js"></script>
|
| 9 | + |
9 | 10 | <script type="module">
|
| 11 | + import '@vaadin/icon'; |
| 12 | + import '@vaadin/icons'; |
10 | 13 | import '@vaadin/select';
|
11 |
| - import '@vaadin/tooltip'; |
| 14 | + import '@vaadin/vaadin-lumo-styles/vaadin-iconset.js'; |
12 | 15 | </script>
|
13 | 16 | </head>
|
14 | 17 | <body>
|
15 |
| - <vaadin-select label="Size"> |
16 |
| - <vaadin-tooltip slot="tooltip" text="Stock availability may vary"></vaadin-tooltip> |
17 |
| - </vaadin-select> |
| 18 | + <section> |
| 19 | + <h2>Plain</h2> |
| 20 | + <vaadin-select value="s"></vaadin-select> |
| 21 | + <vaadin-select placeholder="Placeholder"></vaadin-select> |
| 22 | + </section> |
| 23 | + |
| 24 | + <section> |
| 25 | + <h2>Bells & Whistles</h2> |
| 26 | + <vaadin-select |
| 27 | + label="Label" |
| 28 | + helper-text="Description for this field." |
| 29 | + value="s" |
| 30 | + clear-button-visible |
| 31 | + error-message="You need to write something in this field." |
| 32 | + required |
| 33 | + > |
| 34 | + <vaadin-icon icon="vaadin:search" slot="prefix"></vaadin-icon> |
| 35 | + </vaadin-select> |
| 36 | + </section> |
| 37 | + |
| 38 | + <section> |
| 39 | + <h2>States</h2> |
| 40 | + <vaadin-select |
| 41 | + label="Read-only" |
| 42 | + helper-text="Description for this field." |
| 43 | + value="s" |
| 44 | + clear-button-visible |
| 45 | + error-message="You need to write something in this field." |
| 46 | + required |
| 47 | + readonly |
| 48 | + > |
| 49 | + <vaadin-icon icon="vaadin:search" slot="prefix"></vaadin-icon> |
| 50 | + </vaadin-select> |
| 51 | + |
| 52 | + <vaadin-select |
| 53 | + label="Disabled" |
| 54 | + helper-text="Description for this field." |
| 55 | + value="s" |
| 56 | + clear-button-visible |
| 57 | + error-message="You need to write something in this field." |
| 58 | + required |
| 59 | + disabled |
| 60 | + > |
| 61 | + <vaadin-icon icon="vaadin:search" slot="prefix"></vaadin-icon> |
| 62 | + </vaadin-select> |
| 63 | + </section> |
18 | 64 |
|
19 | 65 | <script>
|
20 |
| - const select = document.querySelector('vaadin-select'); |
21 |
| - select.items = items = [ |
22 |
| - { label: 'Show all', value: 'all' }, |
23 |
| - { component: 'hr' }, |
24 |
| - { label: 'XS (out of stock)', value: 'xs', disabled: true }, |
25 |
| - { label: 'S', value: 's' }, |
26 |
| - { label: 'M', value: 'm' }, |
27 |
| - { label: 'L', value: 'l' }, |
28 |
| - { label: 'XL', value: 'xl' }, |
29 |
| - ]; |
| 66 | + document.querySelectorAll('vaadin-select').forEach((select) => { |
| 67 | + select.items = items = [ |
| 68 | + { label: 'Show all', value: 'all' }, |
| 69 | + { component: 'hr' }, |
| 70 | + { label: 'XS (out of stock)', value: 'xs', disabled: true }, |
| 71 | + { label: 'S', value: 's' }, |
| 72 | + { label: 'M', value: 'm' }, |
| 73 | + { label: 'L', value: 'l' }, |
| 74 | + { label: 'XL', value: 'xl' }, |
| 75 | + ]; |
| 76 | + }); |
30 | 77 | </script>
|
31 | 78 | </body>
|
32 | 79 | </html>
|
0 commit comments