Commit 5411991d38601dfb44f3eac0eb89c1d9bbe4a1f4
Add example and description to readme
Charles Lehner committed on 8/28/2016, 5:38:06 AMParent: 36960964eac8bbce240322af4f665eac099aac2a
Files changed
README.md | changed |
README.md | ||
---|---|---|
@@ -1,8 +1,35 @@ | ||
1 | 1 … | # hypercombo |
2 | 2 … | |
3 | -combo-box made with hyperscript | |
3 … | +[combo box][]: a select menu that turns into a text input if you want to choose | |
4 … | +an option that is not in the list. | |
4 | 5 … | |
6 … | +[combo_box]: https://en.wikipedia.org/wiki/Combo_box | |
7 … | + | |
8 … | +## Example | |
9 … | + | |
10 … | +```js | |
11 … | +var combo = require('hypercombo') | |
12 … | +var h = require('hyperscript') | |
13 … | +var pull = require('pull-stream') | |
14 … | + | |
15 … | +var box = combo({ | |
16 … | + style: {width: '20ex'}, | |
17 … | + placeholder: 'things:', | |
18 … | + default: 'nice thing', | |
19 … | + onchange: function () { | |
20 … | + console.log('new value:', this.value) | |
21 … | + }, | |
22 … | + options: pull.values([ | |
23 … | + h('option', {value: 'a thing'}, 'A thing'), | |
24 … | + h('option', {value: 'nice thing'}, 'A nice thing'), | |
25 … | + h('option', {value: 'other thing'}, 'Another thing') | |
26 … | + ]) | |
27 … | +}) | |
28 … | + | |
29 … | +document.body.appendChild(box) | |
30 … | +``` | |
31 … | + | |
5 | 32 … | ## License |
6 | 33 … | |
7 | 34 … | Copyright (C) 2016 Charles Lehner |
8 | 35 … |
Built with git-ssb-web