JGuang

CapsuleTabs

CapsuleTabs · Ant Design Mobile

Preview
npm install antd-mobile@5.43.0

CapsuleTabs

Navigate between content groups.

Install

npm install antd-mobile@5.43.0

antd-mobile is for mobile web, not React Native or Mini Programs. React 19 projects must register createRoot with unstableSetRender at the entry, or imperative APIs such as Toast and Dialog cannot render. Switch dark mode with <html data-prefers-color-scheme="dark">.

Examples come from the official Ant Design Mobile repository (MIT) at the commit published as npm 5.43.0. Presentation helpers such as DemoBlock are JGuang rewrites, not antd-mobile APIs.

Navigate between content groups.

When to Use

Another style for tabs, used in lists or modules in presentational interfaces.

Demos

CapsuleTabs

Props

NameDescriptionTypeDefault
activeKeyThe key of the currently active tab panelstring | null-
defaultActiveKeyThe initialized key of the selected panel, if the activeKey is not setstring | nullthe key of the 1st pannel
onChangeCallback when switching panel(key: string) => void-

CapsuleTabs.Tab

Props

NameDescriptionTypeDefault
destroyOnCloseDestroy dom when not visiblebooleanfalse
disabledWhether to disable the tabbooleanfalse
forceRenderWhether to render the DOM structure when hiddenbooleanfalse
keyCorresponding to activeKeystring-
titleThe displayed text of the tab headerReactNode-

The usage of CapsuleTabs is very similar to that of Tabs, so see the documentation for Tabs for more usage guidelines.