JGuang

List

List · Arco Design

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

List

The most basic list display, which can carry text/pictures/paragraphs, and is often used in the data display page.

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: List can carry text, pictures, and paragraphs, and is often used to display data.
  • Size: There are three sizes (small default large) that you can select according to your need.
  • With Meta: Use List.Item.Meta to quickly specify avatar, title, and text.
  • With Actions: Use actions to add operation items to the list.
  • Vertical List: This is an example including paging, content on the right, and list operations.
  • Grid List: Use grid.span to set the number of columns expected to occupy.
  • Responsive List Grid: Dynamically set the number of columns occupied by each item through parameters such as grid.sm. Be careful not to set grid.span at this time.
  • Scroll Loading: You can set onReachBottom to dynamically loading data when the list is scrolling. If onReachBottom cannot meet the requirements, you can customize the list scrolling monitor function through onListScroll, at this time the default monitor function will be invalid.
  • Infinite List: By specifying virtualListProps to turn on the virtual list, high performance can be obtained when a large amount of data is used. When using a virtual list, if the height of the list items varies greatly, it may cause blank space in the viewport when scrolling, which can be solved by setting virtualListProps.itemHeight. itemHeight is used to calculate the actual number of DOM nodes that need to be rendered (viewportHeight / itemHeight). The smaller the value, the more DOM nodes actually rendered, and the performance overhead will increase. Because the virtual list uses the ref of ListItem internally, if you return a custom function component through render, please use React.forwardRef to wrap it.

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

List

PropertyDescriptionTypeDefaultValueVersion
borderedWhether to render borderbooleantrue-
hoverableWhether list items have hover styleboolean-2.9.0
loadingWhether to show a loading indicator while the contents of the list are being fetchedboolean--
splitWhether to render the split under the list itembooleantrue-
defaultCurrentTo set default current pagenumber1-
offsetBottomThe distance threshold to trigger the onReachBottomnumber0-
throttleDelayInterval of throttle for onListScrollnumber500-
sizeSize of List'small' | 'default' | 'large'--
childrenChild element of List. when dataSource and render exist, do not use this parameterReactNode--
footerList footerReactNode--
headerList headerReactNode--
noDataElementContent displayed when there is no dataReactNode--
scrollLoadingSet the content to be at the list bottom when you load data during scrollingstring | ReactNode--
classNameAdditional css classstring | string[]--
dataSourceData source for list rendering. When children exist, this parameter can be omitted (dataSource has higher priority)T[]--
gridThe grid type of listListGridProps-column in 2.20.0
listRefReference to the current listMutableRefObject<ListHandle>-2.20.0
paginationWhether to divide into pages, you can also pass in the configuration of Paginationboolean | PaginationProps--
styleAdditional styleCSSProperties--
virtualListPropsPass the virtual-list properties, pass in this parameter to turn on virtual scrollingAvailableVirtualListProps-2.11.0
wrapperClassNameThe additional css class to wrapper elementstring | string[]--
wrapperStyleThe additional css style to wrapper elementCSSProperties--
onListScrollCallback when list is scrolling. When onReachBottom cannot meet your usage, can customize scroll monitor function(elem: Element) => void--
onReachBottomCallback when the list scroll to the bottom(currentPage: number) => void--
renderCustomize list item when using dataSource(item: T, index: number) => ReactNode--

List.Item

PropertyDescriptionTypeDefaultValue
actionLayoutThe position of the list operation group. horizontal - right, vertical - below.'horizontal' | 'vertical'horizontal
extraThe extra content of list item which is on the far rightReactNode-
actionsThe list operation group of list itemReactNode[]-
classNameAdditional css classstring | string[]-
styleAdditional styleCSSProperties-

List.Item.Meta

PropertyDescriptionTypeDefaultValue
avatarThe avatar of list itemReactNode-
descriptionThe description of list itemReactNode-
titleThe title of list itemReactNode-
classNameAdditional css classstring | string[]-
styleAdditional styleCSSProperties-

ListGridProps

type ListGridProps = {
  column?: number;
} & Pick<RowProps, "gutter" | "justify" | "align"> &
  Pick<
    ColProps,
    "span" | "offset" | "order" | "pull" | "push" | GridResponsiveBreakpoint
  >;

ListHandle

export type ListHandle = {
  dom: HTMLDivElement;
  scrollIntoView: (index: number) => void;
};

AvailableVirtualListProps

export type AvailableVirtualListProps = Pick<
  VirtualListProps<any>,
  | "height"
  | "itemHeight"
  | "threshold"
  | "isStaticItemHeight"
  | "scrollOptions"
  | "onScroll"
  | "wrapperChild"
>;

<ListGridProps>

PropertyDescriptionTypeDefault
gutterSpacing between gridsnumber-
spanRaster number of cells to occupynumber-
xsspan for xsnumber-
smspan for smnumber-
mdspan for mdnumber-
lgspan for lgnumber-
xlspan for xlnumber-
xxlspan for xxlnumber-

VirtualListProps

PropertyDescriptionTypeDefault
heightViewable area height (2.11.0 starts to support string type such as 80%)number200
thresholdThe threshold of the number of elements that automatically enable virtual scrolling, pass in null to disable virtual scrolling.number | null100
isStaticItemHeightWhether it is a static element of the same heightbooleantrue