/** * @license * Copyright (c) 2019 - 2026 Vaadin Ltd. * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ */ import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js'; import type { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js'; import type { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; import type { MenuBarItem, MenuBarMixinClass } from './vaadin-menu-bar-mixin.js'; export { MenuBarItem, MenuBarI18n, SubMenuItem } from './vaadin-menu-bar-mixin.js'; /** * Fired when a submenu item or menu bar button without children is clicked. */ export type MenuBarItemSelectedEvent = CustomEvent<{ value: TItem }>; export interface MenuBarCustomEventMap { 'item-selected': MenuBarItemSelectedEvent; } export interface MenuBarEventMap extends HTMLElementEventMap, MenuBarCustomEventMap {} /** * `` is a Web Component providing a set of horizontally stacked buttons offering * the user quick access to a consistent set of commands. Each button can toggle a submenu with * support for additional levels of nested menus. * * To create the menu bar, first add the component to the page: * * ```html * * ``` * * And then use [`items`](#/elements/vaadin-menu-bar#property-items) property to initialize the structure: * * ```js * document.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}]; * ``` * * ### Styling * * The following shadow DOM parts are exposed for styling: * * Part name | Description * ------------------|---------------- * `container` | The container wrapping menu bar buttons. * * The following state attributes are available for styling: * * Attribute | Description * --------------------|---------------------------------- * `disabled` | Set when the menu bar is disabled * `has-single-button` | Set when there is only one button visible * * The following custom CSS properties are available for styling: * * Custom CSS property | * :---------------------------| * | `--vaadin-menu-bar-gap` | * * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation. * * ### Internal components * * In addition to `` itself, the following internal * components are themable: * * - `` - has the same API as [``](#/elements/vaadin-button). * - `` - has the same API as [``](#/elements/vaadin-item). * - `` - has the same API as [``](#/elements/vaadin-list-box). * - `` - has the same API as [``](#/elements/vaadin-context-menu). * * The `` sub-menu elements have the following additional state attributes * on top of the built-in `` state attributes: * * Attribute | Description * ---------- |------------- * `expanded` | Expanded parent item. * * @fires {CustomEvent} item-selected - Fired when a submenu item or menu bar button without children is clicked. */ declare class MenuBar extends HTMLElement { addEventListener>( type: K, listener: (this: MenuBar, ev: MenuBarEventMap[K]) => void, options?: AddEventListenerOptions | boolean, ): void; removeEventListener>( type: K, listener: (this: MenuBar, ev: MenuBarEventMap[K]) => void, options?: EventListenerOptions | boolean, ): void; } interface MenuBar extends MenuBarMixinClass, DisabledMixinClass, ElementMixinClass, ThemableMixinClass {} declare global { interface HTMLElementTagNameMap { 'vaadin-menu-bar': MenuBar; } } export { MenuBar };