Example Usage

<div class="button-container"></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 btn = new UI.Button('.button-container', {
  label: 'Search',
  submit: true
});

// Subscribe to fire this function whenever button calls publish
btn.subscribe(function () {
  console.log('clicked!');
});

// Render the DOM for the button
btn.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
labelstring'ClickMe!'The text to display in the button
preventPropogationbooleanfalseIf set to true, evt.stopPropogation() will be called
submitbooleanfalseIf true the button will be of type submit