npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ricmello/preact-heroicons

v1.0.2

Published

Heroicons as Preact components - compatible with Vite and Parceljs

Downloads

1

Readme

Preact Heroicons

A set of free MIT-licensed high-quality SVG icons for you to use in your web projects.

This package wraps up all of the wonderful Heroicons into Preact components, with appropriate TypeScript typings. This package is fully treeshakable, so each icon imported is just 200 bytes gzipped! That's practically free!!!

Note: The official Heroicons package is here. These work well, but will have conflicts when using Preact and TypeScript.

This package will version match the official Heroicons package and documentation. Preact Heroicons specific patches will be handled as rc releases one patch version ahead of the official package.

Previewing the Icons

Preview the icons at heroicons.com.

Installation & Usage

First, install this library with your package manager of choice!

npm add preact-heroicons
pnpm add preact-heroicons
yarn add preact-heroicons
bun install preact-heroicons

Note: For Deno, you can import from https://esm.sh/preact-heroicons

Now you have access to the entire heroicons library! They are formatted as pascal case and have Solid (solid format) or Outline (outline format) appended at the end based on type.

Mini Icons (Heroicons v2.0) are accessible by appending MiniSolid to the name provided on HeroIcons.

import { ArchiveBoxSolid } from "preact-heroicons";
import { ArchiveBoxOutline } from "preact-heroicons";
import { ArchiveBoxMiniSolid } from "preact-heroicons";

export const SomeComponent = () => {
  return (
    ...
    <ArchiveBoxSolid className="h-6 w-6 text-gray-500" />
    <ArchiveBoxOutline className="h-6 w-6 text-gray-500" />
    <ArchiveBoxminiSolid className="h-4 w-4 text-gray-500" />
    ...
  )
}

Note: Coloring the icon is done by setting the color property with CSS

Types

The types used to define the Icons come from preact/jsx.

As a convenience, the type of the components is provided by importing HeroIcon from the main package.

import { HeroIcon } from 'preact-heroicons';

const Icons: HeroIcon[] = [];

This can be useful when you want to construct objects containing HeroIcons and want to ensure strict typing.

Use with other JSX Factories

To ensure compatibility with automated bundler systems, these icons will, use preact.h as their JSX factory. To use your own JSX factory, you'll need to alias preact to something else that exports a jsx function as h in your bundlers settings.

Thanks

This package is a form of the work done by @graywolftech/react-heroicons. A lot of the package was written and retooled for Preact, but that package was was got me started on this.