PrimeReact
primereact.org › menubar
Menubar - React Navbar Component
Menubar also known as Navbar, is a horizontal menu component · import { Menubar } from 'primereact/menubar'; Menubar requires a collection of menuitems as its model. <Menubar model={items} /> Custom content can be placed inside the menubar ...
PrimeFaces
primefaces.org › primereact-v8 › menubar
PrimeReact | React UI Component Library
Menubar also known as Navbar, is a horizontal menu component. ... <script src="https://unpkg.com/primereact/core/core.min.js"></script> <script src="https://unpkg.com/primereact/menubar/menubar.min.js"></script>
Stack Overflow
stackoverflow.com › questions › 78574090 › change-styling-navbar-from-primereact
css - Change styling navbar from PrimeReact - Stack Overflow
import React from 'react'; import { Menubar } from 'primereact/menubar'; import { MenuItem } from 'primereact/menuitem'; import { Badge } from 'primereact/badge'; import 'primereact/resources/themes/saga-blue/theme.css'; // Theme import 'primereact/resources/primereact.min.css'; // Core import 'primeicons/primeicons.css'; // Icons import logo from './assets/logo.png'; export default function Testpages() { const itemRenderer = (item) => ( <a> <span className={item.icon} /> <span className="mx-2">{item.label}</span> {item.badge && <Badge className="ml-auto" value={item.badge} />} {item.shortcut
PrimeReact
primereact.org › megamenu
PrimeReact | React UI Component Library
MegaMenu is navigation component that displays submenus together.
Primereact
v9.primereact.org › menubar
React Navbar Component
Menubar also known as Navbar, is a horizontal menu component · import { Menubar } from 'primereact/menubar'; Menubar requires a collection of menuitems as its model. File · New · Bookmark · Video · Delete · Export · Edit · Left · Right ...
Primereact
blocks.primereact.org › marketing › navbar
Navbar
Navbar · Centered Menu · PreviewCode · Products · Features · Solutions · Customers · Support · Help Center · Faq · Corporate · Resources · Pricing · LoginRegister · Left Aligned MegaMenu · PreviewCode · Products · Features · Subtext of item ·
Top answer 1 of 3
2
Regarding the new version of React-Router and PrimeReact. You can rock it with the useNavigate directly.
import "./MyMenu.scss"
import React from "react";
import { Menubar } from 'primereact/menubar';
import {InputText} from "primereact/inputtext";
import {Button} from "primereact/button";
import {PrimeIcons} from "primereact/api";
import {useNavigate} from "react-router-dom";
const MyMenu = (props) => {
const navigate = useNavigate();
const items = [
{
label: 'Home',
icon: PrimeIcons.HOME,
command: () => {navigate('/') }
}
];
let searchAndLogout = <div>
<InputText placeholder="Search" type="text"/>
<Button label="Exit" icon="pi pi-power-off"/>
</div>
return (
<div className="my-menu">
<Menubar model={items} end={searchAndLogout}/>
</div>
);
}
export default MyMenu;
2 of 3
1
I have implemented primefaces menubar with react router.
First I have created a navigation items object as described in primefaces documentation.
navigationConfig.js looks like this:
export const navitems = [
{
label: 'Africa',
icon: 'pi pi-fw pi-user',
url: '/africa'
},
{
label: 'Europe',
icon: 'pi pi-fw pi-pencil',
url: '/europe'
},
{
label: 'Asia',
icon: 'pi pi-fw pi-th-large',
items: [
{
label: 'Japan',
url: '/japan'
},
{
label: 'Mongolia',
url: '/mongolia'
},
{
label: 'Nepal',
items: [
{
label: 'Kathmandu',
url: '/kathmandu'
},
{
label: 'Pokhara',
url: '/pokhara'
}
]
}
]
}
]
Then in my navigation component I have created a recursive method that maps each url of menu item into a command method which then calls a history.push() method of useHistory() hook from react-router-dom
Full navigation component looks like this:
import React from 'react';
import * as nav from '../config/navigation';
import { Menubar } from 'primereact/menubar';
import {Button} from 'primereact/button';
import { useHistory } from "react-router-dom";
const Navigation = (props) => {
const history=useHistory();
const getMenuObject=(menu)=>{
let menuObj={};
menuObj.label=menu.label;
if(menu.items){
//if the navigation has items property then map each item and call itself again
menuObj.items=menu.items.map(nestedItem=>{
return getMenuObject(nestedItem);
});
}
if(menu.icon){
menuObj.icon=menu.icon;
}
if(menu.url){
menuObj.command=()=>{
navigatePage(menu.url);
}
}
return menuObj;
}
const navigationMenu=nav.navitems.map(menuItem=>{
return getMenuObject(menuItem);
})
const navigatePage=(url)=>{
history.push(url);
}
return (
<Menubar
model={navigationMenu}
end={<Button label="Logout" onClick={(e)=>props.onLogout(e)} icon="pi pi-power-off"/>}
/>
);
}
export default Navigation;
Hope it will help whoever is looking for a solution.
Scaler
scaler.com › home › topics › react › how to use primereact in react applications?
How to Use PrimeReact in React Applications? - Scaler Topics
May 4, 2023 - The CSS files are to be imported inside the App.js file. Given below is the example code to import CSS files for primereact, primeflex, and primeicons in the App.js file. ... Let us create the NavBar (Navigation Bar) component of our React application.
Primereact
blocks.primereact.org › application › verticalnav
Vertical Navigation
Control everything with ease · Import, Export and Site Health
npm
npmjs.com › package › @tchvan › primereact-navbar
@tchvan/primereact-navbar - npm
Prime react theme selection sidebar. Latest version: 1.0.5, last published: 10 months ago. Start using @tchvan/primereact-navbar in your project by running `npm i @tchvan/primereact-navbar`. There are no other projects in the npm registry using @tchvan/primereact-navbar.
» npm install @tchvan/primereact-navbar
Published Feb 19, 2025
Version 1.0.5
Author Fortune Truong
GitHub
github.com › primefaces › primereact
GitHub - primefaces/primereact: The Most Complete React UI Component Library · GitHub
The Most Complete React UI Component Library. Contribute to primefaces/primereact development by creating an account on GitHub.
Starred by 8.3K users
Forked by 1.2K users
Languages CSS 59.8% | JavaScript 39.7% | SCSS 0.5%
StackShare
stackshare.io › stackups › bootstrap-vs-primereact
Bootstrap vs PrimeReact | What are the differences?
April 3, 2023 - In Summary, Bootstrap provides a sleek design philosophy with versatile support for various technologies and a comprehensive component library, while PrimeReact focuses on providing native components specifically designed for React applications, with a minimalist design philosophy and strong support for accessibility.
npm
npmjs.com › package › primereact
primereact - npm
August 15, 2025 - PrimeReact is an open source UI library for React featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support.
» npm install primereact
Published Aug 15, 2025
Version 10.9.7
Author PrimeTek Informatics
Repository https://github.com/primefaces/primereact
Homepage https://www.primereact.org
GitHub
github.com › primefaces › primereact › issues › 5827
Menubar: Does not respect the MenuItem id property · Issue #5827 · primefaces/primereact
January 23, 2024 - The bug is pretty simple - when passing model to the Menubar component - if an menuItem has an id - the rendered ListItem (html li element) does not have that id. The latest version, in which this ...
Author XdertY