Navbar
The Navbar component is a standardized navbar for Malaysian government websites.
Usage
Main Wrapper: Navbar
The Navbar
serves as the primary container for the navigation bar content. It supports customization through props, including the ability to show or hide menus, add child elements, and apply additional class names. All subcomponents are nested within this wrapper. It is divided into two main sections:
NavbarContainer
NavbarActionGroup
1.NavbarContainer
The NavbarContainer
is the left part of the navigation bar and contains two main areas:
1.1 BrandLogo
1.2 NavigationMenuCombo
1.1 BrandLogo
The BrandLogo
component displays a logo image along with Organization name. It is clickable and redirects to the specified href.
Example:
1.2 NavigationMenuCombo
The NavigationMenuCombo
is a responsive navigation component designed to adapt seamlessly to both desktop and mobile layouts. It acts as a container for various navigation elements, ensuring consistent functionality and appearance across devices. The component supports standard navigation links and dropdown menus.
1.2.1 NavItemsMenu
The NavItemsMenu
component represents an individual navigation item that can be used in both desktop and mobile menus. It provides a straightforward way to link to different pages or sections of the application while maintaining a cohesive design. For below example, look for Menu 1 , Menu 2 or Menu 3 for their implementation.
1.2.2 NavItemsDropdown
The NavItemsDropdown
component is a flexible dropdown menu designed for use in both desktop and mobile layouts. It allows users to access additional navigation options within a structured, expandable menu.For below example, look for Menu Dropdown for their implementation.
1.2.2.1 NavItemsDropdownItems
The NavItemsDropdownItems
component is used to define individual items within a dropdown menu. These items can include links to pages or sections and are styled consistently with the overall navigation design to ensure a polished user experience. For below example, look for submenu 1 , submenu 2 or submenu 3 for their implementation.
Example:
2.NavbarActionGroup
The NavbarActionGroup
component represents the right-hand section of the navigation bar. This section is designed to provide developers with the flexibility to include any action elements they deem necessary. Supports mobile by having default hamburger toggle for NavigationMenuCombo
.
Common Use Cases
- Action Buttons: Add buttons such as menu toggles or light mode toggles.
- User Interaction Elements: Incorporate features like language switchers or user profile menus.
- Search Functionality: Include a search button for quick access.
Example:
Props
Navbar
Prop | Type | Default |
---|---|---|
showMenu | boolean | - |
children | ReactNode | - |
className | string | - |
background | string | - |
NavbarContainer
Prop | Type | Default |
---|---|---|
children | ReactNode | - |
className | string | - |
BrandLogo
Prop | Type | Default |
---|---|---|
imageSrc | string | - |
alt | string | - |
href | string | - |
children | ReactNode | - |
NavigationMenuCombo
Prop | Type | Default |
---|---|---|
showMenu | boolean | - |
setMenu | (value: boolean) => void | - |
children | ReactNode | - |
NavItemsMenu
Prop | Type | Default |
---|---|---|
children | ReactNode | - |
href | string | - |
active | boolean | - |
className | string | - |
NavItemsDropdown
Prop | Type | Default |
---|---|---|
children | ReactNode | - |
menu | string | - |
className | string | - |
NavItemsDropdownItems
Prop | Type | Default |
---|---|---|
href | string | - |
children | ReactNode | - |
className | string | - |
NavbarActionGroup
Prop | Type | Default |
---|---|---|
children | ReactNode | - |
showMenu | boolean | - |
setMenu | (value: boolean) => void | - |
className | string | - |