This is a simple
<Tabs> component built with ReactJS.
Installing this component is very easy and it has just one dependency: React. So, you have a lot of options to do that:
- Using NPM ~the quickest way~
$ npm install --save react-simpletabs
- Using Bower
$ bower install --save react-simpletabs
- Or if you want to download the lastest release and put in your website, it will work too!
NOTICE: You need just one thing to make the component work. Put the base component style at the
<header> tag. If you don't wanna use the
.css extension, you can get the
.scss extension at the folder
Then you're done! 😸
Using the component is simpler than installing. See an example with browserify to bundle your script:
/** @jsx React.DOM */var Tabs = ;var App = React;React;
window.ReactSimpleTabs (or just
/** @jsx React.DOM */var Tabs = ReactSimpleTabs;var App = React;
Tabs.Panel component is a namespaced component of the
Tabs, this is easiest way and you avoid to declare a bunch of variables.
NOTE: It is required that you put the
title property to the
Tabs.Panel component. Without this, the component won't work, ok?
Behind the Scene
There are some things that you should know about the component. The first one is the structure created inside by the component if you wish to stylize it.
So, the semantic HTML structure will be something like this:
Tab #1Tab #2The content of active panel here
This is a very simple structure to stylize however you want. So, if you are lost, don't panic, there is a real functional example that you can follow.
The other thing that I have to share with you is that the component has some properties that you can use. Example:
If you want to set a default tab active you can use the
And if you want to do something before or after the changed tab, you can do use the
onAfterChange property (or both together):
For more details, check out the API below.
||n/a||no||Additional class names for wrapping div|
||1||no||The default tab active|
||n/a||no||The function that will be executed when the component is mounted|
||n/a||no||The function that will be executed before the state of the component change. Return
||n/a||no||The function that will be executed after the state of the component change|
||n/a||yes||The title that will generate the tab menu items|
Anyone can help make this project better - check out the Contributing guide!
See the License file.