@editora/icons
Framework-agnostic icon registry + rendering package.
Installation
npm i @editora/icons
API Surface
| Surface | Type | Notes |
|---|---|---|
iconDefinitions, iconNameList | Data exports | Built-in icon metadata catalog |
getIcon, hasIcon, listIcons, listIconAliases, resolveIcon | Registry functions | Query and resolve icons/aliases |
registerIcon, registerIcons | Registry functions | Register custom icon definitions |
renderIconSvg, iconToDataUri | Render functions | SVG string and data-URI generation |
registerWithEditoraUI(registerFn) | Integration helper | Push icon set into UI-core registries |
IconAttrValue, IconDefinition, IconGlyph, IconNode, IconRenderOptions, IconTag, IconVariant, ResolvedIcon | Type exports | Icon typing for authoring and rendering |
Usage Example
import { renderIconSvg } from "@editora/icons";
const svg = renderIconSvg("check", {
variant: "outline",
size: 16,
color: "currentColor",
strokeWidth: 1.5,
});
Best Practices
- Use
currentColorfor theme-aware icon rendering. - Register custom icons once during app bootstrap.
- Keep icon names stable across versions.
Accessibility
Ensure icon-only controls include text alternatives via button labels or aria labels.
Performance Notes
Prefer static imports and avoid repeated runtime registration on frequent renders.