0.0.9 • Published 6 years ago

mithril-selector v0.0.9

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

mithril-selector

Select component for Mithril.js with auto-completion. Inspired by selectize.js, which has more features but requires JQuery.

  • Suggest options as you type
  • Override CSS as you like
  • TypeScript support

Usage

const { Select } = require('mithril-selector')

const Content = {
  view: function (vnode) {
    return [
      m('div', `Current value: ${vnode.state.value}`),
      m('br'),
      m(Select, {
        value: vnode.state.value,
        placeholder: 'Select',
        options: [
          'Option One', 'Option Two', 'Option Three'
        ],
        onselect: (value) => vnode.state.value = value
      })
    ]
  }
}
<!-- CSS files are located in node_modules/mithril-selector/style/dist -->
<link rel="stylesheet" href="default.css">

See the example usage for a full working example.

Developing

git clone https://github.com/nicolaschan/mithril-selector.git
cd mithril-selector
yarn install --production=false
yarn build-example --watch
# Then open example/index.html in your browser
0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago