Ionic-framework: Can I have icon-top for ion-button

Created on 14 Mar 2019  路  2Comments  路  Source: ionic-team/ionic-framework

Feature Request

Ionic version:


[x] 4.x

Describe the Feature Request

I want to place the icon on the top, and text on bottom in ion-button.
Same as the one available in ion-segment / ion-tab-button.

Describe Preferred Solution

Add "top" to slot attribute.
<ion-button> <ion-icon slot="top" name="star"></ion-icon> Top Icon </ion-button>

core feature request

Most helpful comment

As a workaround, this can also be accomplished by wrapping the inner button content in a div and using a line break:

<ion-button>
  <div>
    <ion-icon name="star"></ion-icon><br>
    Label
  </div>
</ion-button>

Or by styling the div as a flex container:

<ion-button>
  <div>
    <ion-icon name="star"></ion-icon>
    Label
  </div>
</ion-button>
ion-button div {
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
}

All 2 comments

As a workaround, this can also be accomplished by wrapping the inner button content in a div and using a line break:

<ion-button>
  <div>
    <ion-icon name="star"></ion-icon><br>
    Label
  </div>
</ion-button>

Or by styling the div as a flex container:

<ion-button>
  <div>
    <ion-icon name="star"></ion-icon>
    Label
  </div>
</ion-button>
ion-button div {
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
}

As a workaround, this can also be accomplished by wrapping the inner button content in a div and using a line break:

<ion-button>
  <div>
    <ion-icon name="star"></ion-icon><br>
    Label
  </div>
</ion-button>

Or by styling the div as a flex container:

<ion-button>
  <div>
    <ion-icon name="star"></ion-icon>
    Label
  </div>
</ion-button>
ion-button div {
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
}

Your comment just helped me a lot. TY

Was this page helpful?
0 / 5 - 0 ratings