Flutter docs
Default skin

Tabs

Tabs make it easy to explore and switch between different views.

When to use

There are 3 types of Tabs, for different situations.

  • Card Tabs: for managing too many closeable views.
  • Normal Tabs: for functional aspects of a page.
  • Radio.Button: for secondary tabs.

Examples

Basic

Default activate first tab.

Disabled

Disabled a tab.

Centered

Centered tabs.

Icon

The Tab with Icon. icon also accepts a bare <svg> element from a third-party icon library, which stays vertically centred with the label.

Indicator

Set indicator prop to custom indicator size and align.

Slide

In order to fit in more tabs, they can slide left and right (or up and down).

Extra content

You can add extra actions to the right or left or even both side of Tabs.

Size

Large size tabs are usually used in page header, and small size could be used in Modal.

Placement

Tab's placement: start, end, top or bottom. Will auto switch to top in mobile.

Custom Popup Search

Customize the Tabs more dropdown menu via popupRender prop, supporting search and keyboard navigation.

Card type tab

Another type of Tabs, which doesn't support vertical mode.

Add & close tab

Only card type Tabs support adding & closable. Use closable={false} to disable close.

Customized trigger of new tab

Hide default plus icon, and bind event for customized trigger.

Customized bar of tab

Use react-sticky-box and renderTabBar.

Draggable Tabs

Use dnd-kit to make tabs draggable.

Custom semantic dom styling

You can customize the semantic dom style of Tabs by passing objects/functions through classNames and styles.

API

Tabs and its props are exported from @ceebee/ui/client.

Tabs

PropertyDescriptionTypeDefaultVersion
activeKeyCurrent TabPane's keystring-—
addIconCustomize add icon, only works with type="editable-card"ReactNode<PlusOutlined />4.4.0
animatedWhether to change tabs with animation.boolean | { inkBar: boolean, tabPane: boolean }{ inkBar: true, tabPane: false }—
centeredCenters tabsbooleanfalse4.4.0
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-—
defaultActiveKeyInitial active TabPane's key, if activeKey is not setstringThe key of first tab—
hideAddHide plus icon or not. Only works while type="editable-card"booleanfalse—
indicatorCustomize size and align of indicator{ size?: number | (origin: number) => number; align: start | center | end; }-5.13.0
itemsConfigure tab contentTabItemType[]4.23.0
moreCustomize the collapse menuMoreProps{ icon: <EllipsisOutlined /> , trigger: 'hover' }—
removeIconThe custom icon of remove, only works with type="editable-card"ReactNode<CloseOutlined />5.15.0
popupClassNameclassName for more dropdown, please use classNames.popup insteadstring-4.21.0
renderTabBarReplace the TabBar(props: DefaultTabBarProps, DefaultTabBar: React.ComponentClass) => React.ReactElement-—
sizePreset tab bar sizelarge | medium | smallmedium—
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-—
tabBarExtraContentExtra content in tab barReactNode | {left?: ReactNode, right?: ReactNode}-object: 4.6.0
tabBarGutterThe gap between tabsnumber-—
tabBarStyleTab bar style objectCSSProperties-—
tabPlacementPlacement of tabstop | end | bottom | starttop—
tabPositionPosition of tabstop | right | bottom | left, please use tabPlacement insteadtop—
destroyInactiveTabPaneWhether destroy inactive TabPane when change tab, use destroyOnHidden insteadbooleanfalse—
destroyOnHiddenWhether destroy inactive TabPane when change tabbooleanfalse5.25.0
typeBasic style of tabsline | card | editable-cardline—
onChangeCallback executed when active tab is changed(activeKey: string) => void-—
onEditCallback executed when tab is added or removed. Only works while type="editable-card"(action === 'add' ? event : targetKey, action) => void-—
onTabClickCallback executed when tab is clicked(key: string, event: MouseEvent) => void-—
onTabScrollTrigger when tab scroll({ direction: left | right | top | bottom }) => void-4.3.0

TabItemType

PropertyDescriptionTypeDefaultVersion
closeIconCustomize close icon in TabPane's head. Only works while type="editable-card". 5.7.0: close button will be hidden when setting to null or falseReactNode-—
destroyInactiveTabPaneWhether destroy inactive TabPane when change tab, use destroyOnHidden insteadbooleanfalse5.11.0
destroyOnHiddenWhether destroy inactive TabPane when change tabbooleanfalse5.25.0
disabledSet TabPane disabledbooleanfalse—
forceRenderForced render of content in tabs, not lazy render after clicking on tabsbooleanfalse—
keyTabPane's keystring-—
labelTab header text elementReactNode-—
iconTab header icon elementReactNode-5.12.0
childrenTab content elementReactNode-—
closableWhether a close (x) button is visible, Only works while type="editable-card"booleantrue—

MoreProps

PropertyDescriptionTypeDefaultVersion
iconThe custom iconReactNode-—
popupRenderCustomize the dropdown menu render(menu: ReactElement, info: { restTabs: Tab[], onClose: () => void }) => ReactElement-6.6.0
DropdownPropsSupport other Dropdown props———