@vaadin/form-layout 24.7.0-rc1 → 24.8.0-alpha2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -11
- package/src/layouts/abstract-layout.js +85 -0
- package/src/layouts/auto-responsive-layout.js +177 -0
- package/src/layouts/responsive-steps-layout.js +233 -0
- package/src/vaadin-form-layout-mixin.d.ts +83 -2
- package/src/vaadin-form-layout-mixin.js +151 -201
- package/src/vaadin-form-layout-styles.js +158 -11
- package/src/vaadin-form-layout.d.ts +82 -0
- package/src/vaadin-form-layout.js +82 -0
- package/src/vaadin-form-row.d.ts +24 -0
- package/src/vaadin-form-row.js +37 -0
- package/src/vaadin-lit-form-row.d.ts +6 -0
- package/src/vaadin-lit-form-row.js +38 -0
- package/theme/lumo/vaadin-form-row.d.ts +1 -0
- package/theme/lumo/vaadin-form-row.js +1 -0
- package/theme/lumo/vaadin-lit-form-row.d.ts +1 -0
- package/theme/lumo/vaadin-lit-form-row.js +1 -0
- package/theme/material/vaadin-form-row.d.ts +1 -0
- package/theme/material/vaadin-form-row.js +1 -0
- package/theme/material/vaadin-lit-form-row.d.ts +1 -0
- package/theme/material/vaadin-lit-form-row.js +1 -0
- package/vaadin-form-row.d.ts +1 -0
- package/vaadin-form-row.js +2 -0
- package/vaadin-lit-form-row.d.ts +1 -0
- package/vaadin-lit-form-row.js +2 -0
- package/web-types.json +177 -2
- package/web-types.lit.json +57 -2
|
@@ -90,6 +90,88 @@ export * from './vaadin-form-layout-mixin.js';
|
|
|
90
90
|
* </vaadin-form-layout>
|
|
91
91
|
* ```
|
|
92
92
|
*
|
|
93
|
+
* ### Auto Responsive Mode
|
|
94
|
+
*
|
|
95
|
+
* To avoid manually dealing with responsive breakpoints, Form Layout provides an auto-responsive mode
|
|
96
|
+
* that automatically creates and adjusts fixed-width columns based on the container's available space.
|
|
97
|
+
* The [`columnWidth`](#/elements/vaadin-form-layout#property-columnWidth) and
|
|
98
|
+
* [`maxColumns`](#/elements/vaadin-form-layout#property-maxColumns) properties control the column width
|
|
99
|
+
* (13em by default) and the maximum number of columns (10 by default) that the Form Layout can create.
|
|
100
|
+
*
|
|
101
|
+
* ```html
|
|
102
|
+
* <vaadin-form-layout auto-responsive>
|
|
103
|
+
* <vaadin-text-field label="First Name"></vaadin-text-field>
|
|
104
|
+
* <vaadin-text-field label="Last Name"></vaadin-text-field>
|
|
105
|
+
* <vaadin-text-area label="Address" colspan="2"></vaadin-text-area>
|
|
106
|
+
* </vaadin-form-layout>
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* #### Organizing Fields into Rows
|
|
110
|
+
*
|
|
111
|
+
* By default, each field is placed on a new row. To organize fields into rows, you can either:
|
|
112
|
+
*
|
|
113
|
+
* 1. Manually wrap fields into [`<vaadin-form-row>`](#/elements/vaadin-form-row) elements.
|
|
114
|
+
*
|
|
115
|
+
* 2. Enable the [`autoRows`](#/elements/vaadin-form-layout#property-autoRows) property to
|
|
116
|
+
* let Form Layout automatically arrange fields in available columns, wrapping to a new
|
|
117
|
+
* row when necessary. `<br>` elements can be used to force a new row.
|
|
118
|
+
*
|
|
119
|
+
* Here is an example of using `<vaadin-form-row>`:
|
|
120
|
+
*
|
|
121
|
+
* ```html
|
|
122
|
+
* <vaadin-form-layout auto-responsive>
|
|
123
|
+
* <vaadin-form-row>
|
|
124
|
+
* <vaadin-text-field label="First Name"></vaadin-text-field>
|
|
125
|
+
* <vaadin-text-field label="Last Name"></vaadin-text-field>
|
|
126
|
+
* </vaadin-form-row>
|
|
127
|
+
* <vaadin-form-row>
|
|
128
|
+
* <vaadin-text-area label="Address" colspan="2"></vaadin-text-area>
|
|
129
|
+
* </vaadin-form-row>
|
|
130
|
+
* </vaadin-form-layout>
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* #### Expanding Columns and Fields
|
|
134
|
+
*
|
|
135
|
+
* You can configure Form Layout to expand columns to evenly fill any remaining space after
|
|
136
|
+
* all fixed-width columns have been created.
|
|
137
|
+
* To enable this, set the [`expandColumns`](#/elements/vaadin-form-layout#property-expandColumns)
|
|
138
|
+
* property to `true`.
|
|
139
|
+
*
|
|
140
|
+
* Also, Form Layout can stretch fields to make them take up all available space within columns.
|
|
141
|
+
* To enable this, set the [`expandFields`](#/elements/vaadin-form-layout#property-expandFields)
|
|
142
|
+
* property to `true`.
|
|
143
|
+
*
|
|
144
|
+
* #### Customizing Label Position
|
|
145
|
+
*
|
|
146
|
+
* By default, Form Layout displays labels above the fields. To position labels beside fields, you
|
|
147
|
+
* need to wrap each field in a `<vaadin-form-item>` element and define its labels on the wrapper.
|
|
148
|
+
* Then, you can enable the [`labelsAside`](#/elements/vaadin-form-layout#property-labelsAside)
|
|
149
|
+
* property:
|
|
150
|
+
*
|
|
151
|
+
* ```html
|
|
152
|
+
* <vaadin-form-layout auto-responsive labels-aside>
|
|
153
|
+
* <vaadin-form-row>
|
|
154
|
+
* <vaadin-form-item>
|
|
155
|
+
* <label slot="label">First Name</label>
|
|
156
|
+
* <vaadin-text-field></vaadin-text-field>
|
|
157
|
+
* </vaadin-form-item>
|
|
158
|
+
* <vaadin-form-item>
|
|
159
|
+
* <label slot="label">Last Name</label>
|
|
160
|
+
* <vaadin-text-field></vaadin-text-field>
|
|
161
|
+
* </vaadin-form-item>
|
|
162
|
+
* </vaadin-form-row>
|
|
163
|
+
* <vaadin-form-row>
|
|
164
|
+
* <vaadin-form-item colspan="2">
|
|
165
|
+
* <label slot="label">Address</label>
|
|
166
|
+
* <vaadin-text-area></vaadin-text-area>
|
|
167
|
+
* </vaadin-form-item>
|
|
168
|
+
* </vaadin-form-row>
|
|
169
|
+
* </vaadin-form-layout>
|
|
170
|
+
* ```
|
|
171
|
+
*
|
|
172
|
+
* With this, FormLayout will display labels beside fields, falling back to
|
|
173
|
+
* the default position above the fields only when there isn't enough space.
|
|
174
|
+
*
|
|
93
175
|
* ### CSS Properties Reference
|
|
94
176
|
*
|
|
95
177
|
* The following custom CSS properties are available on the `<vaadin-form-layout>`
|
|
@@ -93,6 +93,88 @@ registerStyles('vaadin-form-layout', formLayoutStyles, { moduleId: 'vaadin-form-
|
|
|
93
93
|
* </vaadin-form-layout>
|
|
94
94
|
* ```
|
|
95
95
|
*
|
|
96
|
+
* ### Auto Responsive Mode
|
|
97
|
+
*
|
|
98
|
+
* To avoid manually dealing with responsive breakpoints, Form Layout provides an auto-responsive mode
|
|
99
|
+
* that automatically creates and adjusts fixed-width columns based on the container's available space.
|
|
100
|
+
* The [`columnWidth`](#/elements/vaadin-form-layout#property-columnWidth) and
|
|
101
|
+
* [`maxColumns`](#/elements/vaadin-form-layout#property-maxColumns) properties control the column width
|
|
102
|
+
* (13em by default) and the maximum number of columns (10 by default) that the Form Layout can create.
|
|
103
|
+
*
|
|
104
|
+
* ```html
|
|
105
|
+
* <vaadin-form-layout auto-responsive>
|
|
106
|
+
* <vaadin-text-field label="First Name"></vaadin-text-field>
|
|
107
|
+
* <vaadin-text-field label="Last Name"></vaadin-text-field>
|
|
108
|
+
* <vaadin-text-area label="Address" colspan="2"></vaadin-text-area>
|
|
109
|
+
* </vaadin-form-layout>
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* #### Organizing Fields into Rows
|
|
113
|
+
*
|
|
114
|
+
* By default, each field is placed on a new row. To organize fields into rows, you can either:
|
|
115
|
+
*
|
|
116
|
+
* 1. Manually wrap fields into [`<vaadin-form-row>`](#/elements/vaadin-form-row) elements.
|
|
117
|
+
*
|
|
118
|
+
* 2. Enable the [`autoRows`](#/elements/vaadin-form-layout#property-autoRows) property to
|
|
119
|
+
* let Form Layout automatically arrange fields in available columns, wrapping to a new
|
|
120
|
+
* row when necessary. `<br>` elements can be used to force a new row.
|
|
121
|
+
*
|
|
122
|
+
* Here is an example of using `<vaadin-form-row>`:
|
|
123
|
+
*
|
|
124
|
+
* ```html
|
|
125
|
+
* <vaadin-form-layout auto-responsive>
|
|
126
|
+
* <vaadin-form-row>
|
|
127
|
+
* <vaadin-text-field label="First Name"></vaadin-text-field>
|
|
128
|
+
* <vaadin-text-field label="Last Name"></vaadin-text-field>
|
|
129
|
+
* </vaadin-form-row>
|
|
130
|
+
* <vaadin-form-row>
|
|
131
|
+
* <vaadin-text-area label="Address" colspan="2"></vaadin-text-area>
|
|
132
|
+
* </vaadin-form-row>
|
|
133
|
+
* </vaadin-form-layout>
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* #### Expanding Columns and Fields
|
|
137
|
+
*
|
|
138
|
+
* You can configure Form Layout to expand columns to evenly fill any remaining space after
|
|
139
|
+
* all fixed-width columns have been created.
|
|
140
|
+
* To enable this, set the [`expandColumns`](#/elements/vaadin-form-layout#property-expandColumns)
|
|
141
|
+
* property to `true`.
|
|
142
|
+
*
|
|
143
|
+
* Also, Form Layout can stretch fields to make them take up all available space within columns.
|
|
144
|
+
* To enable this, set the [`expandFields`](#/elements/vaadin-form-layout#property-expandFields)
|
|
145
|
+
* property to `true`.
|
|
146
|
+
*
|
|
147
|
+
* #### Customizing Label Position
|
|
148
|
+
*
|
|
149
|
+
* By default, Form Layout displays labels above the fields. To position labels beside fields, you
|
|
150
|
+
* need to wrap each field in a `<vaadin-form-item>` element and define its labels on the wrapper.
|
|
151
|
+
* Then, you can enable the [`labelsAside`](#/elements/vaadin-form-layout#property-labelsAside)
|
|
152
|
+
* property:
|
|
153
|
+
*
|
|
154
|
+
* ```html
|
|
155
|
+
* <vaadin-form-layout auto-responsive labels-aside>
|
|
156
|
+
* <vaadin-form-row>
|
|
157
|
+
* <vaadin-form-item>
|
|
158
|
+
* <label slot="label">First Name</label>
|
|
159
|
+
* <vaadin-text-field></vaadin-text-field>
|
|
160
|
+
* </vaadin-form-item>
|
|
161
|
+
* <vaadin-form-item>
|
|
162
|
+
* <label slot="label">Last Name</label>
|
|
163
|
+
* <vaadin-text-field></vaadin-text-field>
|
|
164
|
+
* </vaadin-form-item>
|
|
165
|
+
* </vaadin-form-row>
|
|
166
|
+
* <vaadin-form-row>
|
|
167
|
+
* <vaadin-form-item colspan="2">
|
|
168
|
+
* <label slot="label">Address</label>
|
|
169
|
+
* <vaadin-text-area></vaadin-text-area>
|
|
170
|
+
* </vaadin-form-item>
|
|
171
|
+
* </vaadin-form-row>
|
|
172
|
+
* </vaadin-form-layout>
|
|
173
|
+
* ```
|
|
174
|
+
*
|
|
175
|
+
* With this, FormLayout will display labels beside fields, falling back to
|
|
176
|
+
* the default position above the fields only when there isn't enough space.
|
|
177
|
+
*
|
|
96
178
|
* ### CSS Properties Reference
|
|
97
179
|
*
|
|
98
180
|
* The following custom CSS properties are available on the `<vaadin-form-layout>`
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* `<vaadin-form-row>` is a web component for arranging fields into rows
|
|
10
|
+
* inside a `<vaadin-form-layout>` that is set to autoResponsive mode.
|
|
11
|
+
*
|
|
12
|
+
* Each `<vaadin-form-row>` always starts on a new row. Fields that exceed
|
|
13
|
+
* the available columns wrap to a new row, which then remains reserved
|
|
14
|
+
* exclusively for the fields of that `<vaadin-form-row>` element.
|
|
15
|
+
*/
|
|
16
|
+
declare class FormRow extends ThemableMixin(HTMLElement) {}
|
|
17
|
+
|
|
18
|
+
declare global {
|
|
19
|
+
interface HTMLElementTagNameMap {
|
|
20
|
+
'vaadin-form-row': FormRow;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { FormRow };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
+
import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
|
+
import { formRowStyles } from './vaadin-form-layout-styles.js';
|
|
10
|
+
|
|
11
|
+
registerStyles('vaadin-form-row', formRowStyles, { moduleId: 'vaadin-form-row-styles' });
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* `<vaadin-form-row>` is a web component for arranging fields into rows
|
|
15
|
+
* inside a `<vaadin-form-layout>` that is set to autoResponsive mode.
|
|
16
|
+
*
|
|
17
|
+
* Each `<vaadin-form-row>` always starts on a new row. Fields that exceed
|
|
18
|
+
* the available columns wrap to a new row, which then remains reserved
|
|
19
|
+
* exclusively for the fields of that `<vaadin-form-row>` element.
|
|
20
|
+
*
|
|
21
|
+
* @customElement
|
|
22
|
+
* @extends HTMLElement
|
|
23
|
+
* @mixes ThemableMixin
|
|
24
|
+
*/
|
|
25
|
+
class FormRow extends ThemableMixin(PolymerElement) {
|
|
26
|
+
static get is() {
|
|
27
|
+
return 'vaadin-form-row';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static get template() {
|
|
31
|
+
return html`<slot></slot>`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
defineCustomElement(FormRow);
|
|
36
|
+
|
|
37
|
+
export { FormRow };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { html, LitElement } from 'lit';
|
|
7
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
|
+
import { formRowStyles } from './vaadin-form-layout-styles.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* LitElement based version of `<vaadin-form-row>` web component.
|
|
14
|
+
*
|
|
15
|
+
* ## Disclaimer
|
|
16
|
+
*
|
|
17
|
+
* This component is an experiment and not yet a part of Vaadin platform.
|
|
18
|
+
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
19
|
+
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
20
|
+
*/
|
|
21
|
+
class FormRow extends ThemableMixin(PolylitMixin(LitElement)) {
|
|
22
|
+
static get is() {
|
|
23
|
+
return 'vaadin-form-row';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static get styles() {
|
|
27
|
+
return formRowStyles;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** @protected */
|
|
31
|
+
render() {
|
|
32
|
+
return html`<slot></slot>`;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
defineCustomElement(FormRow);
|
|
37
|
+
|
|
38
|
+
export { FormRow };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../../src/vaadin-form-row.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../../src/vaadin-form-row.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../../src/vaadin-lit-form-row.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../../src/vaadin-lit-form-row.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../../src/vaadin-form-row.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../../src/vaadin-form-row.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../../src/vaadin-lit-form-row.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../../src/vaadin-lit-form-row.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/vaadin-form-row.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './vaadin-form-row.js';
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/form-layout",
|
|
4
|
-
"version": "24.
|
|
4
|
+
"version": "24.8.0-alpha2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -29,8 +29,85 @@
|
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
"name": "vaadin-form-layout",
|
|
32
|
-
"description": "`<vaadin-form-layout>` is a Web Component providing configurable responsive\nlayout for form elements.\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item>\n <label slot=\"label\">First Name</label>\n <input class=\"full-width\" value=\"Jane\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Last Name</label>\n <input class=\"full-width\" value=\"Doe\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Email</label>\n <input class=\"full-width\" value=\"jane.doe@example.com\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\nIt supports any child elements as layout items.\n\nBy default, it makes a layout of two columns if the element width is equal or\nwider than 40em, and a single column layout otherwise.\n\nThe number of columns and the responsive behavior are customizable with\nthe `responsiveSteps` property.\n\n### Spanning Items on Multiple Columns\n\nYou can use `colspan` or `data-colspan` attribute on the items.\nIn the example below, the first text field spans on two columns:\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item colspan=\"2\">\n <label slot=\"label\">Address</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">First Name</label>\n <input class=\"full-width\" value=\"Jane\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Last Name</label>\n <input class=\"full-width\" value=\"Doe\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\n### Explicit New Row\n\nUse the `<br>` line break element to wrap the items on a new row:\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item>\n <label slot=\"label\">Email</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n <br>\n\n <vaadin-form-item>\n <label slot=\"label\">Confirm Email</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\n### CSS Properties Reference\n\nThe following custom CSS properties are available on the `<vaadin-form-layout>`\nelement:\n\nCustom CSS property | Description | Default\n---|---|---\n`--vaadin-form-layout-column-spacing` | Length of the spacing between columns | `2em`\n`--vaadin-form-layout-row-spacing` | Length of the spacing between rows | `1em`\n`--vaadin-form-layout-label-width` | Width of the label when labels are displayed aside | `8em`\n`--vaadin-form-layout-label-spacing` | Length of the spacing between the label and the input when labels are displayed aside | `1em`",
|
|
32
|
+
"description": "`<vaadin-form-layout>` is a Web Component providing configurable responsive\nlayout for form elements.\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item>\n <label slot=\"label\">First Name</label>\n <input class=\"full-width\" value=\"Jane\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Last Name</label>\n <input class=\"full-width\" value=\"Doe\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Email</label>\n <input class=\"full-width\" value=\"jane.doe@example.com\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\nIt supports any child elements as layout items.\n\nBy default, it makes a layout of two columns if the element width is equal or\nwider than 40em, and a single column layout otherwise.\n\nThe number of columns and the responsive behavior are customizable with\nthe `responsiveSteps` property.\n\n### Spanning Items on Multiple Columns\n\nYou can use `colspan` or `data-colspan` attribute on the items.\nIn the example below, the first text field spans on two columns:\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item colspan=\"2\">\n <label slot=\"label\">Address</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">First Name</label>\n <input class=\"full-width\" value=\"Jane\">\n </vaadin-form-item>\n\n <vaadin-form-item>\n <label slot=\"label\">Last Name</label>\n <input class=\"full-width\" value=\"Doe\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\n### Explicit New Row\n\nUse the `<br>` line break element to wrap the items on a new row:\n\n```html\n<vaadin-form-layout>\n\n <vaadin-form-item>\n <label slot=\"label\">Email</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n <br>\n\n <vaadin-form-item>\n <label slot=\"label\">Confirm Email</label>\n <input class=\"full-width\">\n </vaadin-form-item>\n\n</vaadin-form-layout>\n```\n\n### Auto Responsive Mode\n\nTo avoid manually dealing with responsive breakpoints, Form Layout provides an auto-responsive mode\nthat automatically creates and adjusts fixed-width columns based on the container's available space.\nThe [`columnWidth`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha2/#/elements/vaadin-form-layout#property-columnWidth) and\n[`maxColumns`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha2/#/elements/vaadin-form-layout#property-maxColumns) properties control the column width\n(13em by default) and the maximum number of columns (10 by default) that the Form Layout can create.\n\n```html\n<vaadin-form-layout auto-responsive>\n <vaadin-text-field label=\"First Name\"></vaadin-text-field>\n <vaadin-text-field label=\"Last Name\"></vaadin-text-field>\n <vaadin-text-area label=\"Address\" colspan=\"2\"></vaadin-text-area>\n</vaadin-form-layout>\n```\n\n#### Organizing Fields into Rows\n\nBy default, each field is placed on a new row. To organize fields into rows, you can either:\n\n1. Manually wrap fields into [`<vaadin-form-row>`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha2/#/elements/vaadin-form-row) elements.\n\n2. Enable the [`autoRows`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha2/#/elements/vaadin-form-layout#property-autoRows) property to\n let Form Layout automatically arrange fields in available columns, wrapping to a new\n row when necessary. `<br>` elements can be used to force a new row.\n\nHere is an example of using `<vaadin-form-row>`:\n\n```html\n<vaadin-form-layout auto-responsive>\n <vaadin-form-row>\n <vaadin-text-field label=\"First Name\"></vaadin-text-field>\n <vaadin-text-field label=\"Last Name\"></vaadin-text-field>\n </vaadin-form-row>\n <vaadin-form-row>\n <vaadin-text-area label=\"Address\" colspan=\"2\"></vaadin-text-area>\n </vaadin-form-row>\n</vaadin-form-layout>\n```\n\n#### Expanding Columns and Fields\n\nYou can configure Form Layout to expand columns to evenly fill any remaining space after\nall fixed-width columns have been created.\nTo enable this, set the [`expandColumns`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha2/#/elements/vaadin-form-layout#property-expandColumns)\nproperty to `true`.\n\nAlso, Form Layout can stretch fields to make them take up all available space within columns.\nTo enable this, set the [`expandFields`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha2/#/elements/vaadin-form-layout#property-expandFields)\nproperty to `true`.\n\n#### Customizing Label Position\n\nBy default, Form Layout displays labels above the fields. To position labels beside fields, you\nneed to wrap each field in a `<vaadin-form-item>` element and define its labels on the wrapper.\nThen, you can enable the [`labelsAside`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha2/#/elements/vaadin-form-layout#property-labelsAside)\nproperty:\n\n```html\n<vaadin-form-layout auto-responsive labels-aside>\n <vaadin-form-row>\n <vaadin-form-item>\n <label slot=\"label\">First Name</label>\n <vaadin-text-field></vaadin-text-field>\n </vaadin-form-item>\n <vaadin-form-item>\n <label slot=\"label\">Last Name</label>\n <vaadin-text-field></vaadin-text-field>\n </vaadin-form-item>\n </vaadin-form-row>\n <vaadin-form-row>\n <vaadin-form-item colspan=\"2\">\n <label slot=\"label\">Address</label>\n <vaadin-text-area></vaadin-text-area>\n </vaadin-form-item>\n </vaadin-form-row>\n</vaadin-form-layout>\n```\n\nWith this, FormLayout will display labels beside fields, falling back to\nthe default position above the fields only when there isn't enough space.\n\n### CSS Properties Reference\n\nThe following custom CSS properties are available on the `<vaadin-form-layout>`\nelement:\n\nCustom CSS property | Description | Default\n---|---|---\n`--vaadin-form-layout-column-spacing` | Length of the spacing between columns | `2em`\n`--vaadin-form-layout-row-spacing` | Length of the spacing between rows | `1em`\n`--vaadin-form-layout-label-width` | Width of the label when labels are displayed aside | `8em`\n`--vaadin-form-layout-label-spacing` | Length of the spacing between the label and the input when labels are displayed aside | `1em`",
|
|
33
33
|
"attributes": [
|
|
34
|
+
{
|
|
35
|
+
"name": "auto-responsive",
|
|
36
|
+
"description": "Enables the auto responsive mode in which the component automatically creates and adjusts\ncolumns based on the container's width. Columns have a fixed width defined by `columnWidth`\nand their number increases up to the limit set by `maxColumns`. The component dynamically\nadjusts the number of columns as the container size changes. When this mode is enabled,\nthe `responsiveSteps` are ignored.\n\nBy default, each field is placed on a new row. To organize fields into rows, there are\ntwo options:\n\n1. Use `<vaadin-form-row>` to explicitly group fields into rows.\n\n2. Enable the `autoRows` property to automatically arrange fields in available columns,\n wrapping to a new row when necessary. `<br>` elements can be used to force a new row.",
|
|
37
|
+
"value": {
|
|
38
|
+
"type": [
|
|
39
|
+
"boolean",
|
|
40
|
+
"null",
|
|
41
|
+
"undefined"
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "column-width",
|
|
47
|
+
"description": "When `autoResponsive` is enabled, defines the width of each column.\nThe value must be defined in CSS length units, e.g., `100px` or `13em`.\nThe default value is `13em`.",
|
|
48
|
+
"value": {
|
|
49
|
+
"type": [
|
|
50
|
+
"string",
|
|
51
|
+
"null",
|
|
52
|
+
"undefined"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "max-columns",
|
|
58
|
+
"description": "When `autoResponsive` is enabled, defines the maximum number of columns\nthat the layout can create. The layout will create columns up to this\nlimit based on the available container width. The default value is `10`.",
|
|
59
|
+
"value": {
|
|
60
|
+
"type": [
|
|
61
|
+
"number",
|
|
62
|
+
"null",
|
|
63
|
+
"undefined"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "auto-rows",
|
|
69
|
+
"description": "When enabled with `autoResponsive`, distributes fields across columns\nby placing each field in the next available column and wrapping to\nthe next row when the current row is full. `<br>` elements can be\nused to force a new row.",
|
|
70
|
+
"value": {
|
|
71
|
+
"type": [
|
|
72
|
+
"boolean",
|
|
73
|
+
"null",
|
|
74
|
+
"undefined"
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "labels-aside",
|
|
80
|
+
"description": "When enabled with `autoResponsive`, `<vaadin-form-item>` prefers positioning\nlabels beside the fields. If the layout is too narrow to fit a single column\nwith side labels, they revert to their default position above the fields.\n\nTo customize the label width and the gap between the label and the field,\nuse the following CSS properties:\n\n- `--vaadin-form-layout-label-width`\n- `--vaadin-form-layout-label-spacing`",
|
|
81
|
+
"value": {
|
|
82
|
+
"type": [
|
|
83
|
+
"boolean",
|
|
84
|
+
"null",
|
|
85
|
+
"undefined"
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "expand-columns",
|
|
91
|
+
"description": "When `autoResponsive` is enabled, specifies whether the columns should expand\nin width to evenly fill any remaining space after the layout has created as\nmany fixed-width (`columnWidth`) columns as possible within the `maxColumns`\nlimit. The default value is `false`.",
|
|
92
|
+
"value": {
|
|
93
|
+
"type": [
|
|
94
|
+
"boolean",
|
|
95
|
+
"null",
|
|
96
|
+
"undefined"
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "expand-fields",
|
|
102
|
+
"description": "When `autoResponsive` is enabled, specifies whether fields should stretch\nto take up all available space within columns. This setting also applies\nto fields inside `<vaadin-form-item>` elements. The default value is `false`.",
|
|
103
|
+
"value": {
|
|
104
|
+
"type": [
|
|
105
|
+
"boolean",
|
|
106
|
+
"null",
|
|
107
|
+
"undefined"
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
},
|
|
34
111
|
{
|
|
35
112
|
"name": "theme",
|
|
36
113
|
"description": "The theme variants to apply to the component.",
|
|
@@ -53,10 +130,108 @@
|
|
|
53
130
|
"Array.<FormLayoutResponsiveStep>"
|
|
54
131
|
]
|
|
55
132
|
}
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "autoResponsive",
|
|
136
|
+
"description": "Enables the auto responsive mode in which the component automatically creates and adjusts\ncolumns based on the container's width. Columns have a fixed width defined by `columnWidth`\nand their number increases up to the limit set by `maxColumns`. The component dynamically\nadjusts the number of columns as the container size changes. When this mode is enabled,\nthe `responsiveSteps` are ignored.\n\nBy default, each field is placed on a new row. To organize fields into rows, there are\ntwo options:\n\n1. Use `<vaadin-form-row>` to explicitly group fields into rows.\n\n2. Enable the `autoRows` property to automatically arrange fields in available columns,\n wrapping to a new row when necessary. `<br>` elements can be used to force a new row.",
|
|
137
|
+
"value": {
|
|
138
|
+
"type": [
|
|
139
|
+
"boolean",
|
|
140
|
+
"null",
|
|
141
|
+
"undefined"
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"name": "columnWidth",
|
|
147
|
+
"description": "When `autoResponsive` is enabled, defines the width of each column.\nThe value must be defined in CSS length units, e.g., `100px` or `13em`.\nThe default value is `13em`.",
|
|
148
|
+
"value": {
|
|
149
|
+
"type": [
|
|
150
|
+
"string",
|
|
151
|
+
"null",
|
|
152
|
+
"undefined"
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"name": "maxColumns",
|
|
158
|
+
"description": "When `autoResponsive` is enabled, defines the maximum number of columns\nthat the layout can create. The layout will create columns up to this\nlimit based on the available container width. The default value is `10`.",
|
|
159
|
+
"value": {
|
|
160
|
+
"type": [
|
|
161
|
+
"number",
|
|
162
|
+
"null",
|
|
163
|
+
"undefined"
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"name": "autoRows",
|
|
169
|
+
"description": "When enabled with `autoResponsive`, distributes fields across columns\nby placing each field in the next available column and wrapping to\nthe next row when the current row is full. `<br>` elements can be\nused to force a new row.",
|
|
170
|
+
"value": {
|
|
171
|
+
"type": [
|
|
172
|
+
"boolean",
|
|
173
|
+
"null",
|
|
174
|
+
"undefined"
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"name": "labelsAside",
|
|
180
|
+
"description": "When enabled with `autoResponsive`, `<vaadin-form-item>` prefers positioning\nlabels beside the fields. If the layout is too narrow to fit a single column\nwith side labels, they revert to their default position above the fields.\n\nTo customize the label width and the gap between the label and the field,\nuse the following CSS properties:\n\n- `--vaadin-form-layout-label-width`\n- `--vaadin-form-layout-label-spacing`",
|
|
181
|
+
"value": {
|
|
182
|
+
"type": [
|
|
183
|
+
"boolean",
|
|
184
|
+
"null",
|
|
185
|
+
"undefined"
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"name": "expandColumns",
|
|
191
|
+
"description": "When `autoResponsive` is enabled, specifies whether the columns should expand\nin width to evenly fill any remaining space after the layout has created as\nmany fixed-width (`columnWidth`) columns as possible within the `maxColumns`\nlimit. The default value is `false`.",
|
|
192
|
+
"value": {
|
|
193
|
+
"type": [
|
|
194
|
+
"boolean",
|
|
195
|
+
"null",
|
|
196
|
+
"undefined"
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"name": "expandFields",
|
|
202
|
+
"description": "When `autoResponsive` is enabled, specifies whether fields should stretch\nto take up all available space within columns. This setting also applies\nto fields inside `<vaadin-form-item>` elements. The default value is `false`.",
|
|
203
|
+
"value": {
|
|
204
|
+
"type": [
|
|
205
|
+
"boolean",
|
|
206
|
+
"null",
|
|
207
|
+
"undefined"
|
|
208
|
+
]
|
|
209
|
+
}
|
|
56
210
|
}
|
|
57
211
|
],
|
|
58
212
|
"events": []
|
|
59
213
|
}
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"name": "vaadin-form-row",
|
|
217
|
+
"description": "`<vaadin-form-row>` is a web component for arranging fields into rows\ninside a `<vaadin-form-layout>` that is set to autoResponsive mode.\n\nEach `<vaadin-form-row>` always starts on a new row. Fields that exceed\nthe available columns wrap to a new row, which then remains reserved\nexclusively for the fields of that `<vaadin-form-row>` element.",
|
|
218
|
+
"attributes": [
|
|
219
|
+
{
|
|
220
|
+
"name": "theme",
|
|
221
|
+
"description": "The theme variants to apply to the component.",
|
|
222
|
+
"value": {
|
|
223
|
+
"type": [
|
|
224
|
+
"string",
|
|
225
|
+
"null",
|
|
226
|
+
"undefined"
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
],
|
|
231
|
+
"js": {
|
|
232
|
+
"properties": [],
|
|
233
|
+
"events": []
|
|
234
|
+
}
|
|
60
235
|
}
|
|
61
236
|
]
|
|
62
237
|
}
|