Creates a stateful button.
initialState and states (required), mount, unmount, dataElement, title.
Replaces the inline CSS styles of the item and updates it on screen when it is already in the UI.
CSS property names (camelCase) mapped to their values.
OptionalclassExtra CSS class names added to the item's element.
Unique name of the item; used to find, show, hide or update it later.
OptionaldisabledWhether the item is disabled (rendered but not clickable).
OptionalhiddenHides the item: true always hides it; an array of screen sizes ('desktop', 'tablet', 'mobile', 'small-mobile')
hides it only on those screen sizes.
Name of the state the button starts in.
OptionalmountCalled when the button is added to the UI with update(stateName), which switches the state (without an argument it refreshes the content).
The states of the button, keyed by state name. Each state may define img, title, getContent(state) and onClick(update, state).
OptionalstyleInline CSS styles applied to the item's element.
OptionaltitleTooltip text, or a translation key that is resolved in the current language.
OptionaltypeItem type (for example 'customButton', 'toolButton', 'divider'); set by each subclass.
OptionalunmountCalled when the button is removed from the UI.
A button that cycles through named states; each state has its own icon, title and click handler.
Example