diff --git a/core/src/components/checkbox/checkbox.scss b/core/src/components/checkbox/checkbox.scss
index 24188dbc33..9f2b6269ea 100644
--- a/core/src/components/checkbox/checkbox.scss
+++ b/core/src/components/checkbox/checkbox.scss
@@ -1,4 +1,5 @@
@import "../../themes/ionic.globals";
+@import "./checkbox.vars.scss";
// Checkbox
// --------------------------------------------------
@@ -103,6 +104,10 @@
overflow: hidden;
}
+:host(.in-item:not(.legacy-checkbox)) .label-text-wrapper {
+ @include margin($checkbox-item-label-margin-top, null, $checkbox-item-label-margin-bottom, null);
+}
+
/**
* If no label text is placed into the slot
* then the element should be hidden otherwise
@@ -194,7 +199,7 @@ input {
* the checkbox should be on the end
* when the label sits at the start.
*/
- @include margin(0, $form-control-label-margin, 0, 0);
+ @include margin(null, $form-control-label-margin, null, 0);
}
@@ -215,7 +220,7 @@ input {
* when the label sits at the end.
*/
:host(.checkbox-label-placement-end) .label-text-wrapper {
- @include margin(0, 0, 0, $form-control-label-margin);
+ @include margin(null, 0, null, $form-control-label-margin);
}
@@ -228,7 +233,7 @@ input {
* the checkbox should be on the end
* when the label sits at the start.
*/
- @include margin(0, $form-control-label-margin, 0, 0);
+ @include margin(null, $form-control-label-margin, null, 0);
}
/**
diff --git a/core/src/components/checkbox/checkbox.vars.scss b/core/src/components/checkbox/checkbox.vars.scss
new file mode 100644
index 0000000000..2116a369e8
--- /dev/null
+++ b/core/src/components/checkbox/checkbox.vars.scss
@@ -0,0 +1,5 @@
+/// @prop - Top margin of checkbox's label when in an item
+$checkbox-item-label-margin-top: 10px !default;
+
+/// @prop - Bottom margin of checkbox's label when in an item
+$checkbox-item-label-margin-bottom: 10px !default;
\ No newline at end of file
diff --git a/core/src/components/checkbox/test/item/checkbox.e2e.ts b/core/src/components/checkbox/test/item/checkbox.e2e.ts
index 676d8ebf75..7162857e85 100644
--- a/core/src/components/checkbox/test/item/checkbox.e2e.ts
+++ b/core/src/components/checkbox/test/item/checkbox.e2e.ts
@@ -50,3 +50,24 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
});
});
});
+
+configs({ directions: ['ltr'], modes: ['md'] }).forEach(({ title, screenshot, config }) => {
+ test.describe(title('checkbox: long label in item'), () => {
+ test('should render margins correctly when using long label in item', async ({ page }) => {
+ await page.setContent(
+ `
+