Skip to content

About

React, Vue 3, Svelte 5 and Web Component icon components generated from Ichava icon packs pinned at a git commit.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

@ichava/js-icon-components

Tests License: MIT

Two badges, not four: the package is not on npm (it installs from a GitHub release tarball or a git tag), so there is no registry version to show, and lint runs in the same CI workflow as the tests.

Icon components for twelve frameworks, plus CSS mask, data URI, Flutter and SwiftUI exports, generated from Ichava icon packs pinned at a git commit.

Four packs: Tabler, flags, Twemoji and OpenMoji, 18,802 icons in all.

Node 24 or newer to install. The framework is an optional peer, for the flavour you use: React 18+, Vue 3.4+, Svelte 5, react-native-svg 15+, Angular 20+, SolidJS 1.8+, Preact 10.19+, Astro 5+, Qwik 1.5+ or Ember 6.3+. Elm and the exports need none.

Kind Targets Where
Flavour (component) React, Vue 3, Svelte 5, Web Component, React Native, Angular, SolidJS, Preact, Astro, Qwik, Ember @ichava/js-icon-components/<flavour>/<pack>
Flavour (source) Elm, one Ichava.Icons.<Pack> module per pack dist/elm/
Export CSS mask, data URI dist/assets/<pack>/icons.css, data-uri.json
Native export Flutter (flutter_svg assets), SwiftUI (.xcassets), both shipping the original SVG dist/assets/<pack>/flutter.zip, swiftui.zip

Install

Two ways, both supported. The release tarball is the one to use in an application: it is built once when a release is tagged, holds every pack, flavour and export, and installs with no build, compiler or git:

npm install https://github.com/ichava/js-icon-components/releases/download/v0.1.0/ichava-js-icon-components-0.1.0.tgz

To check it against the release's SHA256SUMS first:

curl -sLO https://github.com/ichava/js-icon-components/releases/download/v0.1.0/ichava-js-icon-components-0.1.0.tgz
curl -sL https://github.com/ichava/js-icon-components/releases/download/v0.1.0/SHA256SUMS | grep ichava-js-icon-components-0.1.0.tgz | shasum -a 256 -c
npm install ./ichava-js-icon-components-0.1.0.tgz

The git install is for contributors, or for pinning a commit that has no release yet. npm runs the prepare build, with the compilers (several hundred MB) in npm's temporary clone, in 24 to 69 s. It compiles only what you choose, with environment variables or the same keys under "ichava": { "icons": { … } } in your package.json, and needs git on the path:

ICHAVA_ICONS_PACKS=tabler ICHAVA_ICONS_FLAVOURS=react \
  npm install "github:ichava/js-icon-components#v0.1.0"
Variable package.json key Effect
ICHAVA_ICONS_PACKS=tabler,flag "packs": ["tabler", "flag"] builds only those packs
ICHAVA_ICONS_FLAVOURS=react,css-mask "flavours": ["react", "css-mask"] builds only those flavours and exports
ICHAVA_ICONS_SKIP_BUILD=1 "skipBuild": true builds nothing
ICHAVA_ICONS_INSTALL=tarball "install": "tarball" refuses the git build and names the release tarball

The release also attaches one tarball per pack (@ichava/js-icon-components-<pack>). An import of a pack or flavour that was not built throws, naming the variable that adds it. See Installation for the per-pack tarballs, checksums, sizes and times.

Quick start guide and usage

Getting started

Nothing to configure. Import the flavour you use and the pack you want (tabler, flag, twemoji or openmoji); the frameworks are optional peers, so only the one you import has to be installed. Exports are tree-shakeable, so a bundle carries the icons it imports and nothing else.

Twemoji (twemoji) is CC-BY 4.0 and OpenMoji (openmoji) is CC-BY-SA 4.0: an application that ships them takes on their attribution terms. Each pack's ATTRIBUTION.md ships at dist/<flavour>/<pack>/; see Packs.

Usage

React:

import { IconMug, IconMugFilled } from '@ichava/js-icon-components/react/tabler';

<IconMug size={20} strokeWidth={1.5} />
<IconMugFilled color="#7c3aed" title="Coffee" />

Flags and emoji keep their own colours:

import { IconKe } from '@ichava/js-icon-components/react/flag';
import { IconGrinningFace } from '@ichava/js-icon-components/react/twemoji';

<IconKe size={32} title="Kenya" />
<IconGrinningFace size={24} />

Vue 3:

<script setup lang="ts">
import { IconMug } from '@ichava/js-icon-components/vue/tabler';
</script>

<template><IconMug :size="20" title="Coffee" /></template>

Svelte 5, and the framework-free custom element:

<script>
  import { IconMug } from '@ichava/js-icon-components/svelte/tabler';
</script>

<IconMug size={20} />
import { defineIchavaIcon, registerIcons } from '@ichava/js-icon-components/wc';
import { IconMug } from '@ichava/js-icon-components/wc/tabler';

registerIcons([IconMug]);
defineIchavaIcon(); // <ichava-icon name="tabler:outline/mug" size="20" label="Coffee"></ichava-icon>

React Native, Angular, SolidJS, Preact, Astro, Qwik and Ember take the same icons from their own subpath:

import { IconMug } from '@ichava/js-icon-components/react-native/tabler';  // also /solid and /preact
<IconMug size={20} color="#7c3aed" />
---
import { Icon } from '@ichava/js-icon-components/astro';
import { IconMug } from '@ichava/js-icon-components/astro/tabler';  // Angular: <ichava-ng-icon [icon]="mug" />
---
<Icon icon={IconMug} size={20} title="Coffee" />
import { IconMug } from '@ichava/js-icon-components/qwik/tabler';  // Ember: <Icon @icon={{IconMug}} @size={{20}} />
export default component$(() => <IconMug size={20} />);

Elm reads dist/elm/ as a source directory, and the exports are files:

import Ichava.Icons.Tabler as Tabler
import Svg.Attributes

view = Tabler.iconMug [ Svg.Attributes.width "20" ]
<link rel="stylesheet" href="node_modules/@ichava/js-icon-components/dist/assets/tabler/icons.css">
<span class="i-tabler-mug"></span>

Illustrations take primaryColor and variant="dark" in every component flavour; see Getting started.

The full walkthrough is in docs/getting-started.md; everything else is under Documentation.

Documentation

The documentation lives in this repository's docs/ folder.

Guides

  • Installation — the release tarball, the git build and its options, sizes and times
  • Getting started — props, accessibility and export names in every flavour
  • Packs — the four pinned packs, their licences, attribution and id prefixing
  • Architecture — why a generator, the pinned input, the SVG gate and the guards
  • Release — tagging, and moving a pack to a new commit

Reference

  • React — @ichava/js-icon-components/react
  • Vue 3 — @ichava/js-icon-components/vue
  • Svelte 5 — @ichava/js-icon-components/svelte
  • Web Component — @ichava/js-icon-components/wc
  • React Native — @ichava/js-icon-components/react-native
  • Angular — @ichava/js-icon-components/angular
  • SolidJS — @ichava/js-icon-components/solid
  • Preact — @ichava/js-icon-components/preact
  • Astro — @ichava/js-icon-components/astro
  • Qwik — @ichava/js-icon-components/qwik
  • Ember — @ichava/js-icon-components/ember
  • Elm — dist/elm/Ichava/Icons/<Pack>.elm
  • CSS mask — dist/assets/<pack>/icons.css
  • Data URI — dist/assets/<pack>/data-uri.json
  • Flutter — dist/assets/<pack>/flutter.zip
  • SwiftUI — dist/assets/<pack>/swiftui.zip

Contributing and security

See CONTRIBUTING.md and SECURITY.md. This project follows the Contributor Covenant.

License

MIT. See LICENSE. That covers the generator and templates, not the artwork: each pack keeps its own licence. Tabler Icons and flag-icons are MIT, Twemoji is CC-BY 4.0 and OpenMoji is CC-BY-SA 4.0. Each pack's ATTRIBUTION.md, and its licence text where the pack carries one, is copied from the pinned commit to dist/<flavour>/<pack>/ and dist/assets/<pack>/, and into every zip.

About

React, Vue 3, Svelte 5 and Web Component icon components generated from Ichava icon packs pinned at a git commit.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages