toolbox_label.js
export default class ToolboxLabel extends Blockly.ToolboxItem {
/**
* Constructor for a label in the toolbox.
...
/**
* Init method for the label.
* @override
*/
init() {
// Create the label.
this.label = document.createElement('label');
// Set the name.
this.label.textContent = this.toolboxItemDef_['name'];
// Set the color.
this.label.style.color = this.toolboxItemDef_['colour'];
// Any attributes that begin with css- will get added to a cssconfig.
const cssConfig = this.toolboxItemDef_['cssconfig'];
// Add the class.
if (cssConfig) {
this.label.classList.add(cssConfig['label']);
}
}
...