--- layout: default title: Controls slug: javascript lead: "Over a dozen reusable controls built to provide data repeaters, datepickers, pillboxes, trees, wizards, and much more." ---
Some controls depend on other controls. If you include a control individually, make sure to check for dependencies in the documentation below. A console error should be thrown if dependencies are not met. All plugins depend on jQuery and Bootstrap and these must be loaded before any Fuel UX files).
Consult our bower.json to see which versions of jQuery and Bootstrap are currently tested and supported.
You can initialize Fuel UX controls that do not require a data source on page load purely through markup without writing a single line of JavaScript. Controls that can to be auto-initialized are checkbox, combobox, datepicker, loader, pillbox, placard, radio, scheduler, search, selectlist, and wizard. These controls can contain the data-initialize attribute. Attribute initialization is used in this section's examples when available.
Like Bootstrap, these controls can be 'lazily' initialized when the user interacts with them (such as on mouseover. Be careful of changed events when initializing. To disable this data-api, use $.off('fu.data-api'). The Fuel UX team recommends the precision and greater number of options provided by initializing manually via JavaScript.
You can also initialize a component at any time via JavaScript. Most controls accept an optional options object, a string which targets a particular method, or nothing (which initiates a plugin with default behavior):
{% highlight js %} // initialized with defaults $('#myWizard').wizard() // initialized with selectedItem $('#myWizard').wizard('selectedItem', { step: 3 });) {% endhighlight %}Unlike some heavier UI control libraries, Fuel UX controls cannot be re-initialized. If a control is already initialized, passing in an options/default object will only change the defaults--which means nothing will happen. Many controls have methods that allow certain internal variables to be changed, but if the variable you would like to change is not available via a method mentioned in the tables below, then you should use the control's destroy method and initialize new markup with the respective options object via Javascript.
Fuel UX provides custom events for most components' actions. All events are namespaced with 'fu' and their control name (ex. 'changed.fu.checkbox' ). All Fuel UX events are past tense, so not to trigger standard events (ex. changed vs. change). Although it is not tested, nor recommended, this allows you listen for standard events and Bootstrap supported events on any internal element that you choose.
Components can be included individually (using Fuel UX's individual *.js files), or all at once (using fuelux.js or the minified fuelux.min.js). Do not include both files on your page.
ARIA support has been added when appropriate, and all inputs have labels even if they are "screen reader only." All controls are keyboard friendly and can be navigated by tabbing to display a keyboard-focus. We hope this not only aids in accessibility, but also increases the user's productivity. Controls have been "fat-finger" tested on touch devices. If you have accessibility issues with Fuel UX controls, please create an issue on GitHub.