Skip to content

bsl-zcs/solid-heroicons

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solid Heroicons

Heroicons intergration for solid-js.

Demo

Installation

$ npm install solid-heroicons
$ yarn add solid-heroicons
$ pnpm add solid-heroicons

Usage

You can import every icon from heroicons solid or outline from solid-heroicons/solid and solid-heroicons/outline respectively. They are exported as camel case. Everything exported from those packages are just an object with the SVG path and a metadata to know whether it's been exported from solid or outline. Those packages are generated automatically from the heroicon repo.

You can import the Icon component helper from solid-heroicons. This is just a SVGElement wrapper that accepts any props a regular SVG would plus a special props path for the icon you want to load in.

By default the stroke | fill attribute of the SVG is set to currentColor which means you can give any color you want to the SVG by setting the css color attribute on SVG or any parent higher.

import { render } from "solid-js/dom";
import { Icon } from "solid-heroicons";
import { arrowLeft } from "solid-heroicons/solid";
import { arrowRight } from "solid-heroicons/outline";

const App = () => (
  <>
    <Icon path={arrowLeft} />
    <Icon path={arrowRight} />
  </>
);

render(() => App, document.getElementById("app"));

Troubleshoot

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 97.5%
  • JavaScript 2.5%