diff --git a/packages/core/src/components.d.ts b/packages/core/src/components.d.ts
index b65db33b06..6d35bf4382 100644
--- a/packages/core/src/components.d.ts
+++ b/packages/core/src/components.d.ts
@@ -314,6 +314,7 @@ declare global {
namespace JSXElements {
export interface IonBackButtonAttributes extends HTMLAttributes {
mode?: 'ios' | 'md';
+ text?: string;
}
}
}
diff --git a/packages/core/src/components/back-button/back-button.ios.scss b/packages/core/src/components/back-button/back-button.ios.scss
new file mode 100644
index 0000000000..4d55bb0601
--- /dev/null
+++ b/packages/core/src/components/back-button/back-button.ios.scss
@@ -0,0 +1,43 @@
+@import "./back-button";
+@import "./back-button.ios.vars";
+
+// iOS Back Button
+// --------------------------------------------------
+
+.back-button-ios .back-button-inner-default {
+ @include padding(0, 4px);
+ @include margin(0);
+
+ z-index: $back-button-ios-button-z-index;
+ overflow: visible;
+ min-height: 32px;
+ border: 0;
+ font-size: 17px;
+ line-height: 1;
+ color: $back-button-ios-button-color;
+ background-color: transparent;
+ transform: translateZ(0);
+
+ &.activated {
+ opacity: 0.4;
+ }
+}
+
+.back-button-ios ion-icon {
+ @include padding-horizontal(null, 0.3em);
+ @include margin(-1px, 0, 0, 0);
+
+ display: inherit;
+ min-width: 18px;
+ font-size: 34px;
+ font-size: 1.4em;
+ line-height: 0.67;
+ pointer-events: none;
+}
+.back-button .button-text {
+ letter-spacing: -0.01em;
+}
+
+.enable-hover .back-button-ios:hover {
+ color: $back-button-ios-button-color;
+}
diff --git a/packages/core/src/components/back-button/back-button.ios.vars.scss b/packages/core/src/components/back-button/back-button.ios.vars.scss
new file mode 100644
index 0000000000..3caed53c2a
--- /dev/null
+++ b/packages/core/src/components/back-button/back-button.ios.vars.scss
@@ -0,0 +1,5 @@
+@import "../../themes/ionic.globals.ios";
+
+$back-button-ios-button-color: ion-color($colors-ios, primary, base, ios) !default;
+
+$back-button-ios-button-z-index: $z-index-toolbar-buttons !default;
\ No newline at end of file
diff --git a/packages/core/src/components/back-button/back-button.md.scss b/packages/core/src/components/back-button/back-button.md.scss
new file mode 100644
index 0000000000..5baceafdc0
--- /dev/null
+++ b/packages/core/src/components/back-button/back-button.md.scss
@@ -0,0 +1,43 @@
+@import "./back-button";
+@import "./back-button.md.vars";
+
+// MD Back Button
+// --------------------------------------------------
+.back-button-md .back-button-inner-default {
+ @include margin(0, 6px, 0, 0);
+ @include padding(0, 5px);
+
+ min-width: 44px;
+ height: 32px;
+ border: 0;
+ font-size: 14px;
+ font-weight: 500;
+ text-transform: uppercase;
+ color: $back-button-md-button-color;
+ background-color: transparent;
+ box-shadow: none;
+
+ &.activated {
+ opacity: 0.4;
+ }
+}
+
+.back-button-md ion-icon {
+ @include padding-horizontal(null, 0.3em);
+
+ @include margin(0);
+ @include padding(0, 6px);
+ @include text-align(start);
+
+ font-size: 24px;
+ font-weight: normal;
+
+
+ line-height: 0.67;
+
+ pointer-events: none;
+}
+
+.enable-hover .back-button-md:hover {
+ color: $back-button-md-button-color;
+}
diff --git a/packages/core/src/components/back-button/back-button.md.vars.scss b/packages/core/src/components/back-button/back-button.md.vars.scss
new file mode 100644
index 0000000000..42cf120c91
--- /dev/null
+++ b/packages/core/src/components/back-button/back-button.md.vars.scss
@@ -0,0 +1,4 @@
+@import "../../themes/ionic.globals.md";
+
+$back-button-md-button-color: $toolbar-md-text-color !default;
+
diff --git a/packages/core/src/components/back-button/back-button.scss b/packages/core/src/components/back-button/back-button.scss
index d7877913d4..fc26bb94eb 100644
--- a/packages/core/src/components/back-button/back-button.scss
+++ b/packages/core/src/components/back-button/back-button.scss
@@ -1,3 +1,4 @@
+@import "../../themes/ionic.globals";
// Back Button
// --------------------------------------------------
@@ -10,6 +11,50 @@
display: inline-block;
}
+.back-button button {
+ @include text-align(center);
+ @include appearance(none);
+
+ position: relative;
+ z-index: 0;
+ display: inline-block;
+
+ border: 0;
+
+ line-height: 1;
+
+ text-decoration: none;
+ text-overflow: ellipsis;
+ text-transform: none;
+
+ white-space: nowrap;
+ cursor: pointer;
+ vertical-align: top; // the better option for most scenarios
+ vertical-align: -webkit-baseline-middle; // the best for those that support it
+
+ transition: background-color, opacity 100ms linear;
+
+ font-kerning: none;
+ user-select: none;
+
+ contain: content;
+
+ font-smoothing: antialiased;
+ -webkit-font-smoothing: antialiased;
+}
+
+.back-button .button-inner {
+ display: flex;
+
+ flex-flow: row nowrap;
+ flex-shrink: 0;
+ align-items: center;
+ justify-content: center;
+
+ width: 100%;
+ height: 100%;
+}
+
.back-button-text {
display: flex;
diff --git a/packages/core/src/components/back-button/back-button.tsx b/packages/core/src/components/back-button/back-button.tsx
index bd7f2eb017..5c7c70b1fb 100644
--- a/packages/core/src/components/back-button/back-button.tsx
+++ b/packages/core/src/components/back-button/back-button.tsx
@@ -3,7 +3,10 @@ import { Config } from '../../index';
@Component({
tag: 'ion-back-button',
- styleUrl: 'back-button.scss',
+ styleUrls: {
+ ios: 'back-button.ios.scss',
+ md: 'back-button.md.scss'
+ },
host: {
theme: 'back-button'
}
@@ -19,6 +22,12 @@ export class BackButton {
*/
@Prop() mode: 'ios' | 'md';
+ /**
+ * The text property is used to provide custom text for the back button while using the
+ * default look-and-feel
+ */
+ @Prop() text: string = null;
+
@Prop({ context: 'config' }) config: Config;
@Element() el: HTMLElement;
@@ -26,10 +35,11 @@ export class BackButton {
componentWillLoad() {
this.custom = this.el.childElementCount > 0;
}
+
render() {
const backButtonIcon = this.config.get('backButtonIcon', 'arrow-back');
- const backButtonText = this.config.get('backButtonText', 'Back');
- const buttonColor = this.mode === 'ios' ? 'primary' : '';
+ const defaultBackButtonText = this.config.get('backButtonText', 'Back');
+ const backButtonText = this.text || defaultBackButtonText;
if (this.custom) {
return (
@@ -37,17 +47,18 @@ export class BackButton {
);
- } else if (!this.custom) {
+ } else {
return (
-
-
- {backButtonText}
-
+
);
- } else {
- return undefined;
}
}
}
diff --git a/packages/core/src/components/back-button/readme.md b/packages/core/src/components/back-button/readme.md
index 6e740a8fc2..1719f7e417 100644
--- a/packages/core/src/components/back-button/readme.md
+++ b/packages/core/src/components/back-button/readme.md
@@ -70,6 +70,14 @@ Possible values are: `"ios"` or `"md"`.
For more information, see [Platform Styles](/docs/theming/platform-specific-styles).
+#### text
+
+string
+
+The text property is used to provide custom text for the back button while using the
+default look-and-feel
+
+
## Attributes
#### mode
@@ -81,6 +89,14 @@ Possible values are: `"ios"` or `"md"`.
For more information, see [Platform Styles](/docs/theming/platform-specific-styles).
+#### text
+
+string
+
+The text property is used to provide custom text for the back button while using the
+default look-and-feel
+
+
----------------------------------------------
diff --git a/packages/core/src/components/back-button/test/basic/index.html b/packages/core/src/components/back-button/test/basic/index.html
index f5ea15d7b1..3e79a837b4 100644
--- a/packages/core/src/components/back-button/test/basic/index.html
+++ b/packages/core/src/components/back-button/test/basic/index.html
@@ -10,19 +10,6 @@
-