Ant Design Library has this component pre-built, and it is very easy to integrate as well. List Component is used to display a simple list to the user, and it can be used to display content related to a single subject. We can use the following approach in ReactJS to use the Ant Design List Component.
List Props:
bordered: It is used to toggle the rendering of the border around the list.
dataSource: It is used to denote the DataSource array for the list.
footer: It is used for the List footer renderer.
grid: It is used to denote the grid type of list.
header: It is used for the List header renderer.
itemLayout: It is used to denote the layout of the list.
loading: It is used to show a loading indicator while the contents of the list are being fetched.
loadMore: It is used to show a load more content.
locale: It is the i18n text including empty text.
pagination: It is used to define the Pagination config.
renderItem: It is used to customize list items when using the dataSource.
rowKey: It is used to denote the Item's unique key.
size: It is used to denote the size of the list.
split: It is used to toggle the rendering of the split under the list item.
Pagination Props:
position: It is used to specify the position of Pagination.
List grid Props:
column: It is used to denote the column of the grid.
gutter: It is used to denote the spacing between the grid.
xs: It is used for <576px column of the grid.
sm: It is used for ≥576px column of the grid.
md: It is used for ≥768px column of the grid.
lg: It is used for ≥992px column of the grid.
xl: It is used for ≥1200px column of the grid.
xxl: It is used for ≥1600px column of the grid.
List.Item Props:
actions: It is used to denote the action content of the list items.
extra: It is used to denote the extra content of the list item.
List.Item.Meta Props:
avatar: It is used to denote the avatar of the list item
description: It is used to denote the description of the list item.
title: It is used to denote the title of the list item.
Creating React Application And Installing Module:
Step 1: Create a React application using the following command:
npx create-react-app foldername
Step 2: After creating your project folder i.e. foldername, move to it using the following command:
cd foldername
Step 3: After creating the ReactJS application, Install therequiredmodule using the following command:
npm install antd
Project Structure: It will look like the following.