Skip to content

Commit

Permalink
subtract form layout row spacing from form item margin
Browse files Browse the repository at this point in the history
  • Loading branch information
vursen committed Feb 5, 2025
1 parent 3b2043f commit fec1f8a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/form-layout/src/vaadin-form-layout-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const formLayoutStyles = css`
--vaadin-form-layout-row-spacing: 1em;
--vaadin-form-layout-column-spacing: 2em; /* (default) */
align-self: stretch;
padding-block: calc(var(--vaadin-form-layout-row-spacing) / 2);
}
:host([hidden]) {
Expand Down Expand Up @@ -52,7 +53,7 @@ export const formItemStyles = css`
1. Use --vaadin-form-layout-row-spacing on the <vaadin-form-layout> component to control the gap between rows.
2. Use standard CSS margin on <vaadin-form-layout> to control the spacing around the form layout itself.
*/
margin: calc(0.5 * var(--vaadin-form-item-row-spacing)) 0;
margin: calc((var(--vaadin-form-item-row-spacing) - var(--vaadin-form-layout-row-spacing)) / 2) 0;
}
:host([label-position='top']) {
Expand Down
2 changes: 1 addition & 1 deletion packages/form-layout/test/visual/lumo/form-layout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ describe('form-layout', () => {
<style>
vaadin-form-layout {
--vaadin-form-layout-column-spacing: 4em;
--vaadin-form-layout-row-spacing: 1.25em;
}
vaadin-form-item {
--vaadin-form-item-label-width: 6em;
--vaadin-form-item-label-spacing: 1em;
--vaadin-form-item-row-spacing: 1.25em;
}
</style>
<vaadin-form-layout id="tests">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ describe('form-layout', () => {
<style>
vaadin-form-layout {
--vaadin-form-layout-column-spacing: 4em;
--vaadin-form-layout-row-spacing: 1.25em;
}
vaadin-form-item {
--vaadin-form-item-label-width: 6em;
--vaadin-form-item-label-spacing: 1em;
--vaadin-form-layout-row-spacing: 1.25em;
}
</style>
<vaadin-form-layout id="tests">
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fec1f8a

Please sign in to comment.