question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ion-input nested within ion-item doesn't respect --padding-end

See original GitHub issue

Bug Report

Ionic version: [x] 4.x

Current behavior: Creating a floating label ion-input and adding this style

ion-item {
  --padding-start: 0px;
  --padding-end: 0px;
}

or this one

ion-item {
    --padding-start: 0px;
    ion-input {
      --padding-end: 0px;
    }
}

will results in changing only the “start” side.

Expected behavior: Both padding should follow the padding variable setted

Steps to reproduce: Add a simple IonInput component:

<ion-item>
  <ion-label position="fixed">Floating Label</ion-label>
  <ion-input></ion-input>
</ion-item>

with the following CSS:

ion-item {
    --padding-start: 0px;
    --padding-end: 0px;
}

Other information: Ionic info:

Ionic:
   ionic (Ionic CLI)             : 4.10.2
   Ionic Framework               : @ionic/angular 4.0.1
   @angular-devkit/build-angular : 0.12.4
   @angular-devkit/schematics    : 7.2.4
   @angular/cli                  : 7.2.4
   @ionic/angular-toolkit        : 1.3.0

System:
   NodeJS : v10.15.0
   npm    : 6.4.1
   OS     : Linux 4.18

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
brandyscarneycommented, Feb 14, 2019

Thanks for the issue! Item is structured in the following way:

<ion-item>
  <slot name="start"></slot>
  <div class="item-inner">
    <div class="input-wrapper">
      <!-- default slot contains label and input -->
      <slot></slot>
    </div>
    <slot name="end"></slot>
  </div>
</ion-item>

So when you are styling --padding-start and --padding-end you are changing the padding on the host element ion-item. I believe the padding you are seeing is coming from the default padding on the .item-inner which allows us to pad the items in the end slot without losing the bottom border that stretches all of the way to the right.

What you’re looking for is the following:

ion-item {
  --padding-start: 0;

  --inner-padding-end: 0;
}

See the CSS Custom properties for item here: https://ionicframework.com/docs/api/item#css-custom-properties

0reactions
ionitron-bot[bot]commented, Mar 29, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove the padding around ion-item? - Stack Overflow
If you want to remove inner paddding, use ion-item custom CSS properties: ion-item { --padding-end: 0px; --inner-padding-end: 0px; ...
Read more >
ion-item - Ionic Framework
ion-item elements for iOS/Android contain text, icons, images, and other custom elements. They're placed in a list and can be input, deleted, edited, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found