react-toolbox/components/tabs
@soyjavi 147088bfa3 Alphabetical Order for properties and methods 2015-11-07 09:36:51 +07:00
..
_config.scss Reorder styles for tabs 2015-10-21 01:12:31 +02:00
index.jsx Rewrite tabs in ES6 2015-09-19 18:48:09 +02:00
readme.md Add document for the root component documentation 2015-11-01 16:18:35 +01:00
style.scss Remove flex data attributes from components 2015-10-21 02:16:42 +02:00
tab.jsx Alphabetical Order for properties and methods 2015-11-07 09:36:51 +07:00
tabs.jsx Fix some errors and change opinionated eslint 2015-10-23 18:30:37 +02:00

readme.md

Tabs

Tabs make it easy to explore and switch between different views or functional aspects of an app or to browse categorized data sets. For now we are using tabs along with content so it's not possible to render just the tab headers with event listeners. In the future we will add this feature but for now you can compose your tabs with content:

import {Tab, Tabs} from 'react-toolbox';

const TabsExample = () => (
  <Tabs>
    <Tab label='Primary'><small>Primary content</small></Tab>
    <Tab label='Secondary'><small>Secondary content</small></Tab>
    <Tab label='Third' disabled><small>Disabled content</small></Tab>
    <Tab label='Fourth' hidden><small>Fourth content hidden</small></Tab>
    <Tab label='Fifth'><small>Fifth content</small></Tab>
  </Tabs>
);

Tabs

This component acts as the wrapper and the main controller of the content that is being displayed. It gets some properties that can be spread to the children.

Name Type Default Description
className String '' Additional class name to provide custom styling.
index Number 0 Current
onChange Function Callback function that is fired when the tab changes.

The tabs component has state to hold the currently activated tab and exposes a method to change it manually called active. You can call this method with the index value of the child you want to activate.

Tab

Represent a single tab element and it should include some properties to describe the tab itself and get children elements as content.

Name Type Default Description
active Boolean false If true, the current component is visible.
className String '' Additional class name to provide custom styling.
disabled Boolean false If true, the current component is not clickable.
hidden Boolean false If true, the current component is not visible.
label String Label text for navigation header
onActive Function Callback function that is fired when the tab is activated.
tabIndex Number Sets the tabindex html attribute.