JGuang

IndexBar

IndexBar · Ant Design Mobile

Preview
npm install antd-mobile@5.43.0

IndexBar

Arrange the content according to the letters A-Z.

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.

Arrange the content according to the letters A-Z.

When to Use

Category display and quick positioning for lists.

Demos

IndexBar

Props

NameDescriptionTypeDefault
onIndexChangeTrigger when the anchor point changed(index: string) => void-
stickyWhether to turn on the anchor point automatic ceilingbooleantrue

Ref

NameDescriptionType
scrollToScroll to the specified anchor point(index: string) => void

CSS Variables

NameDescriptionDefaultGlobal
--sticky-offset-topThe distance between the anchor point and the top when it is automatically ceiling0-

IndexBar.Panel

Props

NameDescriptionTypeDefault
briefThe brief title in the right sidebar.ReactNodeThe first character of index would be used by default.
indexUnique index.string-
titleThe panel title in the main area.ReactNodeindex would be used by default.