Skip to content

OVerticalAppBar API Reference

Props

PropTypeDefaultDescription
elevationBooleantrueWhether to show elevation/shadow
floatingBooleantrueWhether the app bar should float
stickyBooleantrueWhether the app bar should be sticky
logoString''URL or SVG string for the logo
roundedLogoBooleanfalseWhether to show rounded logo
titleString''Title text
showCloseButtonBooleantrueWhether to show close button
modelValueBooleantrueControls visibility of the app bar (v-model)
persistIconsOnHideBooleantrueWhether to show icons when collapsed
expandOnHoverBooleanfalseWhether to expand on hover
expandOnClickBooleantrueWhether to expand on click
overlayBooleantrueWhether to show overlay backdrop
positionString'left'Position of the app bar ('left' or 'right')
itemsArray[]Navigation items array
activeItemString''Currently active item (v-model)
showChevronBooleantrueWhether to show chevron icons
multiExpandBooleantrueWhether to allow multiple expanded sections

Each item in the items array should have the following structure:

PropertyTypeRequiredDescription
labelStringYesDisplay text for the navigation item
valueStringYesUnique identifier for the item
iconStringNoURL or SVG string for the item icon
childrenArrayNoArray of child items (supports nested levels)

Example:

javascript
const items = [
  {
    label: "Dashboard",
    value: "dashboard",
    icon: "dashboard-icon.svg",
  },
  {
    label: "Settings",
    value: "settings",
    icon: "settings-icon.svg",
    children: [
      {
        label: "Profile",
        value: "profile",
        icon: "profile-icon.svg",
      },
      {
        label: "Security",
        value: "security",
        children: [
          {
            label: "Password",
            value: "password",
          }
        ]
      }
    ]
  }
]

Events

EventPayloadDescription
logoClick-Emitted when logo is clicked
closeClick-Emitted when close button is clicked
titleClick-Emitted when title is clicked
update:modelValueBooleanEmitted when visibility changes (v-model)
update:activeItemStringEmitted when active item changes (v-model)

Slots

SlotPropsDescription
default-Main content slot
prepend-Header section slot
logo{ handleLogoClick: Function }Logo slot with click handler
title{ handleTitleClick: Function }Title slot with click handler
closeBtn{ handleCloseClick: Function }Close button slot with click handler
content-Navigation items content slot
append-Footer section slot

Methods

The component doesn't expose any methods via template refs.

Example Usage

Basic Usage

vue
<template>
  <OVerticalAppBar
    title="My App"
    :items="navigationItems"
    @logo-click="handleLogoClick"
    @close-click="handleCloseClick"
  />
</template>

<script setup>
import { ref } from "vue";
import { OVerticalAppBar } from "your-component-library";

const navigationItems = ref([
  {
    label: "Dashboard",
    value: "dashboard",
    icon: "dashboard-icon.svg",
  },
  {
    label: "Settings",
    value: "settings",
    icon: "settings-icon.svg",
    children: [
      {
        label: "Profile",
        value: "profile",
        icon: "profile-icon.svg",
      },
      {
        label: "Security",
        value: "security",
        icon: "security-icon.svg",
      },
    ],
  },
]);

const handleLogoClick = () => {
  console.log("Logo clicked");
};

const handleCloseClick = () => {
  console.log("Close clicked");
};
</script>

With Custom Logo and Title

vue
<template>
  <OVerticalAppBar
    :logo="customLogo"
    :rounded-logo="true"
    title="Custom App"
    :title-color="'#4a90e2'"
  >
    <template #logo="{ handleLogoClick }">
      <div class="custom-logo" @click="handleLogoClick">
        <img :src="customLogo" alt="Custom Logo" />
      </div>
    </template>
  </OVerticalAppBar>
</template>

<script setup>
import { ref } from "vue";
import { OVerticalAppBar } from "your-component-library";

const customLogo = ref("path/to/your/logo.svg");
</script>

With Custom Navigation Items

vue
<template>
  <OVerticalAppBar
    :items="navigationItems"
    :multi-expand="true"
    :show-chevron="true"
  >
    <template #content>
      <div class="custom-navigation">
        <div
          v-for="item in navigationItems"
          :key="item.value"
          class="nav-item"
          :class="{ active: item.value === activeItem }"
          @click="handleItemClick(item)"
        >
          <img :src="item.icon" :alt="item.label" class="nav-icon" />
          <span class="nav-label">{{ item.label }}</span>
        </div>
      </div>
    </template>
  </OVerticalAppBar>
</template>

<script setup>
import { ref } from "vue";
import { OVerticalAppBar } from "your-component-library";

const navigationItems = ref([
  {
    label: "Home",
    value: "home",
    icon: "home-icon.svg",
  },
  {
    label: "Products",
    value: "products",
    icon: "products-icon.svg",
    children: [
      {
        label: "Categories",
        value: "categories",
        icon: "categories-icon.svg",
      },
      {
        label: "Inventory",
        value: "inventory",
        icon: "inventory-icon.svg",
      },
    ],
  },
]);

const activeItem = ref("home");

const handleItemClick = (item) => {
  activeItem.value = item.value;
};
</script>

With Custom Close Button

vue
<template>
  <OVerticalAppBar title="Custom Close" :show-close-button="true">
    <template #closeBtn="{ handleCloseClick }">
      <button class="custom-close-btn" @click="handleCloseClick">
        <span class="close-icon">×</span>
        <span class="close-text">Close Panel</span>
      </button>
    </template>
  </OVerticalAppBar>
</template>

<style scoped>
.custom-close-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

.close-icon {
  font-size: 1.5rem;
}

.close-text {
  font-size: 0.875rem;
}
</style>

With Nested Navigation Items

vue
<template>
  <OVerticalAppBar
    title="My App"
    :items="navigationItems"
    v-model="isVisible"
    v-model:activeItem="activeItem"
  />
</template>

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

const isVisible = ref(true);
const activeItem = ref("dashboard");

const navigationItems = ref([
  {
    label: "Dashboard",
    value: "dashboard",
    icon: "dashboard-icon.svg",
  },
  {
    label: "Settings",
    value: "settings",
    icon: "settings-icon.svg",
    children: [
      {
        label: "Profile",
        value: "profile",
        icon: "profile-icon.svg",
      },
      {
        label: "Security",
        value: "security",
        icon: "security-icon.svg",
        children: [
          {
            label: "Password",
            value: "password",
          },
          {
            label: "Two-Factor",
            value: "two-factor",
          }
        ]
      }
    ]
  }
]);
</script>