DXDashboardNavbar
A responsive top navigation bar component for Laravel dashboards with user menu, search functionality, and sidebar toggle.
Live Examples
Props
| Name Click to sort ascending | Type | Required Click to sort ascending | Default | Description |
|---|---|---|---|---|
user | { name: string; email: string; [key: string]: any } | null | No | null | Current user object with name and email |
pageTitle | string | No | Dashboard | Page title displayed in the navbar |
searchAlign | 'start' | 'center' | No | 'start' | Horizontal alignment of the search slot content within its region: flush left (start) or centred (center). The region sits inline between the toggle and the user menu at every width |
actionsOnMobile | 'wrap' | 'hide' | No | 'wrap' | What the actions slot does below md: wrap moves it to its own full-width row (the bar grows), hide removes it entirely (for apps that relocate page actions into the page on phones) |
userMenuLabel | string | No | 'User menu' | Accessible name for the user-menu trigger. Without one, a screen reader announces it as the avatar's initial rather than as a menu |
sidebarExpanded | boolean | No | unset | Whether the sidebar the toggle controls is showing, exposed as the toggle's aria-expanded. Unset, the toggle carries none. DXDashboard sets it |
sidebarId | string | No | '' | id of the sidebar the toggle controls, exposed as its aria-controls |
Height note: the bar is exactly --dx-dashboard-header-height tall (64px
by default), the same token that sizes the sidebar header, so their bottom
edges line up. To make the shell’s header shorter or taller, override that one
property; never size the navbar and the sidebar header separately. Single-row
content must fit --dx-navbar-content-height (the header height minus the
bar’s padding and border); default-size buttons and inputs do. Taller content
(e.g. btn-lg, or a tall custom user-menu slot) makes the bar grow, so it no
longer lines up with the sidebar header.
On phones the bar is one row: the toggle, the search filling the middle,
and the user menu. Page actions take a row below unless actionsOnMobile is
hide. A shortcut hint in a <kbd> inside the search is hidden when the
search is narrower than 16rem; slot content can query the dx-navbar-search
container for anything else (for example a shorter placeholder, which CSS
cannot change, so swap it with a container query on two elements or in
script).
Events
| Name Click to sort ascending | Parameters | Description |
|---|---|---|
toggle-sidebar | none | Emitted when the hamburger menu is clicked to toggle the sidebar |
Slots
| Name Click to sort ascending | Description | Scoped Props |
|---|---|---|
menu-icon | Custom hamburger menu icon (default: three horizontal lines SVG) | - |
search | Search input or component. Fills the middle of the bar at every width (one row on a phone), aligned per searchAlign. Never narrower than 9rem: below that it wraps to its own row. The region is a size container named dx-navbar-search, and a kbd hint inside it is hidden when it is narrower than 16rem | - |
actions | Page-level primary actions (e.g. a Create button). Right-aligned next to the user menu from md up; below, wraps to its own full-width row or is hidden entirely per actionsOnMobile. Receives pageTitle as slot prop | - |
user-menu | Complete custom user menu (replaces default dropdown). Receives user as slot prop | - |
user-icon | Custom user avatar/icon (defaults to DXUserAvatar). Receives initial (first letter of name) and user as slot props. To decorate the default avatar rather than replace it — e.g. add an unread dot — render DXUserAvatar in the slot so the styling comes with it | - |
user-menu-items | Custom dropdown menu items for the user dropdown. Receives user as slot prop | - |
Extended Component
This is a custom component that extends beyond simple Bootstrap Vue Next wrappers, providing additional functionality specific to Laravel dashboards.
Features
- Responsive Design: Adapts to different screen sizes with mobile-friendly layout
- User Avatar: Automatically generates avatar with user initials
- Flexible Search: Customisable search slot for your search implementation
- Sticky Positioning: Stays at the top of the page when scrolling
- Customisable Slots: Multiple slots for complete customisation of layout and functionality