New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ui5-form): introduce Form web component #8281
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check why the breakpoint is not changed on the corresponding sizes? S breakpoint starts from around 630px when it has to start from 600<
packages/main/src/Form.ts
Outdated
* @public | ||
*/ | ||
@property({ type: FormItemSpacing, defaultValue: FormItemSpacing.Normal }) | ||
itemSpacing!: FormItemSpacing; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: use template literals for properties of type enum. also applying for form item and form group item.
The change introduces several components - Form, FormGroup and FormItem to build application forms easier and according to latest design guidelines.
Overview
The Form is a layout component that arranges labels and form fields (like input fields) pairs
into specific number of columns.
Structure
The simplest Form consists of a header area on top, displaying a header text and content below - arbitrary number of FormItems, representing the pairs of label and form field.
And, there is also "grouping", enabled by the FormGroup component.
Responsiveness
The Form component reacts and changes its layout on predefined breakpoints.
Depending on its size, the Form content (FormGroups and FormItems) gets divided into one or more columns as follows:
To change the layout, use the
layout
property - f.e. layout="S1 M2 L3 XL6".Note: there is no restriction of the column numbers (f.e you can specify XL9 and get the layout divided in to 9 columns), however recommendations are based on our experience to best suite known use-cases.
Form Groups Distribution
To make better use of screen space, there is built-in logic to calculate how many columns should a FormGroup occupy.
Note: The size of a group element is determined by the number of FormItems assigned to it.
In case of equality, the first in the DOM will use more columns and the last - less columns.
Form Group
column-span
To influence the built-in group distribution, you can use the FormGroup's columnSpan property,
that defines how many columns the group should expand to.
Form Item's Label Placement
By default, the labels take 4/12 of the FormItem, leaving 8/12 parts to associated fields.
You can control what space the labels should take via the labelSpan property
For example:
API
Form
props
slots
Form Group
props
slots
Form Item
slots
Test Pages
Fixes: #7854