Skip to content
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

fix: add space for label before checkbox / radio button #5147

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/default/scss/checkbox/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@
.k-checkbox + .k-checkbox-label,
.k-checkbox-wrap + .k-checkbox-label {
display: inline;
}

.k-checkbox + .k-label,
.k-checkbox-wrap + .k-label,
.k-checkbox + .k-checkbox-label,
.k-checkbox-wrap + .k-checkbox-label,
.k-checkbox-label + .k-checkbox-wrap,
.k-label + .k-checkbox-wrap {
margin-inline-start: $kendo-checkbox-label-margin-x;
}

Expand Down Expand Up @@ -150,7 +158,8 @@
align-content: center;
gap: k-spacing(1);

.k-checkbox-label {
.k-checkbox-label,
.k-checkbox-wrap {
margin: 0;
}
}
Expand Down
12 changes: 10 additions & 2 deletions packages/default/scss/radio/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,16 @@
.k-radio + .k-radio-label,
.k-radio-wrap + .k-radio-label {
display: inline;
margin-inline-start: $kendo-radio-label-margin-x;
}

.k-radio + .k-label,
.k-radio-wrap + .k-label,
.k-radio + .k-radio-label,
.k-radio-wrap + .k-radio-label,
.k-radio-label + .k-radio-wrap,
.k-label + .k-radio-wrap {
margin-inline-start: $kendo-radio-label-margin-x;
}

// Empty label
.k-radio-label:empty {
Expand Down Expand Up @@ -142,7 +149,8 @@
align-content: center;
gap: k-spacing(1);

.k-radio-label {
.k-radio-label,
.k-radio-wrap {
margin: 0;
}
}
Expand Down
11 changes: 10 additions & 1 deletion packages/fluent/scss/checkbox/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@
.k-checkbox + .k-checkbox-label,
.k-checkbox-wrap + .k-checkbox-label {
display: inline;
}

.k-checkbox + .k-label,
.k-checkbox-wrap + .k-label,
.k-checkbox + .k-checkbox-label,
.k-checkbox-wrap + .k-checkbox-label,
.k-checkbox-label + .k-checkbox-wrap,
.k-label + .k-checkbox-wrap {
margin-inline-start: var( --kendo-checkbox-label-margin-x, #{ $kendo-checkbox-label-margin-x } );
}

Expand Down Expand Up @@ -231,7 +239,8 @@
align-content: center;
gap: k-spacing(2);

.k-checkbox-label {
.k-checkbox-label,
.k-checkbox-wrap {
margin: 0;
}
}
Expand Down
12 changes: 10 additions & 2 deletions packages/fluent/scss/radio/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,16 @@
.k-radio + .k-radio-label,
.k-radio-wrap + .k-radio-label {
display: inline;
margin-inline-start: var( --kendo-radio-label-spacing, #{ $kendo-radio-label-spacing } );
}

.k-radio + .k-label,
.k-radio-wrap + .k-label,
.k-radio + .k-radio-label,
.k-radio-wrap + .k-radio-label,
.k-radio-label + .k-radio-wrap,
.k-label + .k-radio-wrap {
margin-inline-start: var( --kendo-radio-label-spacing, #{ $kendo-radio-label-spacing } );
}

// Empty label
.k-radio-label:empty {
Expand Down Expand Up @@ -199,7 +206,8 @@
align-content: center;
gap: var( --kendo-radio-list-item-gap, #{ $kendo-radio-list-item-gap } );

.k-radio-label {
.k-radio-label,
.k-radio-wrap {
margin: 0;
}
}
Expand Down
16 changes: 12 additions & 4 deletions packages/html/src/checkbox/tests/checkbox-label-position.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ export default () => (
<>
<style>{styles}</style>
<div id="test-area" className="k-d-grid">
<span>With Label Before - vertical</span>
<span>With Label After - vertical</span>
<span>Checkbox with label after</span>
<span>Checkbox with label before</span>
<div>
<CheckboxWithLabelAfter id="label-after">Label after</CheckboxWithLabelAfter>
</div>
<div>
<CheckboxWithLabelBefore id="label-before">Label before</CheckboxWithLabelBefore>
</div>
<span>CheckboxGroup with label after - vertical</span>
<span>CheckboxGroup with label before - vertical</span>
<CheckboxGroupNormal>
<CheckboxItem>
<CheckboxWithLabelAfter id="vertical-after-one">First</CheckboxWithLabelAfter>
Expand All @@ -34,8 +42,8 @@ export default () => (
<CheckboxWithLabelBefore id="vertical-before-thee">Third</CheckboxWithLabelBefore>
</CheckboxItem>
</CheckboxGroupNormal>
<span>With Label Before - horizontal</span>
<span>With Label After - horizontal</span>
<span>CheckboxGroup with label after - horizontal</span>
<span>CheckboxGroup with label before - horizontal</span>
<CheckboxGroupHorizontal>
<CheckboxItem>
<CheckboxWithLabelAfter id="horizontal-after-one">First</CheckboxWithLabelAfter>
Expand Down
16 changes: 12 additions & 4 deletions packages/html/src/radio/tests/radio-label-position.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ export default () => (
<>
<style>{styles}</style>
<div id="test-area" className="k-d-grid">
<span>With Label Before - vertical</span>
<span>With Label After - vertical</span>
<span>RadioButton with label after</span>
<span>RadioButton with label before</span>
<div>
<RadioButtonWithLabelAfter id="label-after">Label after</RadioButtonWithLabelAfter>
</div>
<div>
<RadioButtonWithLabelBefore id="label-before">Label before</RadioButtonWithLabelBefore>
</div>
<span>RadioButtonGroup with label after - vertical</span>
<span>RadioButtonGroup with label before - vertical</span>
<RadioGroupNormal>
<RadioItem>
<RadioButtonWithLabelAfter id="vertical-after-one" name="vertical-after">First</RadioButtonWithLabelAfter>
Expand All @@ -34,8 +42,8 @@ export default () => (
<RadioButtonWithLabelBefore id="vertical-before-thee" name="vertical-before">Third</RadioButtonWithLabelBefore>
</RadioItem>
</RadioGroupNormal>
<span>With Label Before - horizontal</span>
<span>With Label After - horizontal</span>
<span>RadioButtonGroup with label after - horizontal</span>
<span>RadioButtonGroup with label before - horizontal</span>
<RadioGroupHorizontal>
<RadioItem>
<RadioButtonWithLabelAfter id="horizontal-after-one" name="horizontal-after">First</RadioButtonWithLabelAfter>
Expand Down
Binary file modified tests/_output/bootstrap/checkbox/checkbox-label-position.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_output/bootstrap/radio/radio-label-position.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_output/classic/checkbox/checkbox-label-position.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_output/classic/radio/radio-label-position.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_output/default/checkbox/checkbox-label-position.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_output/default/radio/radio-label-position.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_output/fluent/checkbox/checkbox-label-position.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_output/fluent/radio/radio-label-position.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_output/material/checkbox/checkbox-label-position.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_output/material/radio/radio-label-position.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_output/nouvelle/checkbox/checkbox-label-position.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/_output/nouvelle/radio/radio-label-position.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 18 additions & 4 deletions tests/checkbox/checkbox-label-position.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,22 @@

</style>
<div id="test-area" class="k-d-grid">
<span>With Label Before - vertical</span>
<span>With Label After - vertical</span>
<span>Checkbox with label after</span>
<span>Checkbox with label before</span>
<div>
<span class="k-checkbox-wrap">
<input id="label-after" type="checkbox" class="k-checkbox k-checkbox-md k-rounded-md">
</span>
<label class="k-checkbox-label" for="label-after">Label after</label>
</div>
<div>
<label class="k-checkbox-label" for="label-before">Label before</label>
<span class="k-checkbox-wrap">
<input id="label-before" type="checkbox" class="k-checkbox k-checkbox-md k-rounded-md">
</span>
</div>
<span>CheckboxGroup with label after - vertical</span>
<span>CheckboxGroup with label before - vertical</span>
<ul class="k-checkbox-list k-list-vertical">
<li class="k-checkbox-list-item">
<span class="k-checkbox-wrap">
Expand Down Expand Up @@ -59,8 +73,8 @@
</span>
</li>
</ul>
<span>With Label Before - horizontal</span>
<span>With Label After - horizontal</span>
<span>CheckboxGroup with label after - horizontal</span>
<span>CheckboxGroup with label before - horizontal</span>
<ul class="k-checkbox-list k-list-horizontal">
<li class="k-checkbox-list-item">
<span class="k-checkbox-wrap">
Expand Down
22 changes: 18 additions & 4 deletions tests/radio/radio-label-position.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,22 @@

</style>
<div id="test-area" class="k-d-grid">
<span>With Label Before - vertical</span>
<span>With Label After - vertical</span>
<span>RadioButton with label after</span>
<span>RadioButton with label before</span>
<div>
<span class="k-radio-wrap">
<input id="label-after" type="radio" class="k-radio k-radio-md">
</span>
<label class="k-radio-label" for="label-after">Label after</label>
</div>
<div>
<label class="k-radio-label" for="label-before">Label before</label>
<span class="k-radio-wrap">
<input id="label-before" type="radio" class="k-radio k-radio-md">
</span>
</div>
<span>RadioButtonGroup with label after - vertical</span>
<span>RadioButtonGroup with label before - vertical</span>
<ul class="k-radio-list k-list-vertical">
<li class="k-radio-list-item">
<span class="k-radio-wrap">
Expand Down Expand Up @@ -59,8 +73,8 @@
</span>
</li>
</ul>
<span>With Label Before - horizontal</span>
<span>With Label After - horizontal</span>
<span>RadioButtonGroup with label after - horizontal</span>
<span>RadioButtonGroup with label before - horizontal</span>
<ul class="k-radio-list k-list-horizontal">
<li class="k-radio-list-item">
<span class="k-radio-wrap">
Expand Down