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

react-content-tabs

v2.0.0

Published

A simple and accessible React component for tabbed content.

Downloads

14

Readme

React Content Tabs

Documentation npm version

Installation

React Content Tabs can be installed by running either of the following commands in your terminal:

npm install react-content-tabs --D
yarn add react-content-tabs

With the package installed, it can be imported into a React project.

import ReactContentTabs from 'react-content-tabs';

Once imported, the component can be used by adding it into the JSX with the required props and any additional options.

render() {
  return (
    <Tabs.Tabs>
      <Tabs.TabBar>
        <Tabs.Tab tabFor="upcoming">Upcoming</Tabs.Tab>
        <Tabs.Tab tabFor="completed">Completed</Tabs.Tab>
        <Tabs.Tab tabFor="calendar">Calendar</Tabs.Tab>
      </Tabs.TabBar>

      <Tabs.ContentWrapper>
        <Tabs.Content id="upcoming">Upcoming content.</Tabs.Content>
        <Tabs.Content id="completed">Completed content.</Tabs.Content>
        <Tabs.Content id="calendar">Calendar content.</Tabs.Content>
      </Tabs.ContentWrapper>
    </Tabs.Tabs>
  );
}

Options

| Tabs.Tabs | | | | | | --------- | -------- | ----------- | -------------------------------------------------------------------------------------------------------------- | --- | | Prop | Type | Default | Desc | | theme | object | {} | The theme prop allows the passing of an object of CSS colors to override the default theme of the component. |

theme={{
  base: '#fff',
  disabled: '#939393',
  inactive: '#000',
  primary: '#e92525',
  secondary: '#C8C8C8',
  tertiary: '#9fabb8',
}}

| Tabs.TabBar | | | | | -------------- | ----------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Prop | Type | Default | Desc | | mountTo | string or node | null | The mountTo prop allows the Content Tabs to optionally take advantage of React Portals. There are times when the tab bar should be displayed in a separate container than the content itself and the mountTo prop enables that. Pass in either a string of a DOM id or a React node (such as a container created with React.createRef()) into which the Content Tabs should be inserted. If this is left blank, the Content Tabs will be rendered in their native DOM order.Learn more about React Portals | | styles | object | {} | The styles prop allows the passing of an object of CSS properties to style the TabBar to fit a specific theme. | | tabs | object | {} | The tabs prop allows the passing of an object to customize the behavior of the Tabs. | | tabs.animation | string ("blur", "slide", "none") | slide | The animation property customizes how to underline moves from tab to tab. | | tabs.placement | string ("start", "end", "center", "fill") | start | The placement prop allows the positioning of the tabs horizontally within the TabBar container. | | tabs.styles | object | {} | The styles prop allows the passing of an object of CSS properties to style the Tabs themselves to fit a specific theme. |

| Tabs.Tab | | | | | -------- | -------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Prop | Type | Default | Desc | | tabFor | string | required | The tabFor prop is a string that associates the tab with the id of the content section. This functions similarly to the HTML for attribute when working with labels. | | isActive | bool | false | The isActive controls the display state of the Tab. This can be beneficial when needing a specific tab to be displayed on a corresponding URL. |

| Tabs.ContentWrapper | | | | | ------------------- | -------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Prop | Type | Default | Desc | | mountTo | string or node | null | Similar to mountTo property on the TabBar component, the mountTo prop on the ContentWrapper accepts a string of a DOM id or React node to define where the content of the tabs should be rendered. This enables the ability to place the TabBar and ContentWraper in separate containers. If left blank, the ContentWrapper will be rendered in its native DOM order.Learn more about React Portals |

| Tabs.Content | | | | | ------------ | -------- | ----------- | ----------------------------------------------------------------------------------------------------------------- | | Prop | Type | Default | Desc | | id | string | required | The id property applies an id to the content section which allows it to be associated with the correct Tab. |

Contact

@Yuschick on Twitter

Sponsors

Freska