How to wordwrap a long string in ion-item

孤者浪人 提交于 2019-11-28 18:08:01

For ionic 1:

Add item-text-wrap class to item.

<ion-item class="item-text-wrap">
  some long string
</ion-item>

For ionic 2:

Add text-wrap attribute to item.

<ion-item text-wrap>
  some long string
</ion-item>

In Ionic 2, use the text-wrap attribute

<ion-item text-wrap>
  text here wraps to multiple lines
</ion-item>

If you want a custom CSS class to have the same word wrapping effect, just add

white-space: normal;

to your class.

Source: ionic forum

For Ionic 4, use text-wrap on your ion-label element, like so:

<ion-item>
    <ion-label text-wrap>
         Multiline text that should wrap when it is too long
         to fit on one line in the item.
    </ion-label>
  </ion-item>

Ionic 4

class="ion-text-wrap"

  <ion-item>
    <ion-label class="ion-text-wrap">Long Text</ion-label>
  </ion-item>

Link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!