<h2>Danger</h2><divclass="alert alert--danger"role="alert">Hello, this is a danger type alert message</div><divclass="alert alert--danger"role="alert"><divclass="alert__caption"><p><strong>Hello, this is a danger type alert message</strong></p><p>Nunc vitae dui in nunc mattis tincidunt. Nulla eleifend imperdiet odio eget semper.</p></div><buttonclass="alert__close"aria-label="Close alert"><svgaria-hidden="true"fill="none"focusable="false"height="24"stroke-linecap="round"stroke-linejoin="round"stroke-width="3.5"stroke="currentColor"viewBox="0 0 24 24"width="24"xmlns="http://www.w3.org/2000/svg"><linex1="18"y1="6"x2="6"y2="18"></line><linex1="6"y1="6"x2="18"y2="18"></line></svg></button></div><h2>Info</h2><divclass="alert alert--info"role="alert">Hello, this is an info type alert message</div><divclass="alert alert--info"role="alert"><divclass="alert__caption"><p><strong>Hello, this is an info type alert message</strong></p><p>Nunc vitae dui in nunc mattis tincidunt. Nulla eleifend imperdiet odio eget semper.</p></div><buttonclass="alert__close"aria-label="Close alert"><svgaria-hidden="true"fill="none"focusable="false"height="24"stroke-linecap="round"stroke-linejoin="round"stroke-width="3.5"stroke="currentColor"viewBox="0 0 24 24"width="24"xmlns="http://www.w3.org/2000/svg"><linex1="18"y1="6"x2="6"y2="18"></line><linex1="6"y1="6"x2="18"y2="18"></line></svg></button></div><h2>Success</h2><divclass="alert alert--success"role="alert">Hello, this is a success type alert message</div><divclass="alert alert--success"role="alert"><divclass="alert__caption"><p><strong>Hello, this is a success type alert message</strong></p><p>Nunc vitae dui in nunc mattis tincidunt. Nulla eleifend imperdiet odio eget semper.</p></div><buttonclass="alert__close"aria-label="Close alert"><svgaria-hidden="true"fill="none"focusable="false"height="24"stroke-linecap="round"stroke-linejoin="round"stroke-width="3.5"stroke="currentColor"viewBox="0 0 24 24"width="24"xmlns="http://www.w3.org/2000/svg"><linex1="18"y1="6"x2="6"y2="18"></line><linex1="6"y1="6"x2="18"y2="18"></line></svg></button></div><h2>Warning</h2><divclass="alert alert--warning"role="alert">Hello, this is a warning type alert message</div><divclass="alert alert--warning"role="alert"><divclass="alert__caption"><p><strong>Hello, this is a warning type alert message</strong></p><p>Nunc vitae dui in nunc mattis tincidunt. Nulla eleifend imperdiet odio eget semper.</p></div><buttonclass="alert__close"aria-label="Close alert"><svgaria-hidden="true"fill="none"focusable="false"height="24"stroke-linecap="round"stroke-linejoin="round"stroke-width="3.5"stroke="currentColor"viewBox="0 0 24 24"width="24"xmlns="http://www.w3.org/2000/svg"><linex1="18"y1="6"x2="6"y2="18"></line><linex1="6"y1="6"x2="18"y2="18"></line></svg></button></div>
Alert
On this page
A generic alert component with different type variation and close option.'
Variations
--danger: by default, it gets red accents.
--info: by default, it gets blue accents.
--success: by default, it gets green accents.
--warning: by default, it gets yellow accents.
Technical Details
You should use the ARIA alert role on your alert elements to convey more meaning.
If you need a closing functionality for the UI, you can use the .alert__close element, but you need to implement the closing functionality yourself.
Documentation
Learn about Spruce CSS through our extensive documentation.