Base Menu

BaseMenu is a component that allows you to create a menu with some predefined styles and props that can help you, it is used in some components from Vuetage like BaseSelect, and you can use to customize something that is using it as you need.


You can combine with other components, in BaseSelect component, for example, it's been used with BaseGroup and BaseItems to create a list of options in this menu. But feel free to use it as you need.



Introduction

This BaseMenu component has the absolute position, so you need to define it with a relative position in the parent element.


For example, you can add a button to show the menu when you click on it, and you can use the show prop to show or hide the menu.

<template>
  <div class="relative">
    <BaseButton @click="showMenu = !showMenu">Show Menu</BaseButton>
    <BaseMenu :show="showMenu">
      <BaseItem>Option 1</BaseItem>
      <BaseItem>Option 2</BaseItem>
      <BaseItem>Option 3</BaseItem>
    </BaseMenu>
  </div>
</template>

<script setup lang="ts">
import { BaseMenu, BaseItem, BaseButton } from 'vuetage'
import { ref } from 'vue'

const showMenu = ref<boolean>(false)
</script>

Result:


Props

PropTypeDefaultDescription
showBooleanfalseShow or hide the menu
titleStringnullTitle that will appear in the menu
closeIconStringfa fa-timesIcon to close the menu
showCloseIconStringfalseDefine if the close menu will appear
leftIconStringfa fa-arrow-leftIcon to show in the left of the title
rightIconStringfa fa-arrow-leftIcon to show in the right of the title
showCloseButtonBooleanfalseShow or hide the close button
backgroundColorString#fffDefine the background color of menu
topStringnullDefine the top style of menu
leftString0Define the left style of menu
rightString0Define the right style of menu
bottomStringnullDefine the bottom style of menu
borderColorString#eaeaeaDefine the border color style of menu
zIndexString100Define the z-index style of menu
maxHeightString200pxDefine the max-height style of menu
boxShadowString0 2px 5px rgba(0, 0, 0, 0.1)Define the box-shadow style of menu
customClassStringnullDefine classes in base menu, you can use to apply some tailwind style
customStyleCustomStylenullDefine custom styles in base menu, you can use to apply any style

Slots

SlotDescription
defaultContent of the menu
titleChange the title
closeButtonChange the close button content

Events

EventDescription
closeEmit when click on close button