JGuang

Tabs

Tabs · Arco Design

Preview
npm install @arco-design/web-react@2.66.18

Tabs

Organize content in the same view, and view content one view at a time. You can switch tabs to view other content.

Install

npm install @arco-design/web-react@2.66.18

Import @arco-design/web-react/dist/css/arco.css at the entry and set the locale with ConfigProvider. React 19 projects must also import @arco-design/web-react/es/_util/react-19-adapter first, or imperative APIs such as Message and Modal cannot render.

Examples

  • Basic: Basic usage example.
  • Icon: You can add an icon to the tab through a custom title.
  • Position: Set the position of tabs by tabPosition.
  • Type: Use type to set the type of the tab.
  • Extra Content: You can add extra content on the right side of the tabs through extra.
  • Dynamic Tab: Dynamically add or subtract tabs. Only effective when type=card | card-gutter.
  • Controlled: Open the controlled mode through activeTab.
  • Nested: Components can be nested.
  • Size: Use Size to set the size of the tab.
  • Scrollable: Support scrolling operation via scroll wheel or touch pad.
  • The active tab's scroll position: Support scrolling operation via scroll wheel or touch pad.

Examples come from the official Arco Design repository (MIT) at the commit published as npm 2.66.18. Some use online images or upload endpoints; network requests are disabled in previews.

API

Tabs

PropertyDescriptionTypeDefaultValueVersion
destroyOnHideWhether to destroy the DOM structure in the TabPane when the tab is hidden. This attribute of TabPane has higher priority than Tabs.boolean--
editableWhether to allow adding or subtracting tabs. It only effect when type is card or card-gutter.boolean--
headerPaddingWhether there is a horizontal margin on the tab. It only effect when type is line or textbooleantrue2.6.0
justifyHeight to fill the container, Only effective in horizontal mode.boolean--
lazyloadWhen set to true, hidden tabs will not be rendered when the component is mounted.booleantrue-
showAddButtonWhether to show the new button(Only effect when editable is true)booleantrue-
activeTabThe key of the currently selected tabstring--
defaultActiveTabThe Tab selected by default. If not specified, the first one is selectedstring--
directionThe Direction of tabs. ** Warn: Please use tabPosition instead.**'horizontal' | 'vertical'--
inkBarSizecustom the size of underline{ width?: CSSProperties['width']; height?: CSSProperties['height'] }-2.54.0
overflowWhen there are too many tabs, select scroll or drop-down to display tabs'scroll' | 'dropdown'scroll-
scrollPositionThe scroll position of the selected tab, the default auto will scroll the activeTab to the visible area, but will not adjust the position intentionally'start' | 'end' | 'center' | 'auto' | numberauto2.25.0
sizeSize of tabs'mini' | 'small' | 'default' | 'large'--
tabPositionPosition of tabs'left' | 'right' | 'top' | 'bottom'top-
typeType of tabs'line' | 'card' | 'card-gutter' | 'text' | 'rounded' | 'capsule'line-
addButtonCustom add buttonReactNode-2.16.0
deleteButtonCustom delete buttonReactNode-2.16.0
extraAdditional on the right side of the tabReactNode--
animationWhether to turn on the transition animationboolean | { tabPane?: boolean; inkBar?: boolean }--
classNameAdditional css classstring | string[]--
iconsTab header edit/scroll/dropdown icon configuration. You can set it to null for icons you don't want to display{add?: ReactNode;delete?: ReactNode;prev?: ReactNode;next?: ReactNode;dropdown?: ReactNode;}-2.15.0, prev,next,dropdown in 2.47.0
scrollAfterEditWhether to automatically scroll to the selected label after the label is dynamically increased or decreased (only effective when editable is true){delete?: boolean;add?: boolean;}{ add: true, delete: true }2.25.0
styleAdditional styleCSSProperties--
onAddTabCallback when click Add Button() => void--
onChangeCallback when activeTab changed(key: string) => void--
onClickTabCallback when click Tab(key: string) => void--
onDeleteTabCallback when click Delete Button(key: string) => void--
renderTabHeaderCustom Tab Header(tabProps: TabsProps, DefaultTabHeader: typeof TabHeader) => ReactElement--
renderTabTitleCustomize tab header(tabTitle: ReactNode,info: {key: string | number;isActive: boolean;disabled: boolean;editable: boolean;}) => ReactNode--

Tabs.TabPane

PropertyDescriptionTypeDefaultValue
closableWhether to allow the tab to be closed when editable="true"boolean-
destroyOnHideWhether to destroy the DOM structure in the TabPane when the tab is hidden.This option has priority over the destroyOnHide property of Tabsboolean-
disabledWhether the TabPane is disabledboolean-
titleThe title of Tabstring | ReactNode (Required)-
classNameAdditional css classstring | string[]-
styleAdditional styleCSSProperties-