Skip to content

[ionic4.rc1] [ios] ion-segment-button doesn't align with icon #17069

Closed

Description

@rtpHarry

Bug Report

Ionic version:
[x] 4.x

Current behavior:
If you have a row of segments with text and one with an icon, the new rc1 (upgraded from beta 13) has very different paddings setup.

One effect of this is that the icon only button is taller than the text only button:

image

Expected behavior:

It should align nicely more like this (screenshot from beta 13):

image

Steps to reproduce:

Drop the snippet below into an app.

Related code:

    <ion-segment mode="ios">
          <ion-segment-button value="330" mode="ios">
            <ion-label>330ml</ion-label>
          </ion-segment-button>
          <ion-segment-button value="440" mode="ios">
            <ion-label>440ml</ion-label>
          </ion-segment-button>
          <ion-segment-button value="500" mode="ios">
            <ion-label>500ml</ion-label>
          </ion-segment-button>
          <ion-segment-button value="custom" mode="ios">
            <ion-icon name="create"></ion-icon>
          </ion-segment-button>
    </ion-segment>  

Note that wrapping the icon in an ion-label does make the row align nicely but makes the icon crazy small:

image

However, the docs have been updated for the ion-label wrapper and dont include it around the ion-icon:

https://github.com/ionic-team/ionic/blob/master/core/src/components/segment/readme.md

Other information:

Ionic info:


Ionic:

   ionic (Ionic CLI)             : 4.7.1 (C:\Users\rtpha\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.0.0-rc.1
   @angular-devkit/build-angular : 0.11.4
   @angular-devkit/schematics    : 7.1.4
   @angular/cli                  : 7.1.4
   @ionic/angular-toolkit        : 1.2.2

System:

   NodeJS : v10.13.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.4.1
   OS     : Windows 10

Activity

  1. paulstelzer commented on Jan 12, 2019

    @paulstelzer
    Contributor

    Thanks for the issue! You are right, I can confirm it.

    As a workaround you can set the min-height and the icon yourself by css, e.g. so:

    ion-segment-button {
        min-height: 30px;
    
        ion-icon {
            font-size: 20px;
        }
    }
    

    chrome_2019-01-12_09-09-14

    I cannot say what the correct way is (with or without ion-label). I would prefer something like that (keep in mind the following is an idea and is currently not working):

        <ion-segment-button value="custom">
          <ion-icon slot="start" name="create"></ion-icon>
          <ion-label>Test</ion-label>
        </ion-segment-button>
        <ion-segment-button value="custom">
          <ion-icon slot="icon-only" name="create"></ion-icon>
        </ion-segment-button>
    

    Btw, it would even better to make it like a normal button (https://github.com/ionic-team/ionic/tree/master/core/src/components/button) without any ion-label to reach consistency :)

        <ion-segment-button value="custom">
          Test
        </ion-segment-button>
        <ion-segment-button value="custom">
          <ion-icon slot="start" name="create"></ion-icon>
          Test
        </ion-segment-button>
        <ion-segment-button value="custom">
          <ion-icon slot="icon-only" name="create"></ion-icon>
        </ion-segment-button>
    

    I labeled it as needs design decision. So we will wait for an official statement :)

  2. added
    help wanted
    on Jan 21, 2019
  3. santoshyadavdev commented on Mar 7, 2019

    @santoshyadavdev
    Contributor

    Hi @brandyscarney ,

    Is it still open, can i take this issue.

  4. brandyscarney commented on Mar 7, 2019

    @brandyscarney
    Member

    @santoshyadav198613 Yes it is still open, if you'd like to take a look that would be great, thank you!

  5. santoshyadavdev commented on Mar 11, 2019

    @santoshyadavdev
    Contributor

    Hi @brandyscarney ,
    Was a small css fix, let me know if any changes needed.

  6. added a commit that references this issue on Apr 25, 2019
    0fa645b
  7. added 4 commits that reference this issue on May 8, 2019
    5eb942f
    71d5400
    2c24df2
    9c65d5d
  8. added a commit that references this issue on May 22, 2019
    3da7254
  9. ionitron-bot commented on May 25, 2019

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  10. locked and limited conversation to collaborators on May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedpackage: core

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions