diff --git a/core/api.txt b/core/api.txt index 2c9d5da752..b859faee3a 100644 --- a/core/api.txt +++ b/core/api.txt @@ -1040,7 +1040,7 @@ ion-tab-button,prop,layout,"icon-bottom" | "icon-end" | "icon-hide" | "icon-star ion-tab-button,prop,mode,"ios" | "md",undefined,false ion-tab-button,prop,tab,string,undefined,false ion-tab-button,css-prop,--background -ion-tab-button,css-prop,--background-selected +ion-tab-button,css-prop,--background-focused ion-tab-button,css-prop,--color ion-tab-button,css-prop,--color-selected ion-tab-button,css-prop,--padding-bottom diff --git a/core/src/components/tab-bar/tab-bar.ios.scss b/core/src/components/tab-bar/tab-bar.ios.scss index 227667e8c4..884d793699 100644 --- a/core/src/components/tab-bar/tab-bar.ios.scss +++ b/core/src/components/tab-bar/tab-bar.ios.scss @@ -1,5 +1,6 @@ @import "./tab-bar"; @import "../../themes/ionic.globals.ios"; +@import "../tab-button/tab-button.ios.vars"; // iOS Tabs // -------------------------------------------------- @@ -7,7 +8,10 @@ :host { // default color / background --background: #{$tabbar-ios-background}; + --background-focused: #{$tabbar-ios-background-focused}; --border: #{$hairlines-width solid $tabbar-ios-border-color}; + --color: #{$tab-button-ios-text-color}; + --color-selected: #{$tabbar-ios-color-activated}; height: 50px; } @@ -15,7 +19,7 @@ // iOS Translucent Tab bar // -------------------------------------------------- -:host(.tabbar-translucent) { +:host(.tab-bar-translucent) { background-color: #{current-color(base, .8)}; backdrop-filter: saturate(210%) blur(20px); } diff --git a/core/src/components/tab-bar/tab-bar.md.scss b/core/src/components/tab-bar/tab-bar.md.scss index 95833e78f8..2366f9380d 100644 --- a/core/src/components/tab-bar/tab-bar.md.scss +++ b/core/src/components/tab-bar/tab-bar.md.scss @@ -1,10 +1,14 @@ @import "./tab-bar"; @import "../../themes/ionic.globals.md"; +@import "../tab-button/tab-button.md.vars"; :host { // default color / background --background: #{$tabbar-md-background}; + --background-focused: #{$tabbar-md-background-focused}; --border: #{1px solid $tabbar-md-border-color}; + --color: #{$tab-button-md-text-color}; + --color-selected: #{$tabbar-md-color-activated}; height: 56px; } diff --git a/core/src/components/tab-bar/tab-bar.scss b/core/src/components/tab-bar/tab-bar.scss index 4131147271..ed8ef76d45 100644 --- a/core/src/components/tab-bar/tab-bar.scss +++ b/core/src/components/tab-bar/tab-bar.scss @@ -33,15 +33,18 @@ box-sizing: content-box !important; } -:host(.ion-color) { +:host(.ion-color), +:host(.ion-color) ::slotted(ion-tab-button) { background: #{current-color(base)}; + color: #{current-color(contrast, .7)}; } :host(.ion-color) ::slotted(ion-tab-button) { --background-focused: #{current-color(shade)}; - --color-selected: #{current-color(contrast)};; +} - color: #{current-color(contrast, .7)}; +:host(.ion-color) ::slotted(.tab-selected) { + color: #{current-color(contrast)};; } :host([slot="top"]) { @@ -51,7 +54,7 @@ border-bottom: var(--border); } -:host(.tabbar-hidden) { +:host(.tab-bar-hidden) { /* stylelint-disable-next-line declaration-no-important */ display: none !important; } diff --git a/core/src/components/tab-bar/tab-bar.tsx b/core/src/components/tab-bar/tab-bar.tsx index 07afcfed45..6924f263e5 100644 --- a/core/src/components/tab-bar/tab-bar.tsx +++ b/core/src/components/tab-bar/tab-bar.tsx @@ -74,8 +74,8 @@ export class TabBar implements ComponentInterface { 'aria-hidden': keyboardVisible ? 'true' : null, class: { ...createColorClasses(color), - 'tabbar-translucent': translucent, - 'tabbar-hidden': keyboardVisible, + 'tab-bar-translucent': translucent, + 'tab-bar-hidden': keyboardVisible, } }; } diff --git a/core/src/components/tab-bar/test/custom/e2e.ts b/core/src/components/tab-bar/test/custom/e2e.ts new file mode 100644 index 0000000000..6ca6a6f4aa --- /dev/null +++ b/core/src/components/tab-bar/test/custom/e2e.ts @@ -0,0 +1,10 @@ +import { newE2EPage } from '@stencil/core/testing'; + +test('tab-bar: custom', async () => { + const page = await newE2EPage({ + url: '/src/components/tab-bar/test/custom?ionic:_testing=true' + }); + + const compare = await page.compareScreenshot(); + expect(compare).toMatchScreenshot(); +}); diff --git a/core/src/components/tab-bar/test/custom/index.html b/core/src/components/tab-bar/test/custom/index.html new file mode 100644 index 0000000000..7539ec12a4 --- /dev/null +++ b/core/src/components/tab-bar/test/custom/index.html @@ -0,0 +1,202 @@ + + + + + + Tab Bar - Custom + + + + + + + + + + + + + + Recents + + + + + Favorites + 6 + + + + + Settings + + + + + + + + Recents + + + + + Favorites + 6 + + + + + Settings + + + + + + + + Recents + + + + + Favorites + 6 + + + + + Settings + + + + + + + + Recents + + + + + Favorites + 6 + + + + + Settings + + + + + + + + Recents + + + + + Favorites + 6 + + + + + Settings + + + + + + + + Recents + + + + + + + + + Settings + + + + + + + + + diff --git a/core/src/components/tab-bar/test/scenarios/index.html b/core/src/components/tab-bar/test/scenarios/index.html index 813a547b31..10e2915b9b 100644 --- a/core/src/components/tab-bar/test/scenarios/index.html +++ b/core/src/components/tab-bar/test/scenarios/index.html @@ -193,7 +193,7 @@ - + @@ -235,7 +235,10 @@ height: 80px; background: #3880ff; color: white; - font-size: 16px; + } + + .main-tab-icon { + font-size: 36px; } .custom-tabbar-color { diff --git a/core/src/components/tab-button/readme.md b/core/src/components/tab-button/readme.md index 9a3a9a6995..c9988bf7dc 100644 --- a/core/src/components/tab-button/readme.md +++ b/core/src/components/tab-button/readme.md @@ -71,17 +71,17 @@ See the [tabs documentation](../tabs) for more details on configuring tabs. ## CSS Custom Properties -| Name | Description | -| ----------------------- | ------------------------------------- | -| `--background` | Background of the tab button | -| `--background-selected` | Background of the selected tab button | -| `--color` | Color of the tab button | -| `--color-selected` | Color of the selected tab button | -| `--padding-bottom` | Bottom padding of the tab button | -| `--padding-end` | End padding of the tab button | -| `--padding-start` | Start padding of the tab button | -| `--padding-top` | Top padding of the tab button | -| `--ripple-color` | Color of the button ripple effect | +| Name | Description | +| ---------------------- | ------------------------------------ | +| `--background` | Background of the tab button | +| `--background-focused` | Background of the focused tab button | +| `--color` | Color of the tab button | +| `--color-selected` | Color of the selected tab button | +| `--padding-bottom` | Bottom padding of the tab button | +| `--padding-end` | End padding of the tab button | +| `--padding-start` | Start padding of the tab button | +| `--padding-top` | Top padding of the tab button | +| `--ripple-color` | Color of the button ripple effect | ---------------------------------------------- diff --git a/core/src/components/tab-button/tab-button.ios.scss b/core/src/components/tab-button/tab-button.ios.scss index b617df9ae0..851c1d976f 100644 --- a/core/src/components/tab-button/tab-button.ios.scss +++ b/core/src/components/tab-button/tab-button.ios.scss @@ -6,10 +6,6 @@ --padding-end: #{$tab-button-ios-padding-end}; --padding-bottom: #{$tab-button-ios-padding-bottom}; --padding-start: #{$tab-button-ios-padding-start}; - --color: #{$tab-button-ios-text-color}; - --color-selected: #{$tabbar-ios-color-activated}; - --background: transparent; - --background-focused: #{$tabbar-ios-background-focused}; max-width: $tab-button-ios-max-width; diff --git a/core/src/components/tab-button/tab-button.md.scss b/core/src/components/tab-button/tab-button.md.scss index dfc6175581..e420321b4b 100644 --- a/core/src/components/tab-button/tab-button.md.scss +++ b/core/src/components/tab-button/tab-button.md.scss @@ -9,10 +9,6 @@ --padding-end: #{$tab-button-md-padding-end}; --padding-bottom: #{$tab-button-md-padding-bottom}; --padding-start: #{$tab-button-md-padding-start}; - --color: #{$tab-button-md-text-color}; - --color-selected: #{$tabbar-md-color-activated}; - --background: transparent; - --background-focused: #{$tabbar-md-background-focused}; max-width: 168px; diff --git a/core/src/components/tab-button/tab-button.scss b/core/src/components/tab-button/tab-button.scss index 8ba3246a13..19eab948a5 100644 --- a/core/src/components/tab-button/tab-button.scss +++ b/core/src/components/tab-button/tab-button.scss @@ -3,13 +3,16 @@ :host { /** * @prop --background: Background of the tab button - * @prop --background-selected: Background of the selected tab button + * @prop --background-focused: Background of the focused tab button + * * @prop --color: Color of the tab button * @prop --color-selected: Color of the selected tab button + * * @prop --padding-top: Top padding of the tab button * @prop --padding-end: End padding of the tab button * @prop --padding-bottom: Bottom padding of the tab button * @prop --padding-start: Start padding of the tab button + * * @prop --ripple-color: Color of the button ripple effect */ --ripple-color: var(--color-selected); @@ -22,6 +25,7 @@ height: 100%; + background: var(--background); color: var(--color); } @@ -47,7 +51,7 @@ a { outline: none; - background: var(--background); + background: transparent; text-decoration: none;