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

iconical-tab-nav

v1.0.1

Published

A Tab Navigation component that can be either text or icon based

Downloads

8

Readme

iconical-tab-nav

A Tab Navigation component that can be either text or icon based

NPM JavaScript Style Guide

Demo

Check out the demo.

Install

npm install --save iconical-tab-nav

Usage

This library has been designed to work with material icons by default. In order to use material icons you must include the following line in your application.

<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

You can then use any of the icons available at https://material.io/tools/icons/ by passing in the relevant string to the 'icon' prop.

import * as React from 'react'

import IconicalTabNav from 'iconical-tab-nav'

class Example extends React.Component {
  render () {
    return (
      <IconicalTabNav 
      tabs={
        [
          { label: 'Home', icon: 'home', render:  ()=> <div>Tab One</div>}, 
          { label: 'Favourites', icon: 'favorite', render:  ()=> <div>Tab Two</div>}
        ]
      }/>
    )
  }
}

API

Tab

IconicalTabNav has one required prop, tabs, that takes a Tab[].

The interface for Tab is as follows:

interface Tab {
  label?: string
  icon?: string
}

In order for the icon to render, the string passed in must match an icon in the material icons set. https://material.io/tools/icons/

Props

| name | type | default | description | | --------------- | :-----------------------: | ------------------------------------------------------------------: | -----------------------------------------------------------------------------------------------------------------------------------------------------------------: | | tabs (required) | Tab[] | | (see above) | | showLabels | boolean | false | show text labels | | hideIcons | boolean | false | show icon labels | | containerStyles | ContainerStyles | (see styles) | (see styles) | | tabStyles | TabStyles | (see styles) | (see styles) | | selectedStyles | TabStyles | (see styles) | (see styles) | | labelStyles | LabelStyles | (see styles) | (see styles) | | hoverColour | string | #dfe3e6 #dfe3e6 | The background color of the tab when moused over | | selected | number / 'none' | 'none' | The index of the default tab selection (e.g. 0) | | iconSize | enum('s', 'm', 'l', 'xl') | 'm' | Size of the icon, as per material design standards (s: 18px, m: 24px, l: 32px, xl: 48px) | | selectedColour | string | #008673 #008673 | The color of the text and icon when active | | defaultColor | string | #8897a2 #8897a2 | The color of the text and the icon when inactive | | reverse | boolean | false | Indicates whether the tabs should sit at the top or the bottom of the container. Default is at the top, if reverse is set to true then tabs will sit at the bottom |

Styles

IconicalTabNav has default styling applied so there should be no need to apply futher styles unless desired. It takes style objects for the container component, tabs and the labels and is therefore the styling is highly customisable.

For containerStyles these are the expected values:

interface ContainerStyles {
  backgroundColour?: string (default white)
  padding?: string
}

These styles are applied to the container that wraps the tabs.

For tabStyles and selectedStyles these are the expected values:

interface TabStyles {
  padding?: string
}

These styles are applied to the tab divs. tabStyles are applied to all tabs, selectedStyles are applied to the currently selected tab.

For labelStyles these are the expected values:

interface LabelStyles {
  margin?: string
  fontSize?: string
}

These styles are applied to the label, both text and icon.

But you can pass any valid styles through these objects as they are passed directly in to the component.

License

MIT © kipurc