form-layoutpackage.src.vaadin-form-item.d.ts 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) 2017 - 2024 Vaadin Ltd.
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
*/
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
/**
* `` is a Web Component providing labelled form item wrapper
* for using inside ``.
*
* `` accepts a single child as the input content,
* and also has a separate named `label` slot:
*
* ```html
*
*
*
*
* ```
*
* The label is optional and can be omitted:
*
* ```html
*
* Subscribe to our Newsletter
*
* ```
*
* By default, the `label` slot content is displayed aside of the input content.
* When `label-position="top"` is set, the `label` slot content is displayed on top:
*
* ```html
*
*
*
*
* ```
*
* **Note:** Normally, `` is used as a child of
* a `` element. Setting `label-position` is unnecessary,
* because the `label-position` attribute is triggered automatically by the parent
* ``, depending on its width and responsive behavior.
*
* ### Input Width
*
* By default, `` does not manipulate the width of the slotted
* input element. Optionally you can stretch the child input element to fill
* the available width for the input content by adding the `full-width` class:
*
* ```html
*
*
*
*
* ```
*
* ### Styling
*
* The `label-position` host attribute can be used to target the label on top state:
*
* ```
* :host([label-position="top"]) {
* padding-top: 0.5rem;
* }
* ```
*
* The following shadow DOM parts are available for styling:
*
* Part name | Description
* ---|---
* label | The label slot container
*
* ### Custom CSS Properties Reference
*
* The following custom CSS properties are available on the ``
* element:
*
* Custom CSS property | Description | Default
* ---|---|---
* `--vaadin-form-item-label-width` | Width of the label column when the labels are aside | `8em`
* `--vaadin-form-item-label-spacing` | Spacing between the label column and the input column when the labels are aside | `1em`
* `--vaadin-form-item-row-spacing` | Height of the spacing between the form item elements | `1em`
*
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
*/
declare class FormItem extends ThemableMixin(HTMLElement) {
/**
* Returns a target element to add ARIA attributes to for a field.
*
* - For Vaadin field components, the method returns an element
* obtained through the `ariaTarget` property defined in `FieldMixin`.
* - In other cases, the method returns the field element itself.
*/
protected _getFieldAriaTarget(field: HTMLElement): HTMLElement;
}
declare global {
interface HTMLElementTagNameMap {
'vaadin-form-item': FormItem;
}
}
export { FormItem };