Skip to content

HorizontalAppBar Component API

The HorizontalAppBar component is a flexible navigation bar that can be positioned in different ways and customized with various content slots.

Props

PropTypeDefaultDescription
logoString'data:image/svg+xml;base64,...'URL or base64 string for the logo image
roundLogoBooleantrueWhether to display the logo in a circular shape
titleString''Text to display as the app bar title
backgroundColorString'#ffffff'Background color of the app bar
textColorString'#444444'Color of the text in the app bar
heightString'4rem'Height of the app bar
elevationBooleantrueWhether to show a subtle shadow under the app bar
positionString'fixed'Position of the app bar. Options: 'static', 'relative', 'absolute', 'fixed', 'sticky'
topString | Number'0rem'Top position of the app bar (when using fixed/absolute/sticky positioning)
zIndexString | Number1000z-index of the app bar

Slots

SlotDescription
leftCustom content for the left section (replaces the entire left container)
logoCustom logo content (replaces the default logo)
titleCustom title content (replaces the default title)
left-contentAdditional content in the left section
centerCustom content for the center section (replaces the entire center container)
center-contentContent in the center section
rightCustom content for the right section (replaces the entire right container)
right-contentContent in the right section

Events

This component does not emit any events.

CSS Classes

ClassDescription
.horizontal-app-barMain container class
.left-containerContainer for left section content
.logo-containerContainer for the logo
.round-logoApplied to logo container when roundLogo is true
.titleTitle text container
.center-containerContainer for center section content
.right-containerContainer for right section content
.position-fixedApplied when position is 'fixed'
.position-stickyApplied when position is 'sticky'
.position-absoluteApplied when position is 'absolute'
.position-relativeApplied when position is 'relative'
.position-staticApplied when position is 'static'

Usage Example

vue
<template>
  <OHorizontalAppBar
    title="My Application"
    :logo="myLogo"
    :round-logo="true"
    background-color="#ffffff"
    text-color="#444444"
    height="4rem"
    :elevation="true"
    position="fixed"
    top="0"
    :z-index="1000"
  >
    <template #left-content>
      <button>Menu</button>
    </template>

    <template #center-content>
      <nav>
        <a href="#home">Home</a>
        <a href="#about">About</a>
        <a href="#contact">Contact</a>
      </nav>
    </template>

    <template #right-content>
      <button>Login</button>
      <button>Sign Up</button>
    </template>
  </OHorizontalAppBar>
</template>

<script setup>
import { ref } from "vue";

const myLogo = ref("path/to/logo.png");
</script>

Notes

  • The component uses CSS Grid for layout with three main sections: left, center, and right
  • The logo has a hover effect that slightly scales it up
  • The title has a hover effect that reduces opacity
  • All positioning options (fixed, sticky, absolute, relative, static) are supported
  • The component is fully responsive and adapts to different screen sizes
  • The title text will be truncated with an ellipsis if it's too long
  • The component uses SCSS for styling with scoped styles to prevent conflicts