Select JS

Render an element that mimics a select box but is more full featured in design abilities, while maintaining the html simplicity of a basic select element.

import {Select} from 'uniform';
const select = new Select({
    name: 'account_type',
    options: [
        "Employee",
        "Manager",
        "General Manager"
    ]
})
document.append(select.el)
select.render()

Options

Option Type Description Default
options Array Options for selection. Each item in array can be string, array, or object
["Employee", "Manager", "General Manager"]
// - or -
[
  ["Employee", "employee", false],
  ["Manager", "manager", false],
  ["General Manager", "general_manager", true],
]
// - or -
[
  {value: "employee", text: 'Employee', selected: false},
  {value: "manager", text: 'Manager', selected: false},
  {value: "general_manager", text: 'General Manager', selected: true}
]
false
multiple Boolean Make the select a multiple select false
limit Integer, Boolean Limit number of visilbe options. Set to false to not limit. 8
class, name, id, value String Accepts any html attribute that is then rendered on the select element and rendered element.
el Element Optionally, can pass a select element to extract options and attributes from. In this case a select will not be generated