README.md
1
2<!---
3
4This README is automatically generated from the comments in these files:
5paper-listbox.html
6
7Edit those files, and our readme bot will duplicate them over here!
8Edit this file, and the bot will squash your changes :)
9
10The bot does some handling of markdown. Please file a bug if it does the wrong
11thing! https://github.com/PolymerLabs/tedium/issues
12
13-->
14
15[![Build status](https://travis-ci.org/PolymerElements/paper-listbox.svg?branch=master)](https://travis-ci.org/PolymerElements/paper-listbox)
16
17_[Demo and API docs](https://elements.polymer-project.org/elements/paper-listbox)_
18
19
20##<paper-listbox>
21
22Material design: [Menus](https://www.google.com/design/spec/components/menus.html)
23
24`<paper-listbox>` implements an accessible listbox control with Material Design styling. The focused item
25is highlighted, and the selected item has bolded text.
26
27```html
28<paper-listbox>
29 <paper-item>Item 1</paper-item>
30 <paper-item>Item 2</paper-item>
31</paper-listbox>
32```
33
34An initial selection can be specified with the `selected` attribute.
35
36```html
37<paper-listbox selected="0">
38 <paper-item>Item 1</paper-item>
39 <paper-item>Item 2</paper-item>
40</paper-listbox>
41```
42
43Make a multi-select listbox with the `multi` attribute. Items in a multi-select listbox can be deselected,
44and multiple item can be selected.
45
46```html
47<paper-listbox multi>
48 <paper-item>Item 1</paper-item>
49 <paper-item>Item 2</paper-item>
50</paper-listbox>
51```
52
53### Styling
54
55The following custom properties and mixins are available for styling:
56
57| Custom property | Description | Default |
58| --- | --- | --- |
59| `--paper-listbox-background-color` | Menu background color | `--primary-background-color` |
60| `--paper-listbox-color` | Menu foreground color | `--primary-text-color` |
61| `--paper-listbox` | Mixin applied to the listbox | `{}` |
62
63### Accessibility
64
65`<paper-listbox>` has `role="listbox"` by default. A multi-select listbox will also have
66`aria-multiselectable` set. It implements key bindings to navigate through the listbox with the up and
67down arrow keys, esc to exit the listbox, and enter to activate a listbox item. Typing the first letter
68of a listbox item will also focus it.
69
70
71