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 --> | 9 --> |
10 | 10 |
11 <link rel="import" href="../polymer/polymer.html"> | 11 <link rel="import" href="../polymer/polymer.html"> |
12 <link rel="import" href="../iron-menu-behavior/iron-menu-behavior.html"> | 12 <link rel="import" href="../iron-menu-behavior/iron-menu-behavior.html"> |
13 <link rel="import" href="../paper-styles/paper-styles.html"> | 13 <link rel="import" href="../paper-styles/paper-styles.html"> |
14 | 14 |
15 <!-- | 15 <!-- |
16 `<paper-menu>` implements an accessible menu control with Material Design stylin
g. The focused item | 16 `<paper-menu>` implements an accessible menu control with Material Design stylin
g. The focused item |
17 is highlighted, and the selected item has bolded text. | 17 is highlighted, and the selected item has bolded text. |
18 | 18 |
19 <paper-menu> | 19 <paper-menu> |
20 <paper-item>Item 1</paper-item> | 20 <paper-item>Item 1</paper-item> |
21 <paper-item>Item 2</paper-item> | 21 <paper-item>Item 2</paper-item> |
22 </paper-menu> | 22 </paper-menu> |
23 | 23 |
| 24 An initial selection can be specified with the `selected` attribute. |
| 25 |
| 26 <paper-menu selected="0"> |
| 27 <paper-item>Item 1</paper-item> |
| 28 <paper-item>Item 2</paper-item> |
| 29 </paper-menu> |
| 30 |
24 Make a multi-select menu with the `multi` attribute. Items in a multi-select men
u can be deselected, | 31 Make a multi-select menu with the `multi` attribute. Items in a multi-select men
u can be deselected, |
25 and multiple item can be selected. | 32 and multiple item can be selected. |
26 | 33 |
27 <paper-menu multi> | 34 <paper-menu multi> |
28 <paper-item>Item 1</paper-item> | 35 <paper-item>Item 1</paper-item> |
29 <paper-item>Item 2</paper-item> | 36 <paper-item>Item 2</paper-item> |
30 </paper-menu> | 37 </paper-menu> |
31 | 38 |
32 ### Styling | 39 ### Styling |
33 | 40 |
34 The following custom properties and mixins are available for styling: | 41 The following custom properties and mixins are available for styling: |
35 | 42 |
36 Custom property | Description | Default | 43 Custom property | Description | Default |
37 ----------------|-------------|---------- | 44 ----------------|-------------|---------- |
38 `--paper-menu-background-color` | Menu background color
| `--primary-background-color` | 45 `--paper-menu-background-color` | Menu background color
| `--primary-background-color` |
39 `-paper-menu-color` | Menu foreground color
| `--primary-text-color` | 46 `--paper-menu-color` | Menu foreground color
| `--primary-text-color` |
40 `--paper-menu-disabled-color` | Foreground color for a disabled item
| `--disabled-text-color` | 47 `--paper-menu-disabled-color` | Foreground color for a disabled item
| `--disabled-text-color` |
41 `--paper-menu` | Mixin applied to the menu
| `{}` | 48 `--paper-menu` | Mixin applied to the menu
| `{}` |
42 `--paper-menu-selected-item` | Mixin applied to the selected item
| `{}` | 49 `--paper-menu-selected-item` | Mixin applied to the selected item
| `{}` |
43 `--paper-menu-focused-item` | Mixin applied to the focused item
| `{}` | 50 `--paper-menu-focused-item` | Mixin applied to the focused item
| `{}` |
44 `--paper-menu-focused-item-after` | Mixin applied to the ::after pseudo-element
for the focused item | `{}` | 51 `--paper-menu-focused-item-after` | Mixin applied to the ::after pseudo-element
for the focused item | `{}` |
45 | 52 |
46 ### Accessibility | 53 ### Accessibility |
47 | 54 |
48 `<paper-menu>` has `role="menu"` by default. A multi-select menu will also have | 55 `<paper-menu>` has `role="menu"` by default. A multi-select menu will also have |
49 `aria-multiselectable` set. It implements key bindings to navigate through the m
enu with the up and | 56 `aria-multiselectable` set. It implements key bindings to navigate through the m
enu with the up and |
(...skipping 28 matching lines...) Expand all Loading... |
78 } | 85 } |
79 | 86 |
80 .content > ::content > [disabled] { | 87 .content > ::content > [disabled] { |
81 color: var(--paper-menu-disabled-color, --disabled-text-color); | 88 color: var(--paper-menu-disabled-color, --disabled-text-color); |
82 } | 89 } |
83 | 90 |
84 .content > ::content > *:focus { | 91 .content > ::content > *:focus { |
85 position: relative; | 92 position: relative; |
86 outline: 0; | 93 outline: 0; |
87 | 94 |
88 @apply(--paper-menu-colored-focused-item); | 95 @apply(--paper-menu-focused-item); |
89 } | 96 } |
90 | 97 |
91 .content > ::content > *:focus:after { | 98 .content > ::content > *:focus:after { |
92 @apply(--layout-fit); | 99 @apply(--layout-fit); |
93 background: currentColor; | 100 background: currentColor; |
94 /* FIXME move to paper-styles for next widget */ | 101 /* FIXME move to paper-styles for next widget */ |
95 opacity: 0.12; | 102 opacity: 0.12; |
96 content: ''; | 103 content: ''; |
97 | 104 |
98 @apply(--paper-menu-colored-focused-item-after); | 105 @apply(--paper-menu-focused-item-after); |
99 } | 106 } |
100 | 107 |
101 .content > ::content > *[colored]:focus:after { | 108 .content > ::content > *[colored]:focus:after { |
102 opacity: 0.26; | 109 opacity: 0.26; |
103 } | 110 } |
104 | 111 |
105 </style> | 112 </style> |
106 | 113 |
107 <template> | 114 <template> |
108 | 115 |
(...skipping 15 matching lines...) Expand all Loading... |
124 | 131 |
125 behaviors: [ | 132 behaviors: [ |
126 Polymer.IronMenuBehavior | 133 Polymer.IronMenuBehavior |
127 ] | 134 ] |
128 | 135 |
129 }); | 136 }); |
130 | 137 |
131 })(); | 138 })(); |
132 | 139 |
133 </script> | 140 </script> |
OLD | NEW |