Thursday, October 2, 2025
HomeLanguagesReactJS UI Ant Design PageHeader Component

ReactJS UI Ant Design PageHeader Component

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.

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 { PageHeader } from 'antd';
  
export default function App() {
  
  return (
    <div style={{ display: 'block', width: 700, padding: 30 }}>
      <h4>ReactJS Ant-Design PageHeader Component</h4>
      <PageHeader
        onBack={() => {
          console.log("Action you can perform on Click on Back button")
        }}
        title="neveropen"
        subTitle="Greetings from neveropen"
        className="site-page-header"
      />
    </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/page-header/

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!
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32331 POSTS0 COMMENTS
Milvus
85 POSTS0 COMMENTS
Nango Kala
6703 POSTS0 COMMENTS
Nicole Veronica
11867 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11927 POSTS0 COMMENTS
Shaida Kate Naidoo
6818 POSTS0 COMMENTS
Ted Musemwa
7079 POSTS0 COMMENTS
Thapelo Manthata
6775 POSTS0 COMMENTS
Umr Jansen
6776 POSTS0 COMMENTS