diff --git a/angular/src/directives/proxies.ts b/angular/src/directives/proxies.ts
index 33691e1114..6588756042 100644
--- a/angular/src/directives/proxies.ts
+++ b/angular/src/directives/proxies.ts
@@ -821,7 +821,7 @@ export class Tab {
}
export declare interface Tabs extends StencilComponents<'IonTabs'> {}
-@Component({ selector: 'ion-tabs', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: '', inputs: ['color', 'name', 'tabbarHidden', 'tabbarHighlight', 'tabbarLayout', 'tabbarPlacement', 'translucent', 'useRouter'] })
+@Component({ selector: 'ion-tabs', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: '', inputs: ['mode', 'color', 'name', 'tabbarHidden', 'tabbarHighlight', 'tabbarLayout', 'tabbarPlacement', 'translucent', 'useRouter'] })
export class Tabs {
ionChange: EventEmitter;
ionNavWillLoad: EventEmitter;
@@ -831,7 +831,7 @@ export class Tabs {
constructor(r: ElementRef) {
const el = r.nativeElement;
proxyMethods(this, el, ['select', 'setRouteId', 'getRouteId', 'getTab', 'getSelected']);
- proxyInputs(this, el, ['color', 'name', 'tabbarHidden', 'tabbarHighlight', 'tabbarLayout', 'tabbarPlacement', 'translucent', 'useRouter']);
+ proxyInputs(this, el, ['mode', 'color', 'name', 'tabbarHidden', 'tabbarHighlight', 'tabbarLayout', 'tabbarPlacement', 'translucent', 'useRouter']);
proxyOutputs(this, el, ['ionChange', 'ionNavWillLoad', 'ionNavWillChange', 'ionNavDidChange']);
}
}
diff --git a/core/src/components.d.ts b/core/src/components.d.ts
index cb29854bf7..55af7e4a9f 100644
--- a/core/src/components.d.ts
+++ b/core/src/components.d.ts
@@ -4595,6 +4595,10 @@ export namespace Components {
*/
'getTab': (tabOrIndex: string | number | HTMLIonTabElement) => Promise;
/**
+ * The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`.
+ */
+ 'mode': Mode;
+ /**
* A unique name for the tabs.
*/
'name'?: string;
@@ -4634,6 +4638,10 @@ export namespace Components {
*/
'color'?: Color;
/**
+ * The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`.
+ */
+ 'mode'?: Mode;
+ /**
* A unique name for the tabs.
*/
'name'?: string;
diff --git a/core/src/components/tabbar/tabbar.tsx b/core/src/components/tabbar/tabbar.tsx
index b0e2293de9..a2f8b1ace6 100644
--- a/core/src/components/tabbar/tabbar.tsx
+++ b/core/src/components/tabbar/tabbar.tsx
@@ -9,7 +9,7 @@ import { createColorClasses } from '../../utils/theme';
ios: 'tabbar.ios.scss',
md: 'tabbar.md.scss'
},
- shadow: true
+ scoped: true
})
export class Tabbar implements ComponentInterface {
diff --git a/core/src/components/tabs/readme.md b/core/src/components/tabs/readme.md
index 28e3c66a66..4b6a53e5ab 100644
--- a/core/src/components/tabs/readme.md
+++ b/core/src/components/tabs/readme.md
@@ -12,6 +12,7 @@ The component is a container of individual [Tab](../Tab/) components.
| Property | Attribute | Description | Type |
| ----------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| `color` | `color` | The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). | `Color` |
+| `mode` | `mode` | The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`. | `Mode` |
| `name` | `name` | A unique name for the tabs. | `string` |
| `tabbarHidden` | `tabbar-hidden` | If true, the tabbar will be hidden. Defaults to `false`. | `boolean` |
| `tabbarHighlight` | `tabbar-highlight` | If true, show the tab highlight bar under the selected tab. | `boolean` |
diff --git a/core/src/components/tabs/tabs.scss b/core/src/components/tabs/tabs.scss
index 969f283f51..23fa4d7ddd 100644
--- a/core/src/components/tabs/tabs.scss
+++ b/core/src/components/tabs/tabs.scss
@@ -15,10 +15,21 @@
z-index: $z-index-page-container;
}
-.tabs-inner {
- position: relative;
+ion-tabbar {
+ @include position(null, 0, 0, 0);
- flex: 1;
-
- contain: layout size style;
+ display: none;
+ position: absolute;
+}
+
+:host(.tabbar-visible.tabs-md)::slotted(ion-tab) {
+ bottom: 56px; // tabbar height (it's fixed!)
+}
+
+:host(.tabbar-visible.tabs-ios)::slotted(ion-tab) {
+ bottom: 50px; // tabbar height (it's fixed!)
+}
+
+:host(.tabbar-visible) ion-tabbar {
+ display: flex;
}
diff --git a/core/src/components/tabs/tabs.tsx b/core/src/components/tabs/tabs.tsx
index 719360a6e5..ecb5d82c98 100644
--- a/core/src/components/tabs/tabs.tsx
+++ b/core/src/components/tabs/tabs.tsx
@@ -1,12 +1,12 @@
import { Build, Component, Element, Event, EventEmitter, Listen, Method, Prop, State } from '@stencil/core';
-import { Color, Config, IonicConfig, NavOutlet, RouteID, RouteWrite, TabbarLayout, TabbarPlacement } from '../../interface';
-import { createColorClasses } from '../../utils/theme';
+import { Color, Config, IonicConfig, Mode, NavOutlet, RouteID, RouteWrite, TabbarLayout, TabbarPlacement } from '../../interface';
+import { createThemedClasses } from '../../utils/theme';
@Component({
tag: 'ion-tabs',
styleUrl: 'tabs.scss',
- shadow: true
+ scoped: true
})
export class Tabs implements NavOutlet {
@@ -23,6 +23,12 @@ export class Tabs implements NavOutlet {
@Prop({ context: 'config' }) config!: Config;
@Prop({ context: 'document' }) doc!: Document;
+ /**
+ * The mode determines which platform styles to use.
+ * Possible values are: `"ios"` or `"md"`.
+ */
+ @Prop() mode!: Mode;
+
/**
* The color to use from your application's color palette.
* Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`.
@@ -103,7 +109,7 @@ export class Tabs implements NavOutlet {
}
componentDidLoad() {
- return this.initSelect();
+ this.initSelect();
}
componentDidUnload() {
@@ -293,29 +299,27 @@ export class Tabs implements NavOutlet {
hostData() {
return {
- class: createColorClasses(this.color)
+ class: {
+ ...createThemedClasses(this.mode, 'tabs'),
+ 'tabbar-visible': !this.tabbarHidden
+ }
};
}
render() {
- return [
-
-
-
,
-
- !this.tabbarHidden && (
-
-
- )
- ];
+ return (
+
+
+ );
}
}
diff --git a/core/src/components/tabs/test/basic/index.html b/core/src/components/tabs/test/basic/index.html
index 3245955825..75fdb0bdcb 100644
--- a/core/src/components/tabs/test/basic/index.html
+++ b/core/src/components/tabs/test/basic/index.html
@@ -27,7 +27,7 @@
-
+
Tab Two