Remove ion item divider
Asked Answered
S

10

39

How I can remove <ion-item> divider? I have the following code to show 4 items in a row:

<ion-row ion-list>
    <ion-col width-25 *ngFor="let player of players">
              <ion-item color="dark">
                  <ion-avatar item-left>
                      <img [src]="photo" class="img img-circle"/>
                  </ion-avatar>
                  {{user.name}}
              </ion-item>
              </ion-col>
            </ion-row>

and the output shows 4 images in a row, as excepted, but each image has a white divider below it. I don't want any divider.

I tried to set style="border:none" but it didn't do it.

Snuffy answered 29/12, 2016 at 8:52 Comment(2)
show the image/screenshot.. Hard to understand... May be ion-col, ion-row has some css which is showing the border.Caa
Usually in grid systems there is padding in place to create "air" between the blocks. I think style="padding: 0" on your ion-col element should do the trick. But I think maybe you should rethink the use of ion-row and ion-cols here as it seems a little too complex for your needs.Greenish
I
73

This is for ionic 2 and 3. Please refer to this answer for higher versions of ionic

use no-lines

<ion-row ion-list>
    <ion-col width-25 *ngFor="let player of players">
         <ion-item no-lines color="dark"><!-- here -->
              <ion-avatar item-left>
                  <img [src]="photo" class="img img-circle"/>
              </ion-avatar>
              {{user.name}}
         </ion-item>
     </ion-col>
</ion-row>
Individuate answered 29/12, 2016 at 9:9 Comment(2)
Thanks @jegadeesh, adding <IonItem lines="none"> solved my problem in Ionic5!! Cheers!Excurvature
@Excurvature thanks, this worked with me :) lines="none"Zion
W
67

For whatever reason, this didn't work for me. But having lines="none" worked great.

For ionic v4

<ion-item lines="none">...</ion-item>

Pulled from ionic docs. https://ionicframework.com/docs/api/list

Woollen answered 30/1, 2019 at 5:37 Comment(4)
This is for ionic v4 onwards.Individuate
Thanks Ionic for changing everything once again.Pavier
This works in angular 8, the marked solution does notCephalochordate
thanks for answer,it worked very well. That is a simple command that make me not need to spend hours searching a way to remove by force this little annoying line. Thank you very much hahaSedation
R
9

For ionic v4, you should use the lines property:

<ion-row ion-list>
    <ion-col width-25 *ngFor="let player of players">
         <ion-item lines="none" color="dark">
              <ion-avatar item-left>
                  <img [src]="photo" class="img img-circle"/>
              </ion-avatar>
              {{user.name}}
         </ion-item>
    </ion-col>
</ion-row>
Raquelraquela answered 26/4, 2019 at 14:59 Comment(0)
N
9

Apply this for Ionic V4. Really it will work.. Happy coding

<ion-item lines="none">
</ion-item>
Nonconcurrence answered 15/12, 2019 at 5:14 Comment(0)
G
6

If you want to disable the lines / borders globally on all of your <ion-item>'s, just add the following code to your src/global.scss (default when generating a Ionic v4 App with Angular) of your application.

ion-item {

    --border-width: 0;
    --inner-border-width: 0;
}

The attribute lines="none" on a <ion-item> does nothing other.

Hope it helps someone.

Cheers Unkn0wn0x

Gladygladys answered 19/1, 2020 at 18:35 Comment(1)
Thx. I was looking for a global solution.Ovation
B
3

I tried with no-line but it didn't work in ionic 4

Only this work for me in ionic 4 :

<ion-item lines="none"> </ion-item>

<ion-list>
 <ion-item lines="none" button detail *ngFor="let note of notesService.notes">
      <ion-label>{{ note.title }}</ion-label>
    </ion-item>
</ion-list>
Bodiless answered 18/9, 2019 at 3:37 Comment(0)
D
1

I am on ionic 4, and lines="none" somethimes don't work. So I use this line.

ion-list:not(.list-lines-none) ion-item::before{
    border-width: 0 !important;
}

And this is my ionItem example. (It has hidden error property also)

<IonItem lines="none" detail={false}>
    <IonIcon
        className="w-40 h-40 float-left"
        src="/assets/icon/store-black.svg"
    />
    <IonLabel className="flex flex-col ml-10">
        <h5 className="text-base font-bold m-0 ">Lorem ipsum </h5>
        <span className="text-sm leading-tight">Kratki opis</span>
    </IonLabel>
    <IonIcon
        className=" absolute top-50 right-30 w-15 h-15"
        src="/assets/icon/arrow-right.svg"
    />
</IonItem>
Darkling answered 27/4, 2020 at 14:40 Comment(0)
J
1

use (lines="none") in your ion-item

Jarodjarosite answered 23/12, 2020 at 4:34 Comment(0)
T
0

Still lines="none" works in Ionic v7:

<ion-content>
  <ion-list style="text-align:center">
    <ion-item lines="none">
      <ion-label>
        <h6>Your text</h6>
        <ion-badge class="status-badge">
          <span>Your text</span>
        </ion-badge>
      </ion-label>
    </ion-item>
</ion-content>
Tainataint answered 4/3, 2024 at 14:33 Comment(0)
F
0

In Ionic 7

<ion-item lines=none>

no quotes around none

Feminism answered 4/6, 2024 at 5:11 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.