Guides
How to use the icons in an app, on a page without a build step, or on the server. Every icon is in the browser, with its import ready to copy.
Which package
Three packages carry the same icons in three forms. Pick by where the icon is drawn.
@fluixi-icons/jsx@fluixi-icons/elements<flx-icon> from @fluixi-icons/elementsrenderIcon from @fluixi-icons/elements@fluixi-icons/iconsSprites from @fluixi-icons/iconsIn a JSX app
One component per icon. Your bundler compiles them with the app's own JSX, and only the icons you import ship. size sets the width and height and defaults to 1em; every other prop goes to the <svg>.
npm i @fluixi-icons/jsx
import { LuActivity } from '@fluixi-icons/jsx/lucide';
<button><LuActivity size={16} /> Activity</button>Custom elements, with a bundler
Standard HTML elements, so the same icons work in every framework on the page. Call defineIcons once at startup, in one module that lists the icons the app uses: elements already in the page draw when it runs, and later ones as they are inserted. Defining an icon twice does nothing.
npm i @fluixi-icons/elements
// icons.js, imported once by the app's entry
import { defineIcons } from '@fluixi-icons/elements';
import { LuActivity, LuHouse } from '@fluixi-icons/elements/lucide';
defineIcons(LuActivity, LuHouse);
<lu-house size="20" label="Home"></lu-house>An icon chosen at runtime
<flx-icon> draws any registered icon by name, so the name can come from a database, a CMS or a user setting. Register the icons your data may name, once at startup. An <flx-icon> whose icon is not registered yet stays empty and draws as soon as it is.
import { register } from '@fluixi-icons/elements';
import { LuActivity, LuHouse, LuSettings } from '@fluixi-icons/elements/lucide';
register(LuActivity, LuHouse, LuSettings);
<flx-icon name="lu-settings"></flx-icon>Server rendering
renderIcon returns the icon as HTML, SVG included, so it shows before any script runs. Call it wherever the server writes an icon: it returns a string and keeps no state. If the page also defines the element, it keeps that markup and renders again only when an attribute changes.
import { renderIcon } from '@fluixi-icons/elements';
import { LuHouse } from '@fluixi-icons/elements/lucide';
const html = `<a href="/">${renderIcon(LuHouse, { size: 20, label: 'Home' })} Home</a>`;Without a build step
Each route has a module script that defines all of its icons. It loads the whole route, about 900 KB for Lucide and up to 3 MB for a Material Symbols style: right for prototypes, docs and internal tools.
<script type="module" src="https://cdn.jsdelivr.net/npm/@fluixi-icons/elements/dist/lucide/cdn.js"></script> <lu-activity size="20"></lu-activity>
Raw SVG markup
Every icon is also a plain string of SVG markup, for innerHTML, canvas, emails and data: URLs. Icons use currentColor, so they take the surrounding text colour.
npm i @fluixi-icons/icons
import { LuActivity } from '@fluixi-icons/icons/lucide';
element.innerHTML = LuActivity;
image.src = `data:image/svg+xml,${encodeURIComponent(LuActivity)}`;The same icon many times
Each set ships a sprite sheet with one <symbol> per icon, named by the icon's kebab-case id. Serve it from your public folder: the paths exist once in the page, and each use only references them.
<svg width="16" height="16"><use href="/icons/lucide-sprite.svg#check" /></svg>
Element attributes
Every element takes these as attributes or as properties. The SVG renders in the light DOM and uses currentColor: style it with color and any CSS that targets svg.
sizeWidth and height. Default 1em, so the icon follows the font size.labelAccessible name. Without it the icon is decorative and hidden from assistive technology.name<flx-icon> only: the tag of a registered icon, lu-house for example.