Skip to content

Commit 17b8468

Browse files
style(segment-button): add and update color to slotted children for improved styling consistency (#30905)
Issue number: resolves internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> - Previously in iOS, when using something different than the `ion-label` to add a text inside the `segment-button`, the default color attributed to it was blue. <img width="357" height="103" alt="image" src="https://github.com/user-attachments/assets/2196e548-f0b7-4e7f-b093-e58c88b2a6cb" /> - In Android, the expected color is not attributed either, but it defaults to black instead of blue. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Now, all the slotted elements will respect the color defined by the `color` CSS variable. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
1 parent abb9506 commit 17b8468

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

core/src/components/segment-button/segment-button.ionic.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
--background: none;
1212
--background-checked: var(--background);
13-
--color: #{globals.$ion-primitives-neutral-1000};
13+
--color: #{globals.$ion-primitives-neutral-1200};
1414
--color-checked: #{globals.$ion-semantics-primary-base};
1515
--color-disabled: #{globals.$ion-primitives-neutral-500};
1616
--border-width: #{globals.$ion-border-size-025};
@@ -44,13 +44,15 @@
4444
gap: globals.$ion-space-100;
4545
}
4646

47+
::slotted(*) {
48+
color: var(--color);
49+
}
50+
4751
// Segment Button Label
4852
// --------------------------------------------------
4953

5054
::slotted(ion-label) {
5155
@include globals.typography(globals.$ion-body-action-sm);
52-
53-
color: var(--color);
5456
}
5557

5658
// Segment Button Icon
@@ -59,8 +61,6 @@
5961
::slotted(ion-icon) {
6062
width: globals.$ion-scale-600;
6163
height: globals.$ion-scale-600;
62-
63-
color: var(--color);
6464
}
6565

6666
// Segment Button: Checked

0 commit comments

Comments
 (0)