DEV Community

Cover image for How To Get Started with a Navigation bar in Your React Project in 2 mins
Hrushi M
Hrushi M

Posted on • Edited on • Originally published at blog.superflows.dev

How To Get Started with a Navigation bar in Your React Project in 2 mins

What is a navigation bar?

Navigation bar is arguably the most important component of your website or web app. It anchors the users to your website. It allows them to effortlessly traverse through the website. It also contextualises the application to the user, mentions the subscription status, next action to be taken, etc.

This article shows you how to add a navigation bar to your React project in 2 minutes.

Prerequisites

I am assuming that the reader could be a React beginner. But familiarity with basic React concepts is necessary. If you are an absolute novice at React, this tutorial, could help you get started with React. Post which, come back to this article.

Step 1 - Install the Superflows navigation bar library

Superflows is a React library that provides reusable and customisable components. In this article, we use the navigation bar provided by Superflows.

Install it as follows:

npm install --save react-sf-themes
npm install --save react-sf-building-blocks

Enter fullscreen mode Exit fullscreen mode

Step 2 - Import and Usage

After installation is successful, import and use the navigation bar component, called SfNav, in your project as shown below.

import { SfNav } from 'react-sf-building-blocks';
Enter fullscreen mode Exit fullscreen mode
return (
    <div>
      <SfNav stylesContainerDesktop={{ fontFamily: 'Georgia' }} />
      {/* Your Code */}
    </div>
  );
Enter fullscreen mode Exit fullscreen mode

It will render as follows:

Default navbar desktop

Default navbar mobile

Video Tutorial

Reference Links

Further Reading

You can learn further navigation bar functionality by reading subsequent articles of this series.

Conclusion

This article gets you started with a navigation bar in your React project. It shows you how to integrate the Superflows library and setup the default navigation bar.

Top comments (0)