Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-simply-tabs

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-simply-tabs

Simple and small react.js tabs component

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

react-simply-tabs

npm version npm bundle size GitHub license

Simple and small react.js tabs component

Table of contents

Installation

npm

npm install react-simply-tabs --save

yarn

yarn add react-simply-tabs

Usage

Basic Example:
import React, { useState } from 'react';
import Tabs from 'react-simply-tabs';

const App = () => {
  const [activeTabIndex, setActiveTabIndex] = useState(0);

  return(
    <Tabs
      activeTabIndex={activeTabIndex}
      onRequestChange={setActiveTabIndex}
      controls={[
        <button type="button">
          Show 1
        </button>,
        <button type="button">
          Show 2
        </button>,
        <button type="button">
          Show 3
        </button>,
      ]}
    >
      <div>1 tab</div>

      <div>2 tab</div>

      <div>3 tab</div>
    </Tabs>
  );
};

Props

NameTypeDefault ValueDescription
activeControlPropsobject{}Props (valid DOM props or your custom props) for active control node. Will be merged with default control props
activeTabIndexnumber0Index of visible tab
activeTabPropsobject{}Props (valid DOM props or your custom props) for active tab node. Will be merged with default tab props
childrennodenullTabs nodes
controlsarray of nodes[]Array of controls nodes
controlsWrapperPropsobject{}DOM props for div inside which will be rendered controls
hiddenTabPropsobject{}Props (valid DOM props or your custom props) for hidden (not active) tab node. Will be merged with default tab props
onRequestChangefunctionFunction that will be run when the activeTabIndex is requested to be changed (either by clicking on control) (required)
renderOnlyActiveTabbooleanfalseIf true hidden tabs will not be rendered
tabsWrapperPropsobject{}DOM props for div inside which will be rendered tabs
wrapperPropsobject{}DOM props for div inside which will be rendered tabs && controls

Demo

Edit react-simply-tabs

Keywords

FAQs

Package last updated on 11 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc