The only way I managed to make this work was like the following with a clean structure:
- Create a subfolder in
src/theme/
(if not done already), something likemy-awesome-app
.- Filepath:
/src/theme/my-awesome-app/
.
- Filepath:
- Inside of the
/src/theme
subfolder, create a file, you can name it f. e. likeion-custom-searchbar.scss
.- Filepath:
/src/theme/my-awesome-app/ion-custom-searchbar.scss
.
- Filepath:
- Inside of the
/src/theme
folder, there should be aglobal.scss
per default.- Filepath:
/src/theme/global.scss
.
- Filepath:
- Inside of the
/src/theme/global.scss
import the customion-custom-searchbar.scss
like following:-
@import './src/theme/my-awesome-app/ion-searchbar
(no.scss
file ending needed here.
-
Content of /src/theme/my-awesome-app/ion-custom-searchbar
.scss
ion-searchbar[no-shadow] {
& input {
box-shadow: none !important;
}
}
The use of !important
is important () otherwise it would take no effect.
And now you can use it like this, note the no-shadow
attribute:
<ion-searchbar no-shadow placeholder="Put some awesome search placeholder text here" type="text"></ion-searchbar>
This will make the styling available globally across the app.
Hope it helps!
Cheers
Unkn0wn0x
PS: Of course you can put the styling of the ion-custom-searchbar.sss
directly into the /src/theme/global.scss
, but with the solution I mentioned just before, you can keep a much cleaner structure for every component.