Components/NavBar
Universal Component

NavBar

Top navigation bar with a title, left/right slots, and an optional back button.

This page was migrated by AI, please review carefully

Migration is complete, but please validate against source code and manual review.

NavBar

Top navigation bar for compact app surfaces. It provides a centered title, safe-area padding, left/right action slots, and an optional default back button.

Basic Usage

Demo will load when visible.
<script setup lang="ts">
</script>

<template>
  <div style="width: 360px; border: 1px solid var(--tx-border-color); border-radius: 12px; overflow: hidden;">
    <TxNavBar title="Title" :show-back="true" @back="() => {}">
      <template #right>
        <TxButton variant="ghost" size="small">
          Edit
        </TxButton>
      </template>
    </TxNavBar>

    <div style="padding: 16px; color: var(--tx-text-color-secondary);">
      Content
    </div>
  </div>
</template>

API

Props

PropTypeDefaultDescription
titlestring''Text rendered in the default title area.
fixedbooleanfalseUses sticky positioning at the top of the viewport.
safeAreaTopbooleantrueAdds a safe-area spacer above the bar for notched displays.
showBackbooleanfalseShows the built-in back button when the left slot is not provided.
disabledbooleanfalseDisables back/left/right click emissions and marks the back button disabled.
zIndexnumber2000CSS z-index exposed through --tx-nav-bar-z-index.

Slots

NameDescription
leftReplaces the default left area and built-in back button.
titleReplaces the centered title content.
rightRenders right-aligned actions.

Events

EventParamsDescription
back-Emitted when the built-in back button is clicked.
click-left-Emitted when the left area is clicked; the built-in back button also emits it.
click-right-Emitted when the right area is clicked.