Skip to content

Commit d1f0712

Browse files
feat(toggle): add new styles for press state
1 parent be6a690 commit d1f0712

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

core/src/components/toggle/toggle.ionic.scss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// -----------------------------------------
66

77
:host {
8-
--track-background: #{globals.$ion-primitives-neutral-800};
8+
--track-background: #{globals.$ion-primitives-neutral-500};
99
--track-background-checked: #{globals.ion-color(primary, base)};
1010
--border-radius: #{globals.$ion-border-radius-full};
1111
--focus-ring-color: #{globals.$ion-border-focus-default};
@@ -82,9 +82,12 @@
8282

8383
// Toggle Native Wrapper: Pressed
8484
// ----------------------------------------------------------------
85+
:host(.ion-activated) .toggle-icon {
86+
background: globals.$ion-bg-neutral-base-press;
87+
}
8588

86-
:host(.ion-activated) .toggle-icon::after {
87-
@include globals.pressed-state();
89+
:host(.ion-activated.toggle-checked) .toggle-icon {
90+
background: globals.$ion-bg-primary-base-press;
8891
}
8992

9093
// Ionic Toggle: Disabled

core/src/themes/ionic/ionic.mixins.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
// }
1313
//
1414
// --------------------------------------------------
15-
@mixin pressed-state() {
15+
@mixin pressed-state($color: null) {
16+
$color: if($color != null, $color, tokens.$ion-state-press);
17+
1618
@include mixins.position(0, 0, 0, 0);
1719

1820
position: absolute;
1921

20-
background-color: tokens.$ion-state-press;
22+
background-color: $color;
2123

2224
content: "";
2325
}

0 commit comments

Comments
 (0)