Mithril Custom Select Component
A custom select widget component for Mithril.js. Built to mimic native browser select behaviour (if not looks) as closely as possible, including acessibility and keyboard features. The minimal CSS included can be easily overridden and customized by your own styles.
Try a live demo here.
Install:
npm install mithril-select
(TypeScript types are included.)
You will need to include the css file for some basic working styles.
Using PostCSS with postcss-import allows you to import the stylesheet from node_modules
:
;
If you're using a sass compiler, you can add:
;
to one of your sass files.
Otherwise you can copy the node_modules/mithril-select/index.css
file to your project and add it to your html page.
See the example
in the git repository for examples of style customization.
Example use:
// var mithrilSelect = require("mithril-select").default // Data to be used in select
All options and component Attrs:
(See src/index.ts
)
/** Represents a single option in a select */ /** Attrs object for Select component */
Development Install:
First git clone this repo. Then:
npm install
Build module
npm run build
Serve, compile & watch example app:
npm start
Then go to http://localhost:3000/ in your browser.
Build a plain ES2015 version of the library:
npm run build-es2015
Will output src/index.js
Thanks to barneycarroll for providing an initial POC demo using global focus/blur listeners.