Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic-4 Text-wrap on ion-select-option

HTML

<ion-item>
    <ion-label>Popover</ion-label>
    <ion-select [interfaceOptions]="customPopoverOptions" interface="popover" placeholder="Select One">
      <ion-select-option value="brown" text-wrap>Brownasdfasdfasdfasdfadfadsfasdfadfasdfafdsadfaf</ion-select-option>
      <ion-select-option value="blonde">Blonde</ion-select-option>
      <ion-select-option value="black">Black</ion-select-option>
      <ion-select-option value="red">Red</ion-select-option>
    </ion-select>
  </ion-item>

image

SASS:

ion-select-option{
   ion-label{
     white-space: normal !important;
   }
}

I'm not able to override the existing white-space: nowrap

I would like to know how to override the shadow-dom css

like image 978
Mohan Gopi Avatar asked Oct 29 '25 08:10

Mohan Gopi


2 Answers

On Ionic 5, the only thing that worked for me was:

.alert-radio-label.sc-ion-alert-md {
  white-space: normal !important;
}
like image 187
Henrique Rodrigues Avatar answered Oct 31 '25 10:10

Henrique Rodrigues


As there's no attribute for this web-component it does make this a little difficult and messy

global.scss:

.item.sc-ion-label-md-h, .item .sc-ion-label-md-h{
     white-space: normal !important;
}

//or just 

 .sc-ion-label-md-h{
     white-space: normal !important;
}

This overrules the component styling classes.

enter image description here

like image 44
Ira Watt Avatar answered Oct 31 '25 10:10

Ira Watt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!