Hatch's icon font library with 1000+ icons
Add the following to your ~/.npmrc (global, recommended) or create
a .npmrc in your project root:
@hatchsoftware:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN
Replace YOUR_GITHUB_TOKEN with a GitHub Personal Access Token
(classic) with read:packages scope.
npm install @hatchsoftware/hatch-icons
In your CSS or SCSS:
@import "@hatchsoftware/hatch-icons/styles.css";
Or in your JavaScript/TypeScript entry file:
import "@hatchsoftware/hatch-icons/styles.css";
Types can also be imported as such:
import { HatchIcons } from "@hatchsoftware/hatch-icons";
Which is an enum of all the icon keys included in the package. You can use this enum to create a list of all icon classes in your codebase, e.g.:
export type Icon = {
readonly [K in keyof typeof HatchIcons]: string;
};
export const Icon = Object.freeze(
Object.fromEntries(Object.entries(HatchIcons).map(([key, value]) => [key, `hi hi-${value}`])),
) as Icon;
Download the font files from GitHub, copy them to your project, and import the CSS:
@import "path/to/hatch-icons.css";
For React Native apps, import icon components (built on
react-native-svg, which is a peer dependency) from the react-native entry point
instead:
import { WeatherSunSetting01 } from "@hatchsoftware/hatch-icons/react-native";
<WeatherSunSetting01 size={24} color="#ff4b24" />
Each icon is its own module and a named export, so bundlers can tree-shake away
icons you don't use. Component names match the HatchIcons enum keys
above (e.g. HatchIcons.WeatherSunSetting01 on web is
WeatherSunSetting01
in React Native).
Use icons in your HTML:
<i class="hi hi-arrows-arrow-up"></i>
<i class="hi hi-general-check"></i>
Icons inherit the current text color and size:
.my-icon {
font-size: 24px;
color: #ff4b24;
}