An open API service indexing awesome lists of open source software.

https://github.com/nstr/react-tab-list

Special react component for menu, filters and etc.
https://github.com/nstr/react-tab-list

es6 javascript react react-component reactjs

Last synced: about 1 year ago
JSON representation

Special react component for menu, filters and etc.

Awesome Lists containing this project

README

          

# react-tab-list
* [Installation](#installation)
* [Simple usage](#simple-usage)
* [Active tab](#active-tab)
* [Styles](#styles)

![demo](https://s3-eu-west-1.amazonaws.com/njnest-opensource/npm/tab-list.gif)

## Installation

```
npm i react-tab-list
```

## Simple usage:

```jsx
import TabList from "react-tab-list";

const items = [
{
name: "First"
},
{
name: "Second"
},
{
name: "Third"
}
];

class SomeComponent extends React.Component{
constructor(props) {
super(props);
{
callBackFunction(tab) {
// There will be the active tab data
}
render() {
return ;
}
}
```

## Active tab

```jsx
import TabList from "react-tab-list";
class SomeComponent extends React.Component{
constructor(props) {
super(props);
this.state = {
items: [
{
name: "First",
id: "a1"
},
{
name: "Second",
id: "b2"
},
{
name: "Third",
id: "e5"
}
],
activeTabId: "b2"
}
this.callBackFunction = this.callBackFunction.bind(this);
{
callBackFunction(tab) {
this.setState({activeTabId: tab.id});
}
render() {
return ;
}
}
```
Of course, you have the possibility not point an active tab(activeTab). In this case, the first item of tabs is assigned by default.

## Styles:

You can include less, scss or css file in your project.

```less
@import "./react-tab-list/styles/tab-list.less";
```

```scss
@import "./react-tab-list/styles/tab-list.scss";
```

and/or add some custome style:

```jsx
;

```