Tab Selector React component. Useful when you want to have a tabbed page and you want to display different categories in each tab.
-
Inside your project, run
npm install --save react-tab-selector
. -
Use the component:
import { TabSelector } from 'react-tab-selector';
const MyComponent = () => {
return <div>
<TabSelector
tabs={[
{
title: 'All',
onClick: () => alert('Clicked All')
},
{
title: 'Gaming',
onClick: () => alert('Clicked Gaming')
},
{
title: 'Photography',
onClick: () => alert('Clicked Photography')
}
]}
/>
</div>
}
Prop | Description |
---|---|
tabs |
Takes an array of objects with the value pairs title and onClick .For example: [{ title: 'All', onClick: myCallback }] |
Here's what this example would look like:
- Run
npm run build
. - Verify files have changed with
git status
. - Run
npm publish
.