Navbar
App-level top navigation bar: centered title with left / right action areas (text and / or icon). Rendering decisions (whether each side renders, class names, aria labels) all come from the pure functions in @lh-ui/share/core/navbar; the left button's screen-reader label falls back to the localized word for "back".
Boundary with Menu: Menu is an in-page navigation menu (multi-level / vertical); Navbar is a mobile-app style top bar (back + title + action).
Basic Usage
title is the centered title (the sides use flex: 1 to center it; long text is ellipsized). leftText / rightText control the side buttons; clicks emit left-click / right-click:
<script setup lang="ts">
import { LhNavbar } from '@lh-ui/vue3'
</script>
<template>
<!-- Basic usage -->
<LhNavbar title="Order Detail" left-text="Back" right-text="More" />
</template><script>
import { LhNavbar } from '@lh-ui/vue3'
export default {
components: { LhNavbar },
}
</script>
<template>
<!-- Basic usage -->
<LhNavbar title="Order Detail" left-text="Back" right-text="More" />
</template>Icon Buttons
leftIcon / rightIcon take an lh-icon name and can be shown together with text (button gap comes from the stylesheet --lh-spacing-xs). When no text is given, the left button's screen-reader label falls back to the localized "back":
<script setup lang="ts">
import { LhNavbar } from '@lh-ui/vue3'
</script>
<template>
<!-- Icon buttons -->
<LhNavbar title="Messages" left-icon="arrow-left" right-icon="more" />
</template><script>
import { LhNavbar } from '@lh-ui/vue3'
export default {
components: { LhNavbar },
}
</script>
<template>
<!-- Icon buttons -->
<LhNavbar title="Messages" left-icon="arrow-left" right-icon="more" />
</template>Borderless and Slots
bordered defaults to true (bottom divider from the design tokens); set it to false to remove it. The title / left / right slots override the props:
<script setup lang="ts">
import { LhNavbar } from '@lh-ui/vue3'
</script>
<template>
<!-- Borderless and slots -->
<LhNavbar :bordered="false">
<template #left>
<span>Custom left</span>
</template>
<template #title>Custom title</template>
</LhNavbar>
</template><script>
import { LhNavbar } from '@lh-ui/vue3'
export default {
components: { LhNavbar },
}
</script>
<template>
<!-- Borderless and slots -->
<LhNavbar :bordered="false">
<template #left>
<span>Custom left</span>
</template>
<template #title>Custom title</template>
</LhNavbar>
</template>Fixed to Top
fixed pins the bar to the viewport top (z-index 1000, below the overlay stack); placeholder defaults to fixed and renders an equal-height spacer so the page content does not collapse under it:
<LhNavbar title="Fixed Navbar" fixed />
<!-- Equivalent explicit form: fixed + placeholder -->
<LhNavbar title="Fixed Navbar" fixed :placeholder="true" />API
Navbar Props
| Prop | Description | Type | Default |
|---|---|---|---|
| title | Centered title | string | — |
| leftText | Left button text (can be shown with leftIcon) | string | — |
| leftIcon | Left icon name | string | — |
| rightText | Right button text (can be shown with rightIcon) | string | — |
| rightIcon | Right icon name | string | — |
| bordered | Bottom divider | boolean | true |
| fixed | Fixed to top | boolean | false |
| placeholder | Spacer when fixed (defaults to fixed) | boolean | — |
| label | Accessible name (defaults to "lh-navbar") | string | — |
| sx | sx quick-layout props | LhSxProps | — |
Navbar Events
| Event | Description | Callback |
|---|---|---|
| left-click | Left button click (back semantics) | (event: MouseEvent) |
| right-click | Right button click (action semantics) | (event: MouseEvent) |
Navbar Slots
| Slot | Description |
|---|---|
| title | Centered title (overrides the title prop) |
| left | Left button content (renders the left area when present; overrides leftText/leftIcon) |
| right | Right button content (renders the right area when present; overrides rightText/rightIcon) |
Accessibility
- The root is a semantic
<nav>;aria-labeldefaults to a fixed label and can be overridden withlabel - Side buttons are real
<button>elements; the left one readsleftTextor the localized "back" - Height follows the native navbar token (44px) with a
focus-visibleoutline

