Skip to content

OverflowToolbar

When there are too many toolbar items and the container width is insufficient to display all items, the overflow items are automatically collapsed into a "More" popover. Suitable for toolbars, tab bars, action button groups, and similar scenarios.

Basic Usage

Pass a list array to render toolbar items. When the container width is insufficient, excess items will automatically collapse into a "More" popover.

Custom Slots

You can fully customize the toolbar items and popover styles through the item, more, and more-content slots.

Props

NameDescriptionTypeDefault
listToolbar item listOverflowToolbarItem[][]
triggerPopover trigger method'click' | 'hover''click'
visiblePopoverControl popover visibility (v-model)booleanundefined
minShowNumMinimum number of items to displaynumber0

Slots

NameDescriptionSlot Props
itemCustom toolbar item{ item: OverflowToolbarItem }
moreCustom "More" button-
more-contentCustom popover content{ overflowList: OverflowToolbarItem[] }

Methods

The following methods can be called after obtaining the component instance via ref:

NameDescriptionType
forceUpdateForce update the component, must be called after list items change() => void

Type Definitions

Can be imported directly

typescript
import { OverflowToolbarItem } from 'element-ai-vue'

OverflowToolbarItem

typescript
interface OverflowToolbarItem {
  /** Unique identifier */
  key: string | number
  /** Display text */
  text?: string
  /** Icon URL */
  icon?: string
  /** Other custom properties */
  [key: string]: any
}

Dynamic List Updates

When dynamically adding or removing list items, you need to call the forceUpdate() method to force refresh the component layout:

ts
const overflowToolbarRef = useTemplateRef('overflowToolbarRef')

// After adding an item
list.value.push({ key: 'new-item', text: 'New Item' })
overflowToolbarRef.value?.forceUpdate()

// After removing an item
list.value.pop()
overflowToolbarRef.value?.forceUpdate()