VOOZH about

URL: https://www.geeksforgeeks.org/reactjs/reactjs-ui-ant-design-pageheader-component/

⇱ ReactJS UI Ant Design PageHeader Component - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

ReactJS UI Ant Design PageHeader Component

Last Updated : 7 Mar, 2024

Ant Design Library has this component pre-built, and it is very easy to integrate as well. PageHeader Component is a header with common actions and design elements that are built-in. We can use the following approach in ReactJS to use the Ant Design PageHeader Component.

Syntax:
<PageHeader
 onBack={() => {
 // Action on click
 }}
 title=""
 subTitle=" "
 className=" "
/>

PageHeader Props:

  • avatar: It is the avatar that is just next to the title bar.
  • backIcon: It is the custom back icon.
  • breadcrumb: It is used to pass the breadcrumb configuration.  
  • breadcrumbRender: It is used to customize the content of breadcrumb area.
  • extra: It is the operating area that is placed just at the end of the line of title line
  • footer: It is the PageHeader footer, and it is used to render TabBar generally.
  • ghost: It is the PageHeader type, and it is used to change the background color.
  • subTitle: It is used to denote the custom text for the subtitle.
  • tags: It is used to denote the tag list which is just next to the title
  • title: It is used to denote the custom text for the title.
  • onBack: It is a callback that is triggered with the click of the Back icon.

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. folder name, 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.

👁 Image
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.

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:

👁 Image
Comment
Article Tags: