How to Align Title, Input Box & Ionic Icon Side by Side in Ionic 3 - ionic-framework

So far, I have been able to figure out how to left align Title and right align icon, but the problem is with input box in the center which I am not able to figure out.
Expected output Image is given below.
My Home Page Code:
<ion-header>
<ion-navbar>
<ion-title text-center>Page Title</ion-title>
<ion-buttons end>
<button ion-button icon-only>
<ion-icon name="search"></ion-icon>
</button>
</ion-buttons>
</ion-navbar>
</ion-header>
<ion-content padding>
</ion-content>

Just fixed it on my own!
Home HTML file
<ion-header>
<ion-navbar>
<ion-title>Title
<ion-input type="text"></ion-input>
</ion-title>
<ion-buttons end>
<button ion-button icon-only>
<ion-icon name="search"></ion-icon>
</button>
</ion-buttons>
</ion-navbar>
</ion-header>
<ion-content padding>
</ion-content>
Variable.scss file
$text-input-md-margin-top: 0px;
$text-input-md-margin-bottom: 0px;
$text-input-md-margin-start: 0px;
$text-input-md-margin-end: 0px;
Home.scss file
ion-input
{
background-color: white;
border-radius: 5px;
display: inline;
color: black;
margin-left: 0.5em;
}
.text-input-md
{
width: 60%;
}

Related

How to align button in the header to the right side of header in ionic 4

Button is aligned right in the toolbar but the icon is not shown.
Only white box appear.
.html
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
<ion-title style="text-align: center;">RE-MED+</ion-title>
<ion-buttons slot="primary">
<ion-button>
<ion-icon slot="icon-only" name="exit"></ion-icon>
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
It looks like this.
I want Like this
Try this in your .html
<ion-header>
<ion-toolbar color="dark">
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
<ion-title class="ion-text-center">RE-MED+</ion-title>
<ion-buttons slot="end">
<ion-button fill="clear">
<ion-icon slot="icon-only" name="exit"></ion-icon>
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
This will work in Ionic5. Maybe Ionic4...?
<ion-header>
<ion-toolbar>
<ion-title>Hello World</ion-title>
<ion-button slot="end" (click)="actionbutton()">Close</ion-button>
</ion-toolbar>
</ion-header>
It is solved.
I have created CSS for another component.
I don't know how but it applies to ion-button so I change the name of that CSS.
Its name was .button I changed to .button_border
.css
.button_border{
border-radius: 10px !important;
border: 2px solid #ffffff;
background-color: white;
color: #0032fe;
box-shadow: none !important;
padding-left: 24px;
padding-right: 34px;
padding-top: 5px;
padding-bottom: 5px;
font-size: 18px;
margin-left: 20px;
margin-right: 20px;
}

Ionic 4 how to set button on bottom of page in slider?

I am trying to show the button on the bottom of page but the issue is its not showing in bottom just showing on the middle not in end.
Here is my .html code
<ion-header no-border>
<ion-toolbar >
<ion-buttons slot="start" style="margin:5px 0px 5px 5px;">
<img src="assets/icon/favicon.png" height="50px">
</ion-buttons>
<ion-buttons slot="end">
<ion-button (click)="skip()"><p>SKIP</p></ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content>
<div>
<ion-slides pager="true" #mySlider>
<!-- Slide 1 -->
<ion-slide>
<div>
<img src="assets/welcome-slides/portrait.png"/>
<h2>
Capture the moment
</h2>
<ion-label color="gray">
Our photographer will capture the shot in the right place.
</ion-label>
</div>
<ion-button expand="block" class="btn" (click)="swipeNext()">NEXT</ion-button>
</ion-slide>
</ion-slides>
</div>
</ion-content>
.scss
.toolbar-background {
border: none;
}
.btn{
width: 90%;
height: 50px;
position : absolute;
bottom : 0;
left: 5%;
}
ion-slide {
padding-top: 0px;
padding-left: 10px;
padding-right: 10px;
}
.bar-header {
background-color: red($color: #000000);
border: 0px !important;
border-bottom-color: transparent !important;
background-image: none !important;
border-bottom: none !important;
}
I try to set height of slide but dont know why its not working seems like button is in the end of slide but the height is less thats why button is showing in middle.
Try placing your button outside of the <ion-slides> component.
<ion-header no-border>
<ion-toolbar >
<ion-buttons slot="start" style="margin:5px 0px 5px 5px;">
<img src="assets/icon/favicon.png" height="50px">
</ion-buttons>
<ion-buttons slot="end">
<ion-button (click)="skip()"><p>SKIP</p></ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content>
<div>
<ion-slides pager="true" #mySlider>
<!-- Slide 1 -->
<ion-slide>
<div>
<img src="assets/welcome-slides/portrait.png"/>
<h2>
Capture the moment
</h2>
<ion-label color="gray">
Our photographer will capture the shot in the right place.
</ion-label>
</div>
</ion-slide>
</ion-slides>
<!-- put your button here -->
<ion-button expand="block" class="btn" (click)="swipeNext()">NEXT</ion-button>
<!-- put your button here -->
</div>
</ion-content>

Ionic 4, Keyboard moves content

I have this html in my ionic project
<ion-header>
<ion-toolbar mode="ios">
<ion-searchbar>
</ion-searchbar>
<ion-title>
</ion-title>
</ion-toolbar>
<ion-list class="m-0-p-0">
<ion-item *ngFor="let user of users">
</ion-item>
</ion-list>
</ion-header>
<ion-content scrollY="false">
<ion-grid>
<ion-row class="centered">
....
</ion-row>
</ion-grid>
</ion-content>
this is my centered class:
.centered{
position:fixed ;
width:100%;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
So, when i go into the searchbar, when the keyboard is showing up, the content of the center is moving up. I searched on the web for solutions but it seems that things have changed in ionic 4 and i cannot do: Keyboard.disableScroll(true).. or can I?

Icon right on navbar don't work on ios as expected

Example on android/Browser
Works Fine on Android
Example On Ios
Not work as well
page.html
<ion-header [scrollHide]="headerScrollConfig" [scrollContent]="pageContent" >
<ion-navbar color="ticket-blue-rainbow" >
<ion-row>
<ion-title> {{ evento.descricao }}</ion-title>
<ion-icon class="padding-icon" name="thumbs-up" color="light" item-right icon-right (click)="likeEvento()"></ion-icon>
<ion-icon class="padding-icon" name="ios-heart" item-right color="danger" (click)="onClickFavorit()"></ion-icon>
<ion-icon class="padding-icon" name="share" item-right (click)="onClickOpenModal()" color="light" style="padding-right: 10px !important;"></ion-icon>
</ion-row>
</ion-navbar>
</ion-header>
page.scss
.padding-icon {
padding-right: 15px;
font-size: 20px;
}
To overcome above issue you need to use below option with <ion-buttons> tag
<ion-buttons right>
<ion-icon class="padding-icon" name="thumbs-up" color="light" item-right icon-right
(click)="likeEvento()"></ion-icon>
</ion-buttons>
It will work and show your buttons on right side.
<ion-header>
<ion-navbar>
<ion-title> {{ evento.descricao }}</ion-title>
<ion-buttons right>
<ion-icon class="padding-icon" name="thumbs-up" color="light" item-right icon-right (click)="likeEvento()"></ion-icon>
<ion-icon class="padding-icon" name="ios-heart" item-right color="danger" (click)="onClickFavorit()"></ion-icon>
<ion-icon class="padding-icon" name="share" item-right (click)="onClickOpenModal()" color="light" style="padding-right: 10px !important;"></ion-icon>
</ion-buttons>
</ion-navbar>
</ion-header>
I don’t no if this method is the most correctly, but in this situation i use this class on ios
.ios {
page-event
{
.padding-ios{
padding-left:70%!important;
}
}
}
and on html i used
<ion-buttons right class="padding-ios">
</ion-buttons>

Ionic2: Icon inside Menu-Button is cut

I importet an example app (menu) and added a button with icon & text to the menu:
<ion-menu [content]="content">
<ion-header>
<ion-toolbar>
<ion-title>Pages</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-list>
<ion-item-divider></ion-item-divider>
<button ion-item icon-left (click)="logout()">
<ion-icon name="log-out"></ion-icon>
Logout
</button>
</ion-list>
</ion-content>
</ion-menu>
<ion-nav #content [root]="rootPage"></ion-nav>
Sadly, this results in a not fully shown Icon (I test my app in Chrome)
you have to use the attribute item-left at ion-icon
<ion-menu [content]="content">
<ion-header>
<ion-toolbar>
<ion-title>Pages</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-list>
<ion-item-divider></ion-item-divider>
<button ion-item icon-left (click)="logout()">
<ion-icon item-left name="log-out"></ion-icon>
Logout
</button>
</ion-list>
</ion-content>
</ion-menu>
<ion-nav #content [root]="rootPage"></ion-nav>