@imadkurdi/info-icon
v1.0.0
Published
This is an info-icon component. A standard custom web component written in pure vanilla JS, so it could be used in any framework.
Maintainers
Readme
info-icon component
![]()
This is an info-icon component. A standard custom web component written in pure vanilla JS, so it could be used in any framework.
With the package you will find a complete functional example (example.html)
Usage:
Use it like any standard tag:
- In html:
<info-icon color="blue" bg-color="blue"></info-icon> - In JS:
document.createElement("info-icon")
Attributes:
bg-color: ex<info-icon bg-color="blue"></info-icon>, this attribute determines thecolorof aninsetbox-shadow:box-shadow: bg-color 0 0 0.5em inset;.color: ex<info-icon color="blue"></info-icon>, this attribute determines thecolorof an letterishown inside the element.
Properties:
bgColor: exelem.bgColor = "red", this is the property that is associated with the attributebg-color.color: exelem.color = "green", this is the property that is associated with the attributecolor.
Styling:
Use the attributes
bg-colorandcolor:<p><info-icon color="blue" bg-color="blue"></info-icon> This "info-icon" is styled using bg-color and color attributes.</p>Or use the properties
bgColorandcolorin JavaScript:const elem = document.querySelector("info-icon"); elem.bgColor = "#777"; elem.color = "blueviolet";Or use the defined
parton the component: the component is just a standard<span part="container">i</span>:info-icon::part(container) { background-color: aquamarine; color: brown; border: none; }
