Skip to content

Commit 503bc3c

Browse files
authored
feat(radio-group): group label styles (#15792)
1 parent 2f6874a commit 503bc3c

File tree

6 files changed

+214
-106
lines changed

6 files changed

+214
-106
lines changed

projects/igniteui-angular/src/lib/core/styles/components/label/_label-theme.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111

1212
/// @param {Map} $schema [$light-material-schema] - The schema used as basis for styling the component.
1313
/// @param {Map} $color [null] - The text color.
14+
/// @param {Map} $disabled-color [null] - The disabled text color.
1415
@function label-theme(
1516
$schema: $light-material-schema,
16-
$color: null
17+
$color: null,
18+
$disabled-color: null,
1719
) {
1820
$name: 'igx-label';
1921
$selector: '[igxLabel]';
@@ -31,6 +33,7 @@
3133
name: $name,
3234
selector: $selector,
3335
color: $color,
36+
disabled-color: $disabled-color,
3437
theme: map.get($schema, '_meta', 'theme'),
3538
variant: map.get($schema, '_meta', 'theme'),
3639
));

projects/igniteui-angular/src/lib/core/styles/components/radio/_radio-component.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@
115115
@include e(label) {
116116
@extend %radio-label--disabled !optional;
117117
}
118+
119+
@include e(label, $m: before) {
120+
@extend %radio-label--disabled !optional;
121+
}
118122
}
119123

120124
@include m(invalid) {
@@ -217,5 +221,13 @@
217221
@include m(vertical) {
218222
@extend %radio-group-display--vertical !optional;
219223
}
224+
225+
@include m(before) {
226+
@extend %radio-group-display--before !optional;
227+
}
228+
229+
@include m(disabled) {
230+
@extend %radio-group-display--disabled !optional;
231+
}
220232
}
221233
}

projects/igniteui-angular/src/lib/core/styles/components/radio/_radio-theme.scss

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -597,18 +597,40 @@
597597
}
598598

599599
%radio-group-display {
600-
display: block;
601-
%radio-display:not(:last-of-type) {
602-
margin-inline-end: $horizontal-group-margin;
600+
display: grid;
601+
column-gap: $horizontal-group-margin;
602+
align-items: start;
603+
width: max-content;
604+
}
605+
606+
%radio-group-display:not(%radio-group-display--vertical) {
607+
[igxLabel] {
608+
margin-block-end: rem(16px);
609+
}
610+
611+
igx-radio {
612+
grid-row: 2;
603613
}
604614
}
605615

606616
%radio-group-display--vertical {
607-
display: flex;
608-
flex-flow: column;
609-
%radio-display:not(:last-of-type) {
610-
margin-inline-end: 0;
611-
margin-block-end: $vertical-group-margin;
617+
row-gap: $vertical-group-margin;
618+
619+
[igxLabel] {
620+
margin-block-end: if($variant == 'material', rem(16px), rem(8px));
621+
}
622+
623+
&%radio-group-display--before {
624+
igx-radio,
625+
[igxLabel] {
626+
justify-self: flex-end;
627+
}
628+
}
629+
}
630+
631+
%radio-group-display--disabled {
632+
[igxLabel] {
633+
color: var-get($theme, 'disabled-color');
612634
}
613635
}
614636
}

projects/igniteui-angular/src/lib/directives/radio/radio-group.directive.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,3 +448,4 @@ const dispatchRadioEvent = (eventName, radioNativeElement, fixture) => {
448448
radioNativeElement.dispatchEvent(new Event(eventName));
449449
fixture.detectChanges();
450450
};
451+

0 commit comments

Comments
 (0)