React Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. Nav Provides a list of various forms of navigation menus, which can be landscape and portrait layout.
Nav Vertical helps to create a Nav such that Nav items are placed in the vertical direction.
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 rsuite
Project Structure: It will look like the following:
Â
Example 1: Now write down the following code in the App.js file. Here, App is our default component where we have written our code. In this example, we will simply create a vertical Nav.
Javascript
import React, { useState } from 'react'; import 'rsuite/dist/rsuite.min.css'; import { Nav } from 'rsuite';   export default function App() {       return (         <div>             <h1 style={{ color: 'green' }}>                 neveropen             </h1>             <h3>React Suite Nav Vertical</h3>             <Nav vertical activeKey="home" >                 <Nav.Item eventKey="home" >                     Home                 </Nav.Item>                 <Nav.Item eventKey="news">                     News                 </Nav.Item>                 <Nav.Item eventKey="solutions">                     Solutions                 </Nav.Item>                 <Nav.Item eventKey="products">                     Products                 </Nav.Item>                 <Nav.Item eventKey="about">                     About                 </Nav.Item>             </Nav>         </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:
Â
Example 2: In this example, we will learn to create a Nav and use icons with Nav Items. Icons are taken from https://rsuitejs.com/resources/icons/
Javascript
import React, { useState } from 'react'; import 'rsuite/dist/rsuite.min.css'; import SendIcon from '@rsuite/icons/Send'; import SearchIcon from '@rsuite/icons/Search'; import TrashIcon from '@rsuite/icons/Trash'; import SettingIcon from '@rsuite/icons/Setting'; import ExploreIcon from '@rsuite/icons/Explore'; import { Nav } from 'rsuite';   export default function App() {       return (         <div>             <h1 style={{ color: 'green' }}>                 neveropen             </h1>             <h3>React Suite Nav Vertical</h3>             <Nav vertical activeKey="Explore" >                 <Nav.Item eventKey="Explore"                     icon={<ExploreIcon />} >                     Explore                 </Nav.Item>                 <Nav.Item eventKey="Search"                     icon={<SearchIcon />}>Search</Nav.Item>                 <Nav.Item eventKey="delete"                     icon={<TrashIcon />}>Delete</Nav.Item>                 <Nav.Item eventKey="send"                     icon={<SendIcon />}>Send</Nav.Item>                 <Nav.Item eventKey="settings"                     icon={<SettingIcon />}>Settings</Nav.Item>             </Nav>         </div>     ) } |
Ooutput:
Â
Reference: https://rsuitejs.com/components/nav/#vertical
