Skip to content

rssblue/solid-heroicons

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solid Heroicons

⚠️ This is not an official implementation: All credits goes out to the Heroicons and Tailwind CSS team.

Heroicons integration for Solid with a twist.

Demo

Installation

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

Usage

You can import every icon from heroicons solid, outline, solid-mini, or solid-micro from solid-heroicons/solid, solid-heroicons/outline, solid-heroicons/solid-mini, and solid-heroicons/solid-micro, 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 the solid, outline or mini variant.

Those packages are generated automatically via a script 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";
import { arrowDown } from "solid-heroicons/solid-mini";
import { arrowUp } from "solid-heroicons/solid-micro";

const App = () => (
  <>
    <Icon path={arrowLeft} style="width: 24px; color: blue" />
    <Icon path={arrowRight} style="width: 24px; color: green" />
    <Icon path={arrowDown} style="width: 20px; color: yellow" />
    <Icon path={arrowUp} style="width: 16px; color: red" />
  </>
);

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 96.4%
  • JavaScript 3.6%