Reuse tag from ionic


I want to write my custom tag based on ion-segment, becaue I will make changes on the component file.

My tag is named ion-custom-segment.

How can I tell in my scss file to take the style from ion-segment or should I have to copy the styles in to my scss file?

Hi mdline,

In order to have the same style, you have to copy the scss file or add “,ion-custom-segment” where ion-segment is use in scss.
A quick replace in scss will do the job :wink:

In other hand, some ionic component have custom class after treating, maybe if you look on computed html a class is added to ion-segment and you just have to add it in your own tag.

Hi Vartone,

I don’t understand the second part of your answer " or add “,ion-custom-segment” where ion-segment is use in scss".
Can you make a quick example please.

Sure :slight_smile:
In your scss, you have :

ion-segment {
   // Your code css

You could have

ion-segment, ion-custom-segment {
   // Your code css

So in your scss code you can replace ion-segment by ion-segment, ion-custom-segment