Skip to content
Focsd homeFocsd homeFocsd
Forms

Icon

An icon from the built-in set or your own library (Lucide, Font Awesome, custom), decorative or labeled.

  • Tag: focsd-icon
  • Pattern: Decorative / labeled img
  • Category: Utility

Example

HTML
<focsd-icon name="check"></focsd-icon>
<focsd-icon name="alert-triangle" label="Warning"></focsd-icon>
<focsd-icon name="search" label="Search"></focsd-icon>
<focsd-icon name="calendar"></focsd-icon>

Usage

Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.

<script type="module">
import '@focsd-dev/components/focsd-icon.js';
</script>
<focsd-icon name="check"></focsd-icon>

API

Attributes

AttributePropertyTypeDefault
namenamestring—
librarylibrarystring—
srcsrcstring—
labellabelstring—
mirrormirrorbooleanfalse

Slots

SlotDescription
(default)Your own icon, replacing the resolved one.

CSS parts

Style the inside of the component with ::part(), for example focsd-icon::part(svg).

PartDescription
svgThe rendered SVG.

Accessibility

  • Decorative (aria-hidden) by default; with label it becomes role="img" with that name.
  • Bring your own icons with registerIconLibrary, or slot your own SVG. See Icons.
  • mirror flips directional icons in right-to-left text.
  • Uses currentColor, so it follows the text color in every theme.