You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(tab-bar): add hideOnScroll for ionic theme (#31085)
Issue number: 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. -->
This pull request introduces a new feature to the `ion-tab-bar`
component that allows it to automatically hide when the user scrolls
down and reappear when scrolling up.
## What is the current behavior?
- Missing `hide-on-scroll` feature
## What is the new behavior?
- New Hide-on-Scroll Feature for Tab Bar
## What was done?
*Component Logic & API:*
- Added a new `hideOnScroll` property to `ion-tab-bar`, enabling
automatic hide/show behavior based on scroll direction when the theme is
`"ionic"` and `expand` is `"compact"`. The scroll listener is attached
to the nearest `ion-content` for scroll detection.
(`core/src/components/tab-bar/tab-bar.tsx`, `core/api.txt`)
[[1]](diffhunk://#diff-4524448d8146967e9d7ca6409b76b56db889c6bc42c7d4c911d8b3f1a80d5dbaR67-R73)
[[2]](diffhunk://#diff-4524448d8146967e9d7ca6409b76b56db889c6bc42c7d4c911d8b3f1a80d5dbaR125-R126)
[[3]](diffhunk://#diff-4524448d8146967e9d7ca6409b76b56db889c6bc42c7d4c911d8b3f1a80d5dbaR169-R226)
[[4]](diffhunk://#diff-4524448d8146967e9d7ca6409b76b56db889c6bc42c7d4c911d8b3f1a80d5dbaL172-R246)
[[5]](diffhunk://#diff-4524448d8146967e9d7ca6409b76b56db889c6bc42c7d4c911d8b3f1a80d5dbaR259-R260)
[[6]](diffhunk://#diff-5e21becb925e949068c3cbefae90d040401eaf39874bfd1336d93a3cd8d64809R2403)
*Styling:*
- Updated SCSS to handle the hide/show animation and positioning for the
tab bar when `hideOnScroll` is enabled, including transitions and
transforms for both bottom and top slots.
(`core/src/components/tab-bar/tab-bar.ionic.scss`)
[[1]](diffhunk://#diff-fe63470b419227d79e943ff7370a337e9f273fbcd76d1d420916292e13126db7R73-R81)
[[2]](diffhunk://#diff-fe63470b419227d79e943ff7370a337e9f273fbcd76d1d420916292e13126db7R93-R111)
*Framework Integrations:*
- Updated Angular proxies to support the new `hideOnScroll` input,
ensuring compatibility with Angular apps.
(`packages/angular/src/directives/proxies.ts`,
`packages/angular/standalone/src/directives/proxies.ts`)
[[1]](diffhunk://#diff-1fd76195dbb521bd6fc15558ddb677c06cd4a94d7541ecdea25409b875ea71daL2373-R2380)
[[2]](diffhunk://#diff-23bd4dda0490183f78acea6eb747bfab3091a16ce2e1d4710f4c194669597628L2116-R2123)
*Testing & Documentation:*
- Added a new test page demonstrating the hide-on-scroll behavior, along
with usage requirements and visual confirmation.
(`core/src/components/tab-bar/test/hide-on-scroll/index.html`)
## 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
- This prop will only affect Ionic theme;
- `ion-tab-bar` expand property must be set to compact;
- It should be used inside an `ion-footer`;
---------
Co-authored-by: ionitron <hi@ionicframework.com>
* If `true`, the tab bar will be hidden when the user scrolls down and shown when the user scrolls up. Only applies when the theme is `"ionic"` and `expand` is `"compact"`.
3985
+
* @default false
3986
+
*/
3987
+
"hideOnScroll": boolean;
3983
3988
/**
3984
3989
* The mode determines the platform behaviors of the component.
* If `true`, the tab bar will be hidden when the user scrolls down and shown when the user scrolls up. Only applies when the theme is `"ionic"` and `expand` is `"compact"`.
10087
+
* @default false
10088
+
*/
10089
+
"hideOnScroll"?: boolean;
10080
10090
/**
10081
10091
* The mode determines the platform behaviors of the component.
0 commit comments