diff --git a/src/styleguide/html/data-attribute/data-attribute.mdx b/src/styleguide/html/data-attribute/data-attribute.mdx new file mode 100644 index 00000000..f115735a --- /dev/null +++ b/src/styleguide/html/data-attribute/data-attribute.mdx @@ -0,0 +1,33 @@ +# Styleguide for data-attributes + +Data-attributes allow us to store extra information on standard, semantic HTML elements. The data attribute can also be used for styling. You can access them from CSS to add styles to the tag that have specific data-attribute. + +It's simpler and cleaner to write data attributes as data-name, where a name is a concrete name of a data attribute. + +You **should not** write unnecessary data-block='name' or data-container='name' because data-attribute has only one definition and doesn't change. + +Bad code example: + +```html +
+``` + +Good code example: + +```html + +``` + +If you have several values of component states that you need to pass to a data attribute, you can write it this way: + +```html +data-name="value" +``` + +For example: + +```html +