A modern native Web Components icon library built with Stencil, containing 285+ meticulously designed SVG icons. Framework-agnostic, works in JS/Vue/React/Angular projects.
- 285+ Icons: Rich icon set covering common UI scenarios
- Web Component: Native Custom Elements, supports all modern frameworks
- High Performance: Optimized by Stencil compiler
- Easy to Use: Simple HTML tags for usage
- Customizable: Supports CSS custom properties and style overrides
- Multiple Format Support: ESM, CommonJS, and UMD
- TypeScript Support: Complete type definitions
- Responsive: Adapts to various screen sizes
- Dual-tone Support: Supports both filled and outline styles
npm install @zanejs/iconspnpm add @zanejs/iconsyarn add @zanejs/iconsUse directly in HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://unpkg.com/@zanejs/icons@1.0.1/dist/zane-icons/zane-icons.esm.js"></script>
<title>Zane Icons Demo</title>
</head>
<body></body>
<!-- Use search icon -->
<zane-icon-search style="font-size: 32px; color: #333;"></zane-icon-search>
<!-- Use user icon -->
<zane-icon-user style="font-size: 24px; color: #666;"></zane-icon-user>
<!-- Use close icon -->
<zane-icon-close-bold style="font-size: 20px; color: #999;"></zane-icon-close-bold>
</body>
</html>import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
+ import { defineCustomElements } from '@zanejs/ui/loader';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
+ defineCustomElements();
import React from 'react';
function MyComponent() {
return (
<div>
<zane-icon-search style={{ fontSize: '32px', color: '#333' }} />
<zane-icon-user style={{ fontSize: '24px', color: '#666' }} />
</div>
);
}// src/main.ts
import { createApp } from 'vue'
import App from './App.vue';
+ import { defineCustomElements } from '@zanejs/icons/loader';
+ defineCustomElements();
createApp(App).mount('#app')Modify vite.config.js for Vue compilation compatibility with custom elements:
import { defineConfig } from 'vite';
export default defineConfig({
vue: {
template: {
compilerOptions: {
+ isCustomElement: tag => tag.startsWith('zane-')
},
},
},
});zane-icon-arrow-up/zane-icon-arrow-up-boldzane-icon-arrow-down/zane-icon-arrow-down-boldzane-icon-arrow-left/zane-icon-arrow-left-boldzane-icon-arrow-right/zane-icon-arrow-right-boldzane-icon-d-arrow-leftzane-icon-backzane-icon-topzane-icon-bottom-leftzane-icon-bottom-rightzane-icon-caret-rightzane-icon-foldzane-icon-expandzane-icon-pointer
zane-icon-searchzane-icon-pluszane-icon-checkzane-icon-close-boldzane-icon-editzane-icon-deletezane-icon-downloadzane-icon-upload-filledzane-icon-sharezane-icon-linkzane-icon-scissorzane-icon-copy
zane-icon-success-filledzane-icon-warning/zane-icon-warning-filledzane-icon-info-filledzane-icon-circle-check/zane-icon-circle-check-filledzane-icon-remove-filledzane-icon-checkedzane-icon-failed
zane-icon-bell/zane-icon-bell-filledzane-icon-mute-notification
zane-icon-user/zane-icon-user-filledzane-icon-avatarzane-icon-key
zane-icon-location-filledzane-icon-map-locationzane-icon-positionzane-icon-placezane-icon-add-location
zane-icon-video-camera-filledzane-icon-video-pausezane-icon-microphonezane-icon-headsetzane-icon-stopwatchzane-icon-watchzane-icon-alarm-clock
zane-icon-shopping-bagzane-icon-walletzane-icon-price-tagzane-icon-discountzane-icon-postcardzane-icon-document/zane-icon-document-addzane-icon-briefcasezane-icon-platform
zane-icon-toolszane-icon-settingzane-icon-managementzane-icon-connectionzane-icon-cpuzane-icon-switch-button
zane-icon-pie-chartzane-icon-trend-chartszane-icon-histogramzane-icon-data-board
zane-icon-soccerzane-icon-baseballzane-icon-basketball
zane-icon-coffeezane-icon-mugzane-icon-cold-drinkzane-icon-ice-drinkzane-icon-ice-teazane-icon-takeaway-boxzane-icon-bowlzane-icon-fork-spoonzane-icon-knife-forkzane-icon-grapezane-icon-dessertzane-icon-ice-cream-squarezane-icon-applezane-icon-sugar
zane-icon-bicyclezane-icon-ship
zane-icon-housezane-icon-home-filledzane-icon-schoolzane-icon-first-aid-kit
zane-icon-magnetzane-icon-lightning
zane-icon-trophyzane-icon-gold-medal
zane-icon-sunrisezane-icon-partly-cloudyzane-icon-umbrella
zane-icon-smokingzane-icon-no-smoking
zane-icon-star-filledzane-icon-flagzane-icon-opportunityzane-icon-presentzane-icon-listzane-icon-gridzane-icon-brush/zane-icon-brush-filledzane-icon-picture-roundedzane-icon-calendarzane-icon-camera-filled
π‘ Tip: Complete icon list can be found in the
dist/zane-icon.mdfile after runningnpm run build
/* Global setting */
zane-icon-search {
font-size: 32px; /* Default 16px */
}
/* Individual setting */
.icon-large {
font-size: 48px;
}/* Using currentColor */
zane-icon-user {
color: #333;
}
/* Inheriting parent element color */
.parent-element {
color: #007acc;
}
.parent-element zane-icon-search {
/* Inherits #007acc */
}
/* Using CSS custom properties */
zane-icon-star-filled {
--icon-color: gold;
color: var(--icon-color);
}<zane-icon-search
style="font-size: 32px; color: #333;"
fill="currentColor"
stroke="none"
aria-label="Search icon"
role="img"
/>- Node.js >= 16
- pnpm (recommended) or npm
pnpm install# Start development server (with watch mode)
pnpm run start
# Run tests
pnpm run test# Build production version
pnpm run build
# Or use stub command
pnpm run stubIcon components are automatically generated from SVG files:
- Place SVG files in the
svg/directory - Run
npm run transformto convert icons - Run
npm run buildto build components
npm run transformThis command will:
- Read all SVG files in the
svg/directory - Optimize SVG code using SVGO
- Convert optimized SVGs to Stencil components
- Generate to the
src/components/directory
zane-icons/
βββ svg/ # Original SVG icon files
β βββ search.svg
β βββ user.svg
β βββ ...
βββ src/ # Source code
β βββ components/ # Generated component files
β β βββ search.tsx
β β βββ user.tsx
β β βββ ...
β βββ index.ts # Component index
β βββ index.html # Example page
βββ dist/ # Build output directory
βββ loader/ # Component loader
βββ scripts/ # Build scripts
β βββ transfer-svg.mjs # SVG conversion script
βββ stencil.config.ts # Stencil configuration
βββ package.json
βββ README.md
- Stencil - Component compiler
- TypeScript - Type safety
- SVGO - SVG optimization
- Jest - Unit testing
- Puppeteer - End-to-end testing
Issues and Pull Requests are welcome!
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
-
Prepare SVG files that meet the specifications:
- Dimensions: 1024x1024
- Color: Use
currentColorto inherit parent element color - Minimization: Remove unnecessary metadata
-
Place SVG files in the
svg/directory -
Run the conversion commands:
npm run transform npm run build
-
Commit the generated component files
This project is open source under the MIT license.
Thanks to all developers who have contributed to this project!
β If this project helps you, please give it a star!