text-areapackage.src.vaadin-text-area.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vaadin-webcomponents Show documentation
Show all versions of vaadin-webcomponents Show documentation
Mvnpm composite: Vaadin webcomponents
The newest version!
/**
* @license
* Copyright (c) 2021 - 2024 Vaadin Ltd.
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
*/
import '@vaadin/input-container/src/vaadin-input-container.js';
import { html, PolymerElement } from '@polymer/polymer';
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 { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import { TextAreaMixin } from './vaadin-text-area-mixin.js';
import { textAreaStyles } from './vaadin-text-area-styles.js';
registerStyles('vaadin-text-area', [inputFieldShared, textAreaStyles], { moduleId: 'vaadin-text-area-styles' });
/**
* `` is a web component for multi-line text input.
*
* ```html
*
* ```
*
* ### Prefixes and suffixes
*
* These are child elements of a `` that are displayed
* inline with the input, before or after.
* In order for an element to be considered as a prefix, it must have the slot
* attribute set to `prefix` (and similarly for `suffix`).
*
* ```html
*
* Details:
* The end!
*
* ```
*
* ### Styling
*
* The following custom properties are available for styling:
*
* Custom property | Description | Default
* -------------------------------|----------------------------|---------
* `--vaadin-field-default-width` | Default width of the field | `12em`
*
* `` provides the same set of shadow DOM parts and state attributes as ``.
* See [``](#/elements/vaadin-text-field) for the styling documentation.
*
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
*
* @fires {Event} input - Fired when the value is changed by the user: on every typing keystroke, and the value is cleared using the clear button.
* @fires {Event} change - Fired when the user commits a value change.
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
* @fires {CustomEvent} validated - Fired whenever the field is validated.
*
* @customElement
* @extends HTMLElement
* @mixes ElementMixin
* @mixes TextAreaMixin
* @mixes ThemableMixin
*/
export class TextArea extends TextAreaMixin(ThemableMixin(ElementMixin(PolymerElement))) {
static get is() {
return 'vaadin-text-area';
}
static get template() {
return html`
`;
}
/** @protected */
ready() {
super.ready();
this._tooltipController = new TooltipController(this);
this._tooltipController.setPosition('top');
this._tooltipController.setAriaTarget(this.inputElement);
this.addController(this._tooltipController);
}
}
defineCustomElement(TextArea);