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

NameTypeDefaultDescription
elstringundefinedA string of the selector for the element to put the component in
optsobject{}A catch all for various options. See the opts table below for options specific to this component.

opts

NameTypeDefaultDescription
optionsobject[][]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