-
Notifications
You must be signed in to change notification settings - Fork 0
Anatomy of a Component
Justin Geeslin edited this page Aug 17, 2018
·
3 revisions
This is a basic component extending Component.
var Component = require('sensibleui/js/sensibleComponent.js');
MicroTip = function (opts) {
var self = this;
var defaults = {};
$.extend(this, defaults, opts);
$.extend(this, new Component(this));
return this;
}
module.exports = MicroTip;
sensible.registerComponent('label[microtip]', MicroTip);When you add an element matching the selector label[microtip], the constructor of MicroTip will run.
To interact with the Microtip element, you can use the el property. The el is a jQuery selection of the element that matched the selector your registered, label[microtip].
// Add ARIA roles of menu https://w3c.github.io/aria-practices/#menu
this.el.attr('role', 'menu');