package.src.vaadin-tab.js Maven / Gradle / Ivy
/**
* @license
* Copyright (c) 2017 - 2024 Vaadin Ltd.
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
*/
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import { TabMixin } from './vaadin-tab-mixin.js';
import { tabStyles } from './vaadin-tab-styles.js';
registerStyles('vaadin-tab', tabStyles, { moduleId: 'vaadin-tab-styles' });
/**
* `` is a Web Component providing an accessible and customizable tab.
*
* ```
*
* Tab 1
*
* ```
*
* The following state attributes are available for styling:
*
* Attribute | Description | Part name
* -----------|-------------|------------
* `disabled` | Set to a disabled tab | :host
* `focused` | Set when the element is focused | :host
* `focus-ring` | Set when the element is keyboard focused | :host
* `selected` | Set when the tab is selected | :host
* `active` | Set when mousedown or enter/spacebar pressed | :host
* `orientation` | Set to `horizontal` or `vertical` depending on the direction of items | :host
*
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
*
* @customElement
* @extends HTMLElement
* @mixes ControllerMixin
* @mixes ElementMixin
* @mixes ThemableMixin
* @mixes TabMixin
*/
class Tab extends ElementMixin(ThemableMixin(TabMixin(ControllerMixin(PolymerElement)))) {
static get template() {
return html`
`;
}
static get is() {
return 'vaadin-tab';
}
/** @protected */
ready() {
super.ready();
this._tooltipController = new TooltipController(this);
this.addController(this._tooltipController);
}
}
defineCustomElement(Tab);
export { Tab };