@@ -24,15 +24,54 @@ var React = require('react'),
2424 TabPanel = ReactTabs .TabPanel ;
2525
2626var App = React .createClass ({
27+ handleSelect : function (index , last ) {
28+ console .log (' Selected tab: ' + index + ' , Last tab: ' + last);
29+ },
30+
2731 render : function () {
2832 return (
29- < Tabs>
33+
34+ // <Tabs/> is a composite component and acts as the main container.
35+ //
36+ // `onSelect` is called whenever a tab is selected. The handler for
37+ // this function will be passed the current index as well as the last index.
38+ //
39+ // `selectedIndex` is the tab to select when first rendered. By default
40+ // the first (index 0) tab will be selected.
41+
42+ < Tabs
43+ onSelect= {this .handleSelected }
44+ selectedIndex= {2 }>
45+
46+ // <TabList/> is a composit component and is the container for the <Tab/>s.
47+
3048 < TabList>
49+
50+ // <Tab/> is the actual tab component that users will interact with.
51+ //
52+ // Selecting a tab can be done by either clicking with the mouse,
53+ // or by using the keyboard tab to give focus then navigating with
54+ // the arrow keys (right/down to select tab to the right of selected,
55+ // left/up to select tab to the left of selected).
56+ //
57+ // The content of the <Tab/> (this.props.children) will be shown as the label.
58+
3159 < Tab> Foo< / Tab>
3260 < Tab> Bar< / Tab>
3361 < Tab> Baz< / Tab>
3462 < / TabList>
3563
64+ // <TabPanel/> is the content for the tab.
65+ //
66+ // There should be an equal number of <Tab/> and <TabPanel/> components.
67+ // <Tab/> and <TabPanel/> components are tied together by the order in
68+ // which they appear. The first (index 0) <Tab/> will be associated with
69+ // the <TabPanel/> of the same index. Running this example when
70+ // `selectedIndex` is 0 the tab with the label "Foo" will be selected
71+ // and the content shown will be "Hello from Foo".
72+ //
73+ // As with <Tab/> the content of <TabPanel/> will be shown as the content.
74+
3675 < TabPanel>
3776 < h2> Hello from Foo< / h2>
3877 < / TabPanel>
0 commit comments