
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
create-react-nav
Advanced tools
Create your react app menu bar more easily with create-react-nav
create-react-navcreate-react-navUse the package manager npm to install create-react-nav.
npm install create-react-nav
import Navbar from "create-react-nav";
const links = [
[ "...ROUTER_PATH..." , "...PAGE_NAME..." , ...COMPONENT_NAME... ],
[ "...ROUTER_PATH..." , "...PAGE_NAME..." , ...COMPONENT_NAME... ]
];
<Navbar routes={links}/>
Note : Leave the PAGE_NAME empty not to add the route to navbar
<Navbar triggerIcon="light" routes={links} />
Note : You Can Use Your Own Custom Icon By Adding The Source
<Navbar logoImg="...SOURCE_PATH_OF_YOUR_LOGO..." routes={links} />
<Navbar logoTxt="...USE_ANY_TEXT_AS_LOGO..." routes={links} />
| Api | Type | Description |
|---|---|---|
| routes | Array of multiple Arrays | Required three properties first one is the route path, second one is the title for the page and third one is the component |
| triggerIcon | String | trigger icon for the navigaton bar (mobile device) |
| logoImg | String | Source link of your logo |
| logoTxt | String | Text logo which basically refers your website name |
| yToggle | String | boolean as string to toggle the nav by y axis |
| Class Name | Description |
|---|---|
| .Navbar | Style of the navigation bar |
| .Appbar | Style of the app bar in mobile mode |
| a.NavItems | Style of all the links (Don't need to use '!important') |
| a.selected | Style Of the active navigation link (Don't need to use '!important') |
| .Appbar span | Style of Text logo |
| .selected::after | Style of active page indicator (For Desktop mode) |
| .NavItems::after | Style of all page indicator |
Basically the ".NavItems::after" has 0% of width. When you click on a Nav we add "selected" class and then it's got 100% width and you see the indicator is apearing.
Note :
- You may have to use "!important" keyword for most of the style attributes.
- To change the style for mobile screen use max-width to 700px.
.Navbar {
background-color: white !important;
}
.NavItems::after {
background-color: red !important;
}
@media only screen and (max-width: 700px) {
.selected {
color: white !important;
background-color: red !important;
}
}
import { navigation } from "create-react-nav";
const history = navigation.useHistory()
import { useHistory } from "react-router-dom";
const history = useHistory()
import React from "react";
import Home from "./files/home";
import About from "./files/about";
import Navbar from "create-react-nav";
const App = () => {
const links = [
["/", "Home", Home],
["/about", "About", About],
];
return <Navbar logoTxt="hello" yToggle="true" routes={links} />;
};
export default App;
Note : Place the Navbar component where you want to do page routing.
FAQs
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.