CoreUI Data Attributes
As options can be passed via data attributes or JavaScript, you can append an option name to data-coreui-
, as in data-coreui-animation="{value}"
.
Make sure to change the case type of the option name from camelCase to kebab-case when passing the options via data attributes.
For example, use data-coreui-custom-class="beautifier"
instead of data-coreui-customClass="beautifier"
.
As of CoreUI 4.2.6, all components support an experimental reserved data attribute data-coreui-config
that can house simple component configuration as a JSON string.
When an element has
data-coreui-config='{"delay":0, "title":123}'
anddata-coreui-title="456"
attributes, the finaltitle
value will be456
and the separate data attributes will override values given ondata-coreui-config
.
— CoreUI Documentation
In addition, existing data attributes are able to house JSON values like data-coreui-delay='{"show":0,"hide":150}'
.
Additional Information Using JSON in your data attributes can simplify your configurations and reduce the number of HTML attributes needed for complex settings.