Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | 2x 2x 2x 4x 2x 2x 24x | // @flow strict
import React from 'react';
import TabBar from '../material-toolbox/tab-bar';
import Tab from '../material-toolbox/tab';
import TabText from '../material-toolbox/tab/Text';
import TabIcon from '../material-toolbox/tab/Icon';
import TabScroller from '../material-toolbox/tab-scroller';
import Example from '../Example';
const source = `import React from 'react';
import TabBar from 'material-toolbox/tab-bar';
import Tab from 'material-toolbox/tab';
import TabText from 'material-toolbox/tab/Text';
import TabIcon from 'material-toolbox/tab/Icon';
import TabScroller from 'material-toolbox/tab-scroller';
const tabs = 'One Two Three Four Five Six Seven Eight Nine Ten Eleven Twelve'.split(' ');
const BasicTabBar = ({ second = false }) => (
<TabBar initialActive={0}>
<TabScroller>
<Tab stacked={second} contentIndicator={second}>
<TabIcon className="material-icons">access_time</TabIcon>
<TabText>Recents</TabText>
</Tab>
<Tab stacked={second} contentIndicator={second}>
<TabIcon className="material-icons">near_me</TabIcon>
<TabText>Nearby</TabText>
</Tab>
<Tab stacked={second} contentIndicator={second}>
<TabIcon className="material-icons">favorite</TabIcon>
<TabText>Faborites</TabText>
</Tab>
</TabScroller>
</TabBar>
);
const TabBars = () => (
<div>
<p>Tabs with icons next to labels</p>
<BasicTabBar />
<p>Tabs with icons above labels and indicators restricted to content</p>
<BasicTabBar second />
<p>Scrolling tabs</p>
<TabBar initialActive={0} focusOnActivate>
<TabScroller>
{tabs.map(tab => (
<Tab key={tab}>
<TabText>Tab {tab}</TabText>
</Tab>
))}
</TabScroller>
</TabBar>
</div>
);
export default TabBars;`;
const tabs = 'One Two Three Four Five Six Seven Eight Nine Ten Eleven Twelve'.split(
' ',
);
const BasicTabBar = ({ second = false }: { second?: boolean }) => (
<TabBar initialActive={0}>
<TabScroller>
<Tab stacked={second} contentIndicator={second}>
<TabIcon className="material-icons">access_time</TabIcon>
<TabText>Recents</TabText>
</Tab>
<Tab stacked={second} contentIndicator={second}>
<TabIcon className="material-icons">near_me</TabIcon>
<TabText>Nearby</TabText>
</Tab>
<Tab stacked={second} contentIndicator={second}>
<TabIcon className="material-icons">favorite</TabIcon>
<TabText>Faborites</TabText>
</Tab>
</TabScroller>
</TabBar>
);
const TabBars = () => (
<Example title="" source={source}>
<p>Tabs with icons next to labels</p>
<BasicTabBar />
<p>Tabs with icons above labels and indicators restricted to content</p>
<BasicTabBar second />
<p>Scrolling tabs</p>
<TabBar initialActive={0} focusOnActivate>
<TabScroller>
{tabs.map(tab => (
<Tab key={tab}>
<TabText>Tab {tab}</TabText>
</Tab>
))}
</TabScroller>
</TabBar>
</Example>
);
export default TabBars;
|