diff --git a/src/components/searchbar/searchbar.ios.scss b/src/components/searchbar/searchbar.ios.scss
index 0b0670ea4b..df9cce052d 100644
--- a/src/components/searchbar/searchbar.ios.scss
+++ b/src/components/searchbar/searchbar.ios.scss
@@ -128,8 +128,12 @@ ion-searchbar {
transition: $searchbar-ios-cancel-transition;
cursor: pointer;
pointer-events: none;
+ display: none;
}
+.searchbar-show-cancel .searchbar-ios-cancel {
+ display: block;
+}
// Searchbar Left Aligned (iOS only)
// -----------------------------------------
diff --git a/src/components/searchbar/searchbar.md.scss b/src/components/searchbar/searchbar.md.scss
index b66d1f48e5..4f5692643a 100644
--- a/src/components/searchbar/searchbar.md.scss
+++ b/src/components/searchbar/searchbar.md.scss
@@ -130,7 +130,7 @@ ion-searchbar {
// Searchbar Focused
// -----------------------------------------
-.searchbar-has-focus:not(.searchbar-hide-cancel) {
+.searchbar-has-focus.searchbar-show-cancel {
.searchbar-search-icon {
display: none;
}
diff --git a/src/components/searchbar/searchbar.ts b/src/components/searchbar/searchbar.ts
index 912d41ecaf..bef595cacd 100644
--- a/src/components/searchbar/searchbar.ts
+++ b/src/components/searchbar/searchbar.ts
@@ -15,7 +15,7 @@ import {isPresent} from '../../util/util';
* ```html
*
*
@@ -29,19 +29,19 @@ import {isPresent} from '../../util/util';
host: {
'[class.searchbar-has-value]': '_value',
'[class.searchbar-active]': '_isActive',
- '[class.searchbar-hide-cancel]': 'hideCancelButton',
+ '[class.searchbar-show-cancel]': 'showCancelButton',
'[class.searchbar-left-aligned]': 'shouldAlignLeft()'
},
template:
'
' +
- '',
+ '',
encapsulation: ViewEncapsulation.None
})
export class Searchbar {
@@ -59,7 +59,7 @@ export class Searchbar {
/**
* @input {boolean} Whether to hide the cancel button or not. Default: `"false"`.
*/
- @Input() hideCancelButton: any = false;
+ @Input() showCancelButton: any = false;
/**
* @input {number} How long, in milliseconds, to wait to trigger the `input` event after each keystroke. Default `250`.
@@ -178,9 +178,9 @@ export class Searchbar {
* On Initialization check for attributes
*/
ngOnInit() {
- let hideCancelButton = this.hideCancelButton;
- if (typeof hideCancelButton === 'string') {
- this.hideCancelButton = (hideCancelButton === '' || hideCancelButton === 'true');
+ let showCancelButton = this.showCancelButton;
+ if (typeof showCancelButton === 'string') {
+ this.showCancelButton = (showCancelButton === '' || showCancelButton === 'true');
}
}
diff --git a/src/components/searchbar/test/floating/main.html b/src/components/searchbar/test/floating/main.html
index e987a28de2..bd598fc112 100644
--- a/src/components/searchbar/test/floating/main.html
+++ b/src/components/searchbar/test/floating/main.html
@@ -1,30 +1,30 @@
Search - Default
-
+
defaultSearch: {{ defaultSearch }}
Search - Custom Placeholder
-
+
customPlaceholder: {{ customPlaceholder }}
- Search - Hide Cancel Button
-
+ Search - No Cancel Button
+
defaultCancel: {{ defaultCancel }}
Search - Custom Cancel Button Danger
-
+
Search - Value passed
-
+