Skip to content

Icon

Renders an SVG graphic, either from a link or a set of built-in icons, that can represent an action, status, or decorative element. By default, it applies the fill-current class, allowing the icon to inherit the current text color.

Usage

Icons work best when paired with clear labels or context, and should not be the sole method of conveying information. They can be used as small interface symbols or full SVG illustrations, depending on the design needs.

API Reference

Component attubute(s)

x-h-icon

Attributes

AttributeTypeRequiredDescription
data-linkurlfalseURL to the svg icon.
roleimg
presentation
trueThe role of the icon. This is required as it affects the accessibility.
The presentation role excludes the icon from being visible to assistive technologies.
When using the img role, either aria-label or aria-labelledby attribute must also me provided. If not, assistive technologies will have trouble conveying to the user what the icon represents.

Modifiers

Harmonia includes several built-in icons. Instead of using the data-link attribute, you can apply the modifiers below to access them.

ModifierDescription
calendarCalendar icon
checkCalendar icon
chevron-downChevron down icon
chevron-leftChevron left icon
chevron-rightChevron right icon
chevrons-leftChevrons left icon
chevrons-rightChevrons right icon
clockClock icon
searchSearch icon
ellipsisEllipsis icon

Examples

SVG image


html
<svg x-h-icon data-link="/harmonia/logo/harmonia.svg" role="img" aria-label="Harmonia logo"></svg>

SVG icon


html
<svg x-h-icon class="size-8" data-link="/harmonia/logo/harmonia-symbolic.svg" role="presentation"></svg>

SVG icon with custom fill color


html
<svg x-h-icon class="size-8 fill-positive" data-link="/harmonia/logo/harmonia-symbolic.svg" role="presentation"></svg>
<svg x-h-icon class="size-8 fill-negative" data-link="/harmonia/logo/harmonia-symbolic.svg" role="presentation"></svg>
<svg x-h-icon class="size-8 fill-warning" data-link="/harmonia/logo/harmonia-symbolic.svg" role="presentation"></svg>
<svg x-h-icon class="size-8 fill-information" data-link="/harmonia/logo/harmonia-symbolic.svg" role="presentation"></svg>

Harmonia Icons


html
<svg x-h-icon.calendar role="img" aria-label="calendar"></svg>
<svg x-h-icon.check role="img" aria-label="check"></svg>
<svg x-h-icon.chevron-down role="img" aria-label="chevron down"></svg>
<svg x-h-icon.chevron-left role="img" aria-label="chevron left"></svg>
<svg x-h-icon.chevron-right role="img" aria-label="chevron right"></svg>
<svg x-h-icon.chevrons-left role="img" aria-label="chevrons left"></svg>
<svg x-h-icon.chevrons-right role="img" aria-label="chevrons right"></svg>
<svg x-h-icon.clock role="img" aria-label="clock"></svg>
<svg x-h-icon.search role="img" aria-label="search"></svg>
<svg x-h-icon.ellipsis role="img" aria-label="ellipsis"></svg>
<svg x-h-icon.minus role="img" aria-label="minus"></svg>
<svg x-h-icon.plus role="img" aria-label="plus"></svg>