JGuang

List

List · Ant Design Mobile

Preview
npm install antd-mobile@5.43.0

List

Generic list.

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.

Generic list.

When to Use

Carry text, lists, pictures, paragraphs, etc. cleanly and efficiently in the form of a list.

Demos

List

Props

NameDescriptionTypeDefault
headerThe title of list.ReactNode-
modeSupport two modes: default and card.'default' | 'card''default'

CSS Variables

NameDescriptionDefault
--active-background-colorThe background color when clicked.var(--adm-border-color)
--align-itemsThe align-item of the list itemcenter
--border-bottomBorder style of the list bottomsolid 1px var(--adm-border-color)
--border-innerBorder style of the list item bottomsolid 1px var(--adm-border-color)
--border-topBorder style of the list topsolid 1px var(--adm-border-color)
--extra-max-widthThe max width of the extra part70%
--font-sizeThe font-size of the list body17px
--header-font-sizeThe font-size of the header15px
--padding-leftThe padding-left of list item and header12px
--padding-rightThe padding-right of list item and header12px
--prefix-padding-rightThe padding-right of the prefix part12px
--prefix-widthWidth of the prefix part.auto

Ref

NameDescriptionType
nativeElementNative div elementHTMLDivElement | null

List.Item

Props

NameDescriptionTypeDefault
arrowIconWhether to show the arrow icon on the right side, also supports passing ReactNode to customize the icon.boolean | ReactNodesame as clickable
childrenThe main content area in the middle of the list item.ReactNode-
clickableWhether to show click effect.booleanDefaults to true when the onClick prop is present, otherwise defaults to false
descriptionThe description area in the lower middle of the list item.ReactNode-
disabledIs the list item disabledbooleanfalse
extraThe right area of the list item.ReactNode-
onClickThe click event of the list item. When the onClick property is set, the list item will have click effect.(e: React.MouseEvent) => void-
prefixThe left area of the list item.ReactNode-
titleThe title area in the upper middle of the list item.ReactNode-

CSS Variables

Support following css variables in List: --prefix-width, --active-background-color and --align-items

FAQ

Whether to support virtualized list?

List will not support virtualized list, you can implement it via using react-virtualized.

Whether to support drag and drop the sorting?

List will not support Drag and drop the sorting, you can implement it via using react-beautiful-dnd.