Thursday, October 9, 2025
HomeLanguagesReactJS UI Ant Design List Component

ReactJS UI Ant Design List Component

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 the required module using the following command:

    npm install antd

Project Structure: It will look like the following.

Project Structure

Example: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.

App.js




import React from 'react'
import "antd/dist/antd.css";
import { List } from 'antd';
  
export default function App() {
  return (
    <div style={{
      display: 'block', width: 700, padding: 30
    }}>
      <h4>ReactJS Ant-Design List Component</h4>
      <List
        header={<div>Sample HEADER</div>}
        footer={<div>Sample FOOTER</div>}
        bordered
        dataSource={[
          'Sample Line 1',
          'Sample Line 2',
          'Sample Line 3',
          'Sample Line 4',
        ]}
        renderItem={item => (
          <List.Item>
            {item}
          </List.Item>
        )}
      />
    </div>
  );
}


Step to Run Application: Run the application using the following command from the root directory of the project:

npm start

Output: Now open your browser and go to http://localhost:3000/, you will see the following output:

Reference: https://ant.design/components/list/

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32347 POSTS0 COMMENTS
Milvus
87 POSTS0 COMMENTS
Nango Kala
6715 POSTS0 COMMENTS
Nicole Veronica
11878 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11941 POSTS0 COMMENTS
Shaida Kate Naidoo
6837 POSTS0 COMMENTS
Ted Musemwa
7095 POSTS0 COMMENTS
Thapelo Manthata
6791 POSTS0 COMMENTS
Umr Jansen
6791 POSTS0 COMMENTS