Open In App

ReactJS UI Ant Design Timeline Component

Timeline is used to display a series of information that needs to be ordered by time (ascending or descending).

Ant Design Library has this component pre-built, and it is very easy to integrate as well. We can use this Timeline component using the following approach easily.



Syntax:

<Timeline>
      <Timeline.Item>
         Content of the timeline
      </Timeline.Item>
</Timeline>

Timeline Property:



Timeline.Item Property:

Creating React Application and Installing Module:

Project Structure:

Example: Now write the following code in filename App.js.




import { Timeline } from "antd";
import "antd/dist/antd.css";
  
function App() {
  return (
    <div className="App">
      <div style={{ padding: "100px" }}>
        <h1 style={{ marginBottom: "2rem" }}>
          Demo for Timeline
        </h1>
        /* Time Creating */
        <Timeline>
          /* Timeline elements*/
          <Timeline.Item>
            Create a services site 2015-09-01
          </Timeline.Item>
          <Timeline.Item>
            Solve initial network problems 2015-09-01
          </Timeline.Item>
          <Timeline.Item>
            Technical testing 2015-09-01
          </Timeline.Item>
          <Timeline.Item>
            Network problems being solved 2015-09-01
          </Timeline.Item>
        </Timeline>
        ,
      </div>
    </div>
  );
}
  
export default App;

Running the application: Run the application by using the following command.

npm start

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

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


Article Tags :