Skip to main content

Tabs

This is the <Tabs /> component


Examples

tab 1
tab 2tab 3
Tab content 1
Content 2
Content 3
<Tabs
onTabChange={(i) => {
console.log('Current Tab', i)
}}
>
<Tab
label="tab 1"
onClick={(i) => {
console.log('Action on single tab click', i)
}}
>
Tab content 1
</Tab>
<Tab label="tab 2">Content 2</Tab>
<Tab label="tab 3">Content 3</Tab>
</Tabs>

Basic Usage

import Tabs, { Tab } from '@candy/kitkat/snackbar'

export const MyComponent = () => (
<Tabs>
<Tab label="Tab label 1">Tab 1 content here</Tab>
<Tab label="Tab label 2">Tab 2 content here</Tab>
</Tabs>
)

Tabs Props

NameTypeDefaultDescription
childrenReactElement | ReactElement[]Content for inside of tab panels
direction?column | rowrowHorizontal or Vertical Tabs,
onTabChange?(i: number) => void--

Tab Props

NameTypeDefaultDescription
labelstring | ReactNodeLabel for Tab Panel
onTabChange?(i: number) => void--Action when single tab is clicked