The following button will have the attributes defined in the components section of the config
The following button will have the attributes defined in the components section of the config and the ones defined in the id section for the id "btn1". The attributes in the id section have priority.
The following button will have the attributes defined in the components section of the config and the ones defined in the id section for the id "btn2". The attributes in the id section have priority.
The following button will have the attributes defined in the components section of the config and the ones defined in the id section for the id "btn3" (see JS tab). The attributes in the id section have priority.
<p class="mt30"> The following button will have the attributes defined in the components section of the config </p> <ch5-button></ch5-button> <p class="mt30"> The following button will have the attributes defined in the components section of the config and the ones defined in the id section for the id "btn1". The attributes in the id section have priority. </p> <ch5-button id="btn1"></ch5-button> <p class="mt30"> The following button will have the attributes defined in the components section of the config and the ones defined in the id section for the id "btn2". The attributes in the id section have priority. </p> <ch5-button id="btn2"></ch5-button> <p class="mt30"> The following button will have the attributes defined in the components section of the config and the ones defined in the id section for the id "btn3" (see JS tab). The attributes in the id section have priority. </p> <ch5-button id="btn3"></ch5-button>
// The following JS code needs to interpreted before the one from the HTML tab CrComLib.Ch5Config.setAttributeForId('btn3','shape','tab'); CrComLib.Ch5Config.setAttributeForId('btn3','type','danger'); // to see the current configuration you can run CrComLib.Ch5Config.getConfig() in the browser console // uncomment the following code and press preview to load the configuration from an external file // NOTE: You might need to press preview multiple times since the config file might not finish loading before the component is ready // You can also run the following code in the browser console and then press Preview. /* (function(){ var requestURL='/component-configuration/conf-attributes-from-file.json'; var request = new XMLHttpRequest(); request.open('GET', requestURL); request.responseType = 'json'; request.send(); request.onload = function() { var confJson = request.response; console.log(confJson); CrComLib.Ch5Config.loadConfig(confJson); } })(); */
.mt30 { margin-top:30px; }