Open In App

React Desktop Windows NavPane Component

React Desktop is a popular library to bring the native desktop experience to the web. This library provides macOS and Windows OS components. NavPane Component is used to allow the users to easily navigate between elements as it is a Navigation Pane. We can use the following approach in ReactJS to use the React Desktop Windows NavPane Component.

NavPane Props:



NavPaneItem Props:

Creating React Application And Installing Module:



Step 3: After creating the ReactJS application, Install the required module using the following command:

npm install react-desktop

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.




import React from 'react'
import { NavPane, NavPaneItem } from 'react-desktop/windows';
  
export default function App() {
  return (
    <div style={{
      display: 'block', width: 700, paddingLeft: 30
    }}>
      <h4>React Desktop Windows NavPane Component</h4>
      <NavPane push>
        <NavPaneItem
          title="Item One"
          push
        >
        NavItem One
        </NavPaneItem>
        <NavPaneItem
          title="Item Two"
          push>
          NavItem Two
        </NavPaneItem>
        <NavPaneItem
          title="Item Three"
          push>
          NavItem Three
        </NavPaneItem>
      </NavPane>
    </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: http://reactdesktop.js.org/docs/windows/nav-pane


Article Tags :