Skip to content
API 风格:

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:

Basic Usage
vue
<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>
vue
<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":

Icon Buttons
vue
<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>
vue
<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:

Borderless and Slots
vue
<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>
vue
<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:

vue
<LhNavbar title="Fixed Navbar" fixed />
<!-- Equivalent explicit form: fixed + placeholder -->
<LhNavbar title="Fixed Navbar" fixed :placeholder="true" />

API ​

PropDescriptionTypeDefault
titleCentered titlestring—
leftTextLeft button text (can be shown with leftIcon)string—
leftIconLeft icon namestring—
rightTextRight button text (can be shown with rightIcon)string—
rightIconRight icon namestring—
borderedBottom dividerbooleantrue
fixedFixed to topbooleanfalse
placeholderSpacer when fixed (defaults to fixed)boolean—
labelAccessible name (defaults to "lh-navbar")string—
sxsx quick-layout propsLhSxProps—
EventDescriptionCallback
left-clickLeft button click (back semantics)(event: MouseEvent)
right-clickRight button click (action semantics)(event: MouseEvent)
SlotDescription
titleCentered title (overrides the title prop)
leftLeft button content (renders the left area when present; overrides leftText/leftIcon)
rightRight button content (renders the right area when present; overrides rightText/rightIcon)

Accessibility ​

  • The root is a semantic <nav>; aria-label defaults to a fixed label and can be overridden with label
  • Side buttons are real <button> elements; the left one reads leftText or the localized "back"
  • Height follows the native navbar token (44px) with a focus-visible outline

Beauty of tradition, foundation of code