Skip to content

Commit 338a405

Browse files
fix(tab-bar): adjust badge positioning for ionic theme (#30977)
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? The badge positioning for the tab bar did not match our design specifications. ## What is the new behavior? Updates the tab bar badge to be positioned according to design specifications. ## 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. --> [Preview](https://ionic-framework-git-rou-12460-fix-badge-positioning-ionic1.vercel.app/src/components/tab-bar/test/basic/?ionic:theme=ionic) --------- Co-authored-by: ionitron <hi@ionicframework.com>
1 parent 5d04106 commit 338a405

8 files changed

+8
-2
lines changed
-864 Bytes
Loading
Loading
Loading
-533 Bytes
Loading
-516 Bytes
Loading
-682 Bytes
Loading

core/src/components/tab-bar/test/basic/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
<ion-tab-button tab="1">
100100
<ion-icon name="heart"></ion-icon>
101101
<ion-label>Favorites</ion-label>
102-
<ion-badge color="danger"></ion-badge>
102+
<ion-badge color="danger" size="medium"></ion-badge>
103103
</ion-tab-button>
104104

105105
<ion-tab-button tab="2">

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,13 @@
103103
// --------------------------------------------------
104104

105105
:host ::slotted(ion-badge) {
106-
@include globals.position(null, null, null, calc(50% + globals.$ion-scale-300));
106+
@include globals.position(calc(globals.$ion-scale-100 * -2), null, null, calc(50% + globals.$ion-scale-300));
107+
transform: translateX(-50%);
108+
}
109+
110+
// Status badge (empty) needs less offset to overlap the icon
111+
:host ::slotted(ion-badge:empty) {
112+
@include globals.position(calc(globals.$ion-scale-100 * -1), null, null, calc(50% + globals.$ion-scale-250));
107113
}
108114

109115
:host ::slotted(ion-badge.badge-vertical-top) {

0 commit comments

Comments
 (0)