node-icons
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

🍱 node-icons

All Contributors License Last Commit Stars Forks

Usage

Checkout its unit tests to see complete usage with output!

import Icons from "node-icons";
const icons = Icons({
  // auto installs the collection set of an icon if not already installed
  installPkg: true,
  alias: new Map(),
  prefix: "lucide",
  separator: ":",
});
const result = await icons.iconify("This is cool right! ::activity::", {
  // The `styles` object's key value pair are appended as attributes to the svg
  styles: {
    width: 100,
    color: `"red"`, // it is important to have quotes for those values which need them like color="red"
  },
  base64: false,
});

The Icon({}) function expects an object of type config. The object returned by it has 2 methods

type returnVal = {
  getIcons(iconName: any, styles: any, base64: boolean): Promise<string>;
  getIconsSync(iconName: any, styles: any, base64: boolean): string;
  iconify(
    text: string,
    options: {
      styles: object;
      base64: boolean;
    },
    regex?: RegExp,
  ): Promise<string>;
};

With getIconsSync, auto installing icons is not possible.

Installation

npm i node-icons or yarn add node-icons to install.

npm i @iconify/json to install all icons or npm i @iconify-json/<collection-id> to install a specific icon set.

🎉 Contributing

Contributions are welcome! Whether it is a small documentation change or a breaking feature, we welcome it!

Please note: All contributions are taken under the MIT license

👥 Contributors

Readme

Keywords

none

Package Sidebar

Install

npm i node-icons

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

12.5 kB

Total Files

6

Last publish

Collaborators

  • tsgandalf