// 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
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
label
string
'ClickMe!'
The text to display in the button
preventPropogation
boolean
false
If set to true, evt.stopPropogation() will be called