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

octicons-react-ts

v1.81.2

Published

Make [Octicons](https://github.com/primer/octicons) "Reacted" and "Typed".

Downloads

16

Readme

octicons-react-ts

Make Octicons "Reacted" and "Typed".

Octicons

You may also view all available icons in Octicons.

Install

npm install octicons-react-ts --save

or with yarn

yarn add octicons-react-ts

Usage

Typescript

The library is definitely typed, it also declared octicons with octicons.d.ts.

React

It's exposed as an React SFC.

The entire library will be available when importing octicons-react-ts. Specifying the [icon you want to use][octicons], by supplying the name="" to the component.

import * as React from 'react'
import Octicon from 'octicons-react'

const alertIcon: React.SFC<{}> = ({}) => (<Octicon name="alert" />)

You may view all available icons in Octicons.

rep

options

The name is required, the optinal settings include: width, height, ratio, viewport, class, aria-hidden, aria-label.

Remember that the component turns out to be a SVG. You may accquire more infomations at SVG: Scalable Vector Graphics | MDN. In short, they are almost pictures, css rules on pictures are probably compatible.

The optional settings all has default values. The width, height, viewport are generated according to the data octicons provided.

The default classes for these icons are octicon and octicon-name according to its name. You can add class to it with array of class names.

aria-hidden is false and the default aria-label is the icon's name, these can also be specified.

<Octicon name="arrow-left" width={20} height={30} viewbox={[0, 0, 30, 30]} class={['my-icon']} aira-hidden={true} aria-label="icon" />

NOTE: About size. The svg size is determined in this order:

  1. If width specified, the width of svg is set that value. height works the same way.
  2. If ratio specified, the svg will be scaled to that value by default size.
  3. The default size.

css

You may import scss like

@import 'node_modules/octicons-react-ts/src/icon.scss'

And there is also the optional compiled dist/icon.css.

Release

NOTE: This package release tag is a little bit diffrent, to keep the track of the reference to the source octicons, the release tag is like bellow:

v<VERSION>.<SOURCEVERSION>.<PATCHES>

and the <SOURCEVERSION> just concats octicons main version and subversion.

So an example version tag of octicons-react may look like v1.73.2 which stands: version 1 based on octicons-v7.3.x(probably v7.3.0) with 2 patches.

Update

You may clone the project and update the icons to follow the octicons at any time with the help of /src/scripts.

You may just run

npm run catch && npm run build

And try it out to choose wether to link it to your project.

The symbol(name) and keywords are commented out in collect.js and octicons.d.ts, you may uncomment them and rebuild it.

Troubleshoot

package data.json not found ?

If tsc or webpack complains, you may try to append this to your 'data.d.ts':

declare module '*.json'

How can I only import the icons I need ?

I suggest downloading the .svg file from primer/octicons to you project in such situations.

And as far as I'm concerned, the @githubprime/octicons-react is also a good choice.

May I use it with class and style sheet as a font ?

I'm considering it.

LICENSE

octicons

primer/octicons (c) GitHub, Inc.

When using the GitHub logos, be sure to follow the GitHub logo guidelines.

Code License: MIT

octicons-react

Copyright (c) 2018 Qotes

Code License: MIT