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

icons-ui

v0.4.1

Published

icons-ui is a package that allows multiple icon packages to be used in multiple frontend frameworks.

Downloads

7

Readme

icons-ui

npm npm bundle size NPM

icons-ui is a package that allows multiple icon packages to be used in multiple frontend frameworks.

Installation

To install icons-ui you will need npm, a Javascript package manager for Node.js.

Use the npm install command to install icons-ui:

npm install icons-ui

Usage

This package can be used with both Javascript and Typescript.

Every Icon element is rendered as an HTML <i> tag and has a class of icons-ui.

Before using this package please read the Usage and Terms of Use for the icon package you intend to use.

Icon Packages

| Icon Package | Supported | Version | | - | - | - | | Fontawesome | :white_check_mark: | 5.8.2 | | Material Design Icons | :white_check_mark: | | | Ionicons | :white_check_mark: | 4.5.5 | | Bootstrap Glyphicons | :white_check_mark: | |

Frameworks

| Framework | Supported | IconsUI Code | | - | - | - | | React | :white_check_mark: | react | | Preact | :white_check_mark: | preact | | Vue | :white_check_mark: | vue | | AngularJS | :white_check_mark: | angularjs | | Javascript | :white_check_mark: | js |

Icon Class

Description

The Icon Class is a React Component, a Vue Component, an AngularJS Component or a function that creates a HTML element in Javascript.

Attributes/Props

  • icon : An Icon from the FontAwesomeIcons, MaterialIcons or IonIcons objects - required
  • size : number. Sets the CSS font size property - optional
  • onClick : Function. Callback function that takes an event attribute - optional
  • href : string. Adds a link to the icon - optional
  • target : string. Specifies where to open the link. Options listed below - optional
    • _blank - Opens in new tab - default
    • _self - Opens in same tab
  • className : string - Sets the HTML class attribute - optional
  • id : string - Sets the HTML id attribute - optional

Icon Objects

Description

Objects that store all the data about each icon in each icon package.

These icon objects are FontAwesomeIcons, MaterialIcons and IonIcons.

Usage

To use these objects you first need to call them. You will only need to call an object once.

For example, if I wanted to use the FontAwesomeIcons object I would need to first call it like a function:

FontAwesomeIcons(); // Call the object to load all it's data.

Now FontAwesomeIcons will be loaded with all the icons data.

Examples

All Examples below will produde the following output:

React

import { Icon, FontAwesomeIcons, MaterialIcons } from 'icons-ui';

FontAwesomeIcons();
MaterialIcons();

ReactDOM.render(
    <div>
        <Icon icon={ FontAwesomeIcons.solid.check }/>
        <Icon icon={ MaterialIcons.filled.games } size={ 36 }/>
    </div>,
    document.getElementById('app')
);

Preact

import { Icon, FontAwesomeIcons, MaterialIcons } from 'icons-ui';

render((
    <div>
        <Icon icon={ FontAwesomeIcons.solid.check }/>
        <Icon icon={ MaterialIcons.filled.games } size={ 36 }/>
    </div>
), document.body);

Vue

import { Icon, FontAwesomeIcons, MaterialIcons } from 'icons-ui';

FontAwesomeIcons();
MaterialIcons();

new Vue({
    el: '#app',
    components: {
        Icon
    },
    data: {
        checkIcon: FontAwesomeIcons.solid.check,
        gamesIcon: MaterialIcons.filled.games,
        gamesSize: 36
    }
});
<icon :icon="checkIcon"></icon>
<icon :icon="gamesIcon" :size="gamesSize"></icon>

AngularJS

const { Icon, MaterialIcons, FontAwesomeIcons } = require('icons-ui');

MaterialIcons();
FontAwesomeIcons();

angular.module('app', [ Icon ]);

angular.module('app').controller('AppCtrl', function AppCtrl() {
    this.checkIcon = FontAwesomeIcons.solid.check;
    this.gamesIcon = MaterialIcons.filled.games;
    this.gamesSize = 36;
});

angular.bootstrap(document.getElementById('app'), [ 'app' ]);
<div id="app" ng-controller="AppCtrl as ctrl">
    <icon icon="ctrl.checkIcon"></icon>
    <icon icon="ctrl.gamesIcon" size="ctrl.gamesSize"></icon>
</div>

Javascript

const { Icon, FontAwesomeIcons, MaterialIcons } = require('icons-ui');

FontAwesomeIcons();
MaterialIcons();

const checkIcon = Icon({ icon: FontAwesomeIcons.solid.check });
const gamesIcon = Icon({ icon: MaterialIcons.filled.games, size: 36 });

const app = document.getElementById('app');

app.appendChild(checkIcon);
app.appendChild(gamesIcon);

Using more than one framework

If you are using more than one framework in your project then you will need to set the window.iconsUI value to the relavant IconsUI Code in the table at the top of this file before you import the icons-ui package.

For example, if my page was using React and Vue, and I wanted to use icons-ui with Vue, I would need to set window.iconsUI to vue before importing Icon from 'icons-ui`.