JGuang

List

List · Ant Design

Preview
npm install antd@6.6.5 @ant-design/icons@6.3.4 dayjs@1.11.23

List

Basic list display, which can carry text, lists, pictures, paragraphs.

When To Use

A list can be used to display content related to a single subject. The content can consist of multiple elements of varying type and size.

:::warning{title=Deprecated Notice} List component has been deprecated. Will be removed in the next major version. Please use Listy instead. See How do I migrate off List?. :::

Examples

  • Simple list · simple

  • Basic list · basic

  • Load more · loadmore

  • Vertical · vertical

  • Pagination Settings · pagination

  • Grid · grid

  • Responsive grid list · responsive

  • Scrolling loaded · infinite-load

  • Drag sorting · drag-sorting

  • Drag sorting with handler · drag-sorting-handler

  • Grid Drag sorting · grid-drag-sorting

  • Grid Drag sorting with handler · grid-drag-sorting-handler

  • virtual list · virtual-list

API

Common props ref:Common props

List

PropertyDescriptionTypeDefaultVersionGlobal Config
borderedToggles rendering of the border around the listbooleanfalse×
dataSourceDataSource array for listany[]-×
footerList footer rendererReactNode-×
gridThe grid type of list. You can set grid to something like {gutter: 16, column: 4}object-×
headerList header rendererReactNode-×
itemLayoutThe layout of listhorizontal | verticalhorizontal×
loadingShows a loading indicator while the contents of the list are being fetchedboolean | SpinProps (more)false×
loadMoreShows a load more contentReactNode-×
localeThe i18n text including empty textobject{emptyText: No Data}×
paginationPagination config, hide it by setting it to falseboolean | objectfalse×
renderItemCustomize list item when using dataSource(item: T, index: number) => ReactNode-×
rowKeyItem's unique value, could be an Item's key which holds a unique value of type React.Key or function that receives Item and returns a React.Keykeyof T | (item: T) => React.Key"key"×
sizeSize of listdefault | large | smalldefault×
splitToggles rendering of the split under the list itembooleantrue×

pagination

Properties for pagination.

PropertyDescriptionTypeDefault
positionThe specify the position of Paginationtop | bottom | bothbottom
alignThe specify the alignment of Paginationstart | center | endend

More about pagination, please check Pagination.

List grid props

PropertyDescriptionTypeDefaultVersion
columnThe column of gridnumber-
gutterThe spacing between gridnumber0
xs<576px column of gridnumber-
sm≥576px column of gridnumber-
md≥768px column of gridnumber-
lg≥992px column of gridnumber-
xl≥1200px column of gridnumber-
xxl≥1600px column of gridnumber-
xxxl≥1920px column of gridnumber-6.3.0

List.Item

PropertyDescriptionTypeDefaultVersionGlobal Config
actionsThe actions content of list item. If itemLayout is vertical, shows the content on bottom, otherwise shows content on the far rightArray<ReactNode>-×
classNamesSemantic structure classNameRecord<actions | extra, string>-5.18.05.18.0
extraThe extra content of list item. If itemLayout is vertical, shows the content on right, otherwise shows content on the far rightReactNode-×
stylesSemantic DOM styleRecord<actions | extra, CSSProperties>-5.18.05.18.0

List.Item.Meta

PropertyDescriptionTypeDefaultVersion
avatarThe avatar of list itemReactNode-
descriptionThe description of list itemReactNode-
titleThe title of list itemReactNode-

Semantic DOM

Semantic nodeNative descriptionVersion
extraset extra of List.Item5.18.0
actionsset actions of List.Item5.18.0

Semantic description source: vendor/components/list/demo/_semantic.tsx

Design Token

Types, inheritance and declarations retain the pinned native source. Defaults are computed by the native theme and may be overridden by ConfigProvider; this table does not invent static defaults.

TokenTypeNative description
contentWidthnumber | stringWidth of content
itemPaddingLGstringPadding of large item
itemPaddingSMstringPadding of small item
itemPaddingstringPadding of item
headerBgstringBackground color of header
footerBgstringBackground color of footer
emptyTextPaddingCSSProperties['padding']Padding of empty text
metaMarginBottomCSSProperties['marginBottom']Margin bottom of meta
avatarMarginRightCSSProperties['marginRight']Right margin of avatar
titleMarginBottomCSSProperties['marginBottom']Margin bottom of title
descriptionFontSizenumberFont size of description

Declaration source: vendor/components/list/style/index.ts

import type { CSSProperties } from 'react';

import { unit } from '@ant-design/cssinjs';

import type { CSSObject } from '@ant-design/cssinjs';

import { resetComponent } from '../../style';

import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';

import { genStyleHooks, mergeToken } from '../../theme/internal';

export interface ComponentToken {
  /**
   * @desc 内容宽度
   * @descEN Width of content
   */
  contentWidth: number | string;
  /**
   * @desc 大号列表项内间距
   * @descEN Padding of large item
   */
  itemPaddingLG: string;
  /**
   * @desc 小号列表项内间距
   * @descEN Padding of small item
   */
  itemPaddingSM: string;
  /**
   * @desc 列表项内间距
   * @descEN Padding of item
   */
  itemPadding: string;
  /**
   * @desc 头部区域背景色
   * @descEN Background color of header
   */
  headerBg: string;
  /**
   * @desc 底部区域背景色
   * @descEN Background color of footer
   */
  footerBg: string;
  /**
   * @desc 空文本内边距
   * @descEN Padding of empty text
   */
  emptyTextPadding: CSSProperties['padding'];
  /**
   * @desc Meta 下间距
   * @descEN Margin bottom of meta
   */
  metaMarginBottom: CSSProperties['marginBottom'];
  /**
   * @desc 头像右间距
   * @descEN Right margin of avatar
   */
  avatarMarginRight: CSSProperties['marginRight'];
  /**
   * @desc 标题下间距
   * @descEN Margin bottom of title
   */
  titleMarginBottom: CSSProperties['marginBottom'];
  /**
   * @desc 描述文字大小
   * @descEN Font size of description
   */
  descriptionFontSize: number;
}

/**
 * @desc List 组件的 Token
 * @descEN Token for List component
 */
interface ListToken extends FullToken<'List'> {
  /**
   * @desc 列表项类名
   * @descEN Class name of list item
   */
  listBorderedCls: string;
  /**
   * @desc 最小高度
   * @descEN Minimum height
   */
  minHeight: number | string;
}

FAQ

Is there a replacement for the deprecated List component?

Yes — please use Listy, available since antd@6.6.0. It is the successor to List, with built-in capabilities such as virtual scrolling, sticky group headers and programmatic scrolling. It also supports flexible custom rendering, aiming to cover list needs across different scenarios.

How do I migrate off List?

Lists take different shapes in different scenarios, so it is hard to give a one-to-one migration guide. Thanks to the custom rendering capability of Listy, the preset structures in List can now be recomposed with plain JSX inside itemRender.

The mapping is as follows:

  • Data and rendering: dataSource maps to items, renderItem maps to itemRender; rowKey keeps its meaning but is required in Listy and no longer defaults to the key field — pass rowKey="key" explicitly if you relied on the default. For large datasets, no third-party dependency is needed — turn on virtual with a height to get virtual scrolling.
  • Preset structures inside a row: List.Item, List.Item.Meta, actions, extra can all be recomposed inside itemRender.
  • Structures outside the list: put header and footer around Listy directly, wrap the list with Spin for loading, slice the data yourself and pass it to items together with Pagination for pagination, and see the infinite loading demo for loadMore.
  • Styles: adjust bordered, split and size through semantic DOM classNames / styles and Design Token; for grid, migrating to Listy is not recommended — use Row / Col with Card to build the card layout instead.

Shared native props

Tips: The following generic properties apply to most antd components; those not supported are described separately.

PropertyDescriptionTypeDefault
styleThe additional styleCSSProperties-
classNameThe additional css classstring-
rootClassNameClassName on the root elementstring-
autoFocusAuto focus when component mounted, only effective for focusable elements like forms, links, etc.booleanfalse

Install and reproduce an example

npm install antd@6.6.5 @ant-design/icons@6.3.4 dayjs@1.11.23

Use ConfigProvider and native App; configure dayjs locale separately. Each example lists its complete source files and additional pinned dependencies in View code. Example names select demos, not universal component props. See the resource setup guide for theme, locale and SSR.

Native type references

The source viewer includes unchanged native implementations and the following source declarations. Inherited types remain in their native packages. English source comments are preserved as code reference.

  • vendor/components/list/Item.tsx
  • vendor/components/list/context.ts
  • vendor/components/list/index.tsx
  • vendor/components/list/style/index.ts

Source and license

https://github.com/ant-design/ant-design/tree/4a39f54842eade4e565ab336ef6097cd7e723cdd

Original bilingual prose and executable examples are retained. Website-only embeds and token tables are expanded locally. Ant Design is MIT; separately listed dependency notices also apply. Upload previews block outbound requests and do not provide a backend.