Tabs

Separates content into groups within a single context.

Tabs

To use the Tabs component, you will need to import it from the @kiwicom/orbit-components package:

import Tabs, { Tab, TabList, TabPanels, TabPanel } from "@kiwicom/orbit-components/lib/Tabs";

Once you have imported the Tabs component, you can use it in your React application:

<Tabs>
<TabList>
<Tab>Tab 1</Tab>
<Tab type="basic">Tab 2</Tab>
<Tab type="medium">Tab 3</Tab>
<Tab type="top">Tab 4</Tab>
</TabList>
<TabPanels>
<TabPanel>Tab 1 content</TabPanel>
<TabPanel>Tab 2 content</TabPanel>
<TabPanel>Tab 3 content</TabPanel>
<TabPanel>Tab 4 content</TabPanel>
</TabPanels>
</Tabs>

Tabs

Props

Table below contains all types of the props available in Tabs component.

NameTypeDefaultDescription
dataTeststringOptional prop for testing purposes.
defaultSelectednumber0Optional prop to set the initial active tab index. Use only if you do not want to control state on your side
childrenReact.nodeRequired prop that should contain the TabList, TabPanels components.
onChange(selectedIndex: number) => void \| Promise<void>Function for handling onChange. Use only if you do not want to control state on your side.

TabList

Table below contains all types of the props available in TabList component.

NameTypeDefaultDescription
dataTeststringOptional prop for testing purposes.
childrenReact.nodeRequired prop that should contain the Tab components.
compactbooleanfalseOptional prop that responsible for Tabsize, if provided, the Tabs will be smaller.
spacingenumnoneOptional prop to set gap between Tab elements
fullWidthbooleanfalseOptional prop to set TabList to full width.

Tab

Table below contains all types of the props available in Tab component.

You can choose how you would like to use the component. By default it’s using inner state to set active state on Tab. If you would like to control that behavior, you will need to provide active and onClick properties and handle the change on your side.

NameTypeDefaultDescription
dataTeststringOptional prop for testing purposes.
disabledbooleanOptional prop to set disabled state.
childrenReact.nodeRequired prop that should contain the Tab content.
typeenumdefaultOptional prop that responsible for Tab style.
activebooleanfalseOptional prop to have controlled behavior over active state.
onClickevent => void \| Promise<void>Function for handling onClick event.

TabPanels

Table below contains all types of the props available in TabPanel component.

NameTypeDefaultDescription
dataTeststringOptional prop for testing purposes.
childrenReact.nodeRequired prop that should contain the TabPanel components.

TabPanel

Table below contains all types of the props available in TabPanel component.

NameTypeDefaultDescription
dataTeststringOptional prop for testing purposes.
childrenReact.nodeRequired prop that should contain the TabPanel content.
marginstring \| number \| Object"0"Utility property to set margin.
paddingstring \| number \| Object"0"Utility property to set padding.
activebooleanfalseOptional prop to have controlled behavior over active state.

enum

enum

typespacing
defaultnone
basicXXXSmall
mediumXXSmall
topXSmall
small
medium
large
XLarge
XXLarge