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

@srph/react-tabs-manager

v0.1.2

Published

Build tab functionalities for complicated layouts. An advanced alternative for react-tabs.

Downloads

3

Readme

React Tabs Manager npm version Build Status

Build tab functionalities for complicated layouts. An advanced alternative for react-tabs.

View demo / View examples

Why?

react-tabs works very well, but there are projects where the layout is slightly different from your usual tabs. Usual tabs use the following layout:

But this isn't intuitive when you have layout like the following:

How It Works

This library takes advantage of context to pass down data to the navigation and view. react-tabs uses clones the element (via React.cloneElement), and passes down its props directly.

Installation

npm i @srph/react-tabs-manager

Script tags

If you're not using a bundler like Browserify or Webpack, simply add the script tag after your React script tag.

<!-- Script tags for React and other libraries -->
<script src="https://unpkg.com/@srph/react-tabs-manager/dist/react-tabs-manager.min.js"></script>

This library is exposed as ReactTabsManager (e.g., ReactTabsManager, ReactTabsManager.TabView, ReactTabsManager.TabItem).

Usage

View examples.

import React from 'react';
import Tabs, {TabView, TabItem} from '@srph/react-tabs-manager';

class App extends React.Component {
  render() {
    return (
      <Tabs>
        <div className="app">
          <div className="panel">
            <h4 className="title">Subtasks</h4>
            <div className="nav">
              <TabItem index={0}>All</TabItem>
              <TabItem index={1}>Other</TabItem>
            </div>
          </div>

          <div className="content">
            <TabView index={0}>
              Baz!! 
            </TabView>

            <TabView index={1}>
              Bar!!
            </TabView>
          </div>
        </div>
      </Tabs>
    );
  }
}

export default App;

API Documentation

Here's a list of props you may use to customize the component for your use-case:

Tabs

| Prop | Type | Description | | ----- | ---- | ----------- | | activeClassName | function | The classname to pass to the active TabItem. Defaults to active. |

NOTE: Tabs render all of the children you provide. It doesn't wrap it with a div. If you're using React <= v15, you will have to wrap the children you pass with div.

TabItem

All other props are passed down to the a root element as usual.

| Prop | Type | Description | | ----- | ---- | ----------- | | index | number (required) | The number to be set as active when clicked. |

NOTE: TabItem ignores href and role, hard codes the values # and button respectively.

TabView

All other props are passed down to the div root element as usual.

| Prop | Type | Description | | ----- | ---- | ----------- | | index | number (required) | The number to identify if tab is active |

Setup

You can check the demo, or build it yourself locally:

npm install
npm run start

Bundling package

npm run bundle

Publish storybook

npm run storybook:publish