OLD | NEW |
1 <!-- | 1 <!-- |
2 @license | 2 @license |
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.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/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
7 Code distributed by Google as part of the polymer project is also | 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/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
9 --><html><head><link rel="import" href="../polymer/polymer.html"> | 9 --><html><head><link rel="import" href="../polymer/polymer.html"> |
10 <link rel="import" href="../iron-menu-behavior/iron-menu-behavior.html"> | 10 <link rel="import" href="../iron-menu-behavior/iron-menu-behavior.html"> |
11 <link rel="import" href="../paper-styles/paper-styles.html"> | 11 <link rel="import" href="../paper-styles/paper-styles.html"> |
12 | 12 |
13 <!-- | 13 <!-- |
14 `<paper-menu>` implements an accessible menu control with Material Design stylin
g. The focused item | 14 `<paper-menu>` implements an accessible menu control with Material Design stylin
g. The focused item |
15 is highlighted, and the selected item has bolded text. | 15 is highlighted, and the selected item has bolded text. |
16 | 16 |
17 <paper-menu> | 17 <paper-menu> |
18 <paper-item>Item 1</paper-item> | 18 <paper-item>Item 1</paper-item> |
19 <paper-item>Item 2</paper-item> | 19 <paper-item>Item 2</paper-item> |
20 </paper-menu> | 20 </paper-menu> |
21 | 21 |
| 22 An initial selection can be specified with the `selected` attribute. |
| 23 |
| 24 <paper-menu selected="0"> |
| 25 <paper-item>Item 1</paper-item> |
| 26 <paper-item>Item 2</paper-item> |
| 27 </paper-menu> |
| 28 |
22 Make a multi-select menu with the `multi` attribute. Items in a multi-select men
u can be deselected, | 29 Make a multi-select menu with the `multi` attribute. Items in a multi-select men
u can be deselected, |
23 and multiple item can be selected. | 30 and multiple item can be selected. |
24 | 31 |
25 <paper-menu multi> | 32 <paper-menu multi> |
26 <paper-item>Item 1</paper-item> | 33 <paper-item>Item 1</paper-item> |
27 <paper-item>Item 2</paper-item> | 34 <paper-item>Item 2</paper-item> |
28 </paper-menu> | 35 </paper-menu> |
29 | 36 |
30 ### Styling | 37 ### Styling |
31 | 38 |
32 The following custom properties and mixins are available for styling: | 39 The following custom properties and mixins are available for styling: |
33 | 40 |
34 Custom property | Description | Default | 41 Custom property | Description | Default |
35 ----------------|-------------|---------- | 42 ----------------|-------------|---------- |
36 `--paper-menu-background-color` | Menu background color
| `--primary-background-color` | 43 `--paper-menu-background-color` | Menu background color
| `--primary-background-color` |
37 `-paper-menu-color` | Menu foreground color
| `--primary-text-color` | 44 `--paper-menu-color` | Menu foreground color
| `--primary-text-color` |
38 `--paper-menu-disabled-color` | Foreground color for a disabled item
| `--disabled-text-color` | 45 `--paper-menu-disabled-color` | Foreground color for a disabled item
| `--disabled-text-color` |
39 `--paper-menu` | Mixin applied to the menu
| `{}` | 46 `--paper-menu` | Mixin applied to the menu
| `{}` |
40 `--paper-menu-selected-item` | Mixin applied to the selected item
| `{}` | 47 `--paper-menu-selected-item` | Mixin applied to the selected item
| `{}` |
41 `--paper-menu-focused-item` | Mixin applied to the focused item
| `{}` | 48 `--paper-menu-focused-item` | Mixin applied to the focused item
| `{}` |
42 `--paper-menu-focused-item-after` | Mixin applied to the ::after pseudo-element
for the focused item | `{}` | 49 `--paper-menu-focused-item-after` | Mixin applied to the ::after pseudo-element
for the focused item | `{}` |
43 | 50 |
44 ### Accessibility | 51 ### Accessibility |
45 | 52 |
46 `<paper-menu>` has `role="menu"` by default. A multi-select menu will also have | 53 `<paper-menu>` has `role="menu"` by default. A multi-select menu will also have |
47 `aria-multiselectable` set. It implements key bindings to navigate through the m
enu with the up and | 54 `aria-multiselectable` set. It implements key bindings to navigate through the m
enu with the up and |
(...skipping 28 matching lines...) Expand all Loading... |
76 } | 83 } |
77 | 84 |
78 .content > ::content > [disabled] { | 85 .content > ::content > [disabled] { |
79 color: var(--paper-menu-disabled-color, --disabled-text-color); | 86 color: var(--paper-menu-disabled-color, --disabled-text-color); |
80 } | 87 } |
81 | 88 |
82 .content > ::content > *:focus { | 89 .content > ::content > *:focus { |
83 position: relative; | 90 position: relative; |
84 outline: 0; | 91 outline: 0; |
85 | 92 |
86 @apply(--paper-menu-colored-focused-item); | 93 @apply(--paper-menu-focused-item); |
87 } | 94 } |
88 | 95 |
89 .content > ::content > *:focus:after { | 96 .content > ::content > *:focus:after { |
90 @apply(--layout-fit); | 97 @apply(--layout-fit); |
91 background: currentColor; | 98 background: currentColor; |
92 /* FIXME move to paper-styles for next widget */ | 99 /* FIXME move to paper-styles for next widget */ |
93 opacity: 0.12; | 100 opacity: 0.12; |
94 content: ''; | 101 content: ''; |
95 | 102 |
96 @apply(--paper-menu-colored-focused-item-after); | 103 @apply(--paper-menu-focused-item-after); |
97 } | 104 } |
98 | 105 |
99 .content > ::content > *[colored]:focus:after { | 106 .content > ::content > *[colored]:focus:after { |
100 opacity: 0.26; | 107 opacity: 0.26; |
101 } | 108 } |
102 | 109 |
103 </style> | 110 </style> |
104 | 111 |
105 <template> | 112 <template> |
106 | 113 |
107 <div class="content"> | 114 <div class="content"> |
108 <content></content> | 115 <content></content> |
109 </div> | 116 </div> |
110 | 117 |
111 </template> | 118 </template> |
112 | 119 |
113 </dom-module> | 120 </dom-module> |
114 | 121 |
115 <script src="paper-menu-extracted.js"></script></body></html> | 122 <script src="paper-menu-extracted.js"></script></body></html> |
OLD | NEW |