A Polymer Web Component for Miller columns (aka. Column View) with keyboard navigation.
Install the component using Bower:
bower install column-view --save- 
Import Web Components' polyfill:
<script src="bower_components/platform/platform.js"></script>
 - 
Import Custom Element:
<link rel="import" href="bower_components/column-view/dist/column-view.html">
 - 
Insert Custom Element
<column-view ondata="sourceFn"></column-view>
 - 
Set up your data source
Example:
<script type="text/javascript"> var data = { 0: {name: "root", childIDs: [1,2]}, // not vissible 1: {name: "Item 1", childIDs: [3,4,5]}, 2: {name: "Item 2"}, 3: {name: "Item 3"}, 4: {name: "Item 4"}, 5: {name: "Item 5"} }; function getChildren(selectedItem) { var children = selectedItem.childIDs.map(function(id) { var item = data[id]; return {name: item.name, value: id}; }); return children; } function sourceFn(ID, cb) { if (!ID) ID = 0; var selectedItem = data[ID]; if (selectedItem.childIDs) { cb({items: getChildren(selectedItem)}); } else { cb({dom: document.createTextNode("Preview: " + selectedItem.name)}) } } </script>
 
| Attribute | Options | Default | Description | 
|---|---|---|---|
ondata | 
Function(String value, Function callback) | None. | A function to be called for each selected item. This function can either pass child items or an HTML element to the callback function. Callback: callback({dom: <HTMLElement>}) callback({items: [{name: <String>, value: <String, Number>}, ...]}) | 
data | 
JSON | None. | *work in progress* {"fruits": {"apple": "<b>Apple</b>", "grape": "<b>Grape</b>"}} | 
path | 
String | "" | 
Defines the path of items the column-view is initialized with. When the element is ready the ondata method is called with each item ID. Each call results in a new column. IDs are speareated by /.Example: path="1/2/3" | 
| Method | Parameters | Returns | Description | 
|---|---|---|---|
back() | 
None. | Nothing. | Deselects last selected item | 
| Method | Returns | Description | 
|---|---|---|
canMoveBack | 
Boolean | ... | 
| Event | Description | 
|---|---|
change | 
Fires when selection changes. | 
With is="column-view-back" you can extend a button so that when you click it you move the selection one column to the left.
<button is="column-view-back" for="columnViewID">back</button>
<column-view id="columnViewID"></column-view>| Attribute | Options | Default | Description | 
|---|---|---|---|
for | 
ID | None. | The ID of a column-view | 
- Install dependencies: 
bower install 
- Start development server: 
polyserve
(npm install polyserve -g) - open http://localhost:8080/components/column-view/demo/demo.html
 
- Fork it!
 - Create your feature branch: 
git checkout -b my-new-feature - Commit your changes: 
git commit -m 'Add some feature' - Push to the branch: 
git push origin my-new-feature - Submit a pull request :D
 
