SingleSelect
SingleSelect will render a dropdown with the given options
Example Usage
<div class='month-picker'></div>
// Pull in the library
const UI = require('jibe-juice');
// Instantiate a component, pass the selector of the container to insert component into and the opts
const month = new UI.SingleSelect('.month-picker', {
options: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
});
// Subscribe to fire this function whenever the selected option changes
month.subscribe((choice) => {
console.log('Its a new month!', choice);
});
// Render the DOM for the SingleSelect component
month.render();
params
Name | Type | Default | Description |
---|---|---|---|
el | string | undefined | A string of the selector for the element to put the component in |
opts | object | {} | A catch all for various options. See the opts table below for options specific to this component. |
opts
Name | Type | Default | Description |
---|---|---|---|
options | object[] | [] | An array of options objects. Each option must have a value and display property. value is what is sent to the server, and display is shown in the dropdown |
Updated less than a minute ago