Icon
An icon from the built-in set or your own library (Lucide, Font Awesome, custom), decorative or labeled.
Example
<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>import { Icon } from '@focsd-dev/react';
export function Example() { return <Icon name="check"></Icon>;}<script setup>import '@focsd-dev/components/focsd-icon.js';</script>
<template> <focsd-icon name="check"></focsd-icon></template>// Add CUSTOM_ELEMENTS_SCHEMA to the component's schemas, then:import '@focsd-dev/components/focsd-icon.js';
// template<focsd-icon name="check"></focsd-icon><script> import '@focsd-dev/components/focsd-icon.js';</script>
<focsd-icon name="check"></focsd-icon>API
Attributes
| Attribute | Property | Type | Default |
|---|---|---|---|
name | name | string | — |
library | library | string | — |
src | src | string | — |
label | label | string | — |
mirror | mirror | boolean | false |
Slots
| Slot | Description |
|---|---|
(default) | Your own icon, replacing the resolved one. |
CSS parts
Style the inside of the component with ::part(), for example focsd-icon::part(svg).
| Part | Description |
|---|---|
svg | The rendered SVG. |
Accessibility
- Decorative (
aria-hidden) by default; withlabelit becomesrole="img"with that name. - Bring your own icons with
registerIconLibrary, or slot your own SVG. See Icons. mirrorflips directional icons in right-to-left text.- Uses
currentColor, so it follows the text color in every theme.
Ask the docs
Hi, what are you building?
Ask about any component, theming, forms or frameworks. I answer with the right component, a snippet and a link to its docs.