# Ionic tabs - change active tab border/icon color

**URL:** <https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110>\
**Category:** ionic-v3\
**Created:** [July 30, 2017, 1:01am UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110 "2017-07-30T01:01:28Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![marko1943](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@marko1943](https://forum.ionicframework.com/u/marko1943)\
**Post date:** [July 30, 2017, 1:01am UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/1 "2017-07-30T01:01:28Z")

</div>

Hi guys,

I was wondering if it’s possible to change the color of top border in ionic?

I was looking at this sass variables

> **[Ionic Framework](https://ionicframework.com/docs/theming/overriding-ionic-variables/)**
>
> Ionic is the app platform for web developers. Build amazing mobile, web, and desktop apps all with one shared code base and open web standards

And trying to change anything like

`$tabs-border-color: #fff !default`  
for example. But no luck

I was able to change the active icons color by using this override with CSS

```auto
.tabs-md .tab-button[aria-selected=true] .tab-button-icon {
  color: $tabs-color !important;
}

.tabs-ios .tab-button[aria-selected=true] .tab-button-icon {
  color: $tabs-color !important;
}

```

All though I’m not a fan of using important, I also couldn’t find a different way to change active icon’s color for tabs.

Any suggestions on how to approach this?

Edit: I’m reffering to android but yeah I’d like a neutral solution 🙂

---

<div class="post-metadata">

**Author:** ![marko1943](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@marko1943](https://forum.ionicframework.com/u/marko1943)\
**Post date:** [July 30, 2017, 1:14am UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/2 "2017-07-30T01:14:47Z")

</div>

About the 2nd part of the questions, I just realized that material design is for android, so changing the

**active**  **icon** for tabs on **android** is:

`$tabs-md-tab-icon-color-active: red;`

On **iOS**

`$tabs-ios-tab-icon-color-active: red`

I wish someone explained that material design = android

But nothing works for the **active border**

---

<div class="post-metadata">

**Author:** ![KishuPro](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@KishuPro](https://forum.ionicframework.com/u/KishuPro)\
**Post date:** [July 30, 2017, 7:19am UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/3 "2017-07-30T07:19:15Z")

</div>

If you want to change the top border style of the active tab then you’ll need to first define a `style` for the `border` of the anchor tag (which actually represents the _tab_ in the rendered html). Then set whatever style you want to, for example, add the following `css` code in your `app.scss` file to affect the top border of the active tab:

```auto
.tabbar a[aria-selected=true] {
    border-top: 1px;
    border-style: solid;    
}

```

And, this should be platform neutral.

---

<div class="post-metadata">

**Author:** ![marko1943](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@marko1943](https://forum.ionicframework.com/u/marko1943)\
**Post date:** [July 30, 2017, 3:46pm UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/4 "2017-07-30T15:46:12Z")

</div>

Ok, thanks, so that actually changes like ::active pseudo change stuff - \> once the click is out, the border disappears.

![tabbars](https://global.discourse-cdn.com/ionicframework/original/3X/8/3/8380c2c465af6131777b9396cd254a96b97111d7.gif)

Could be some sort of bug with it cause only border-top acts like this

![image](https://global.discourse-cdn.com/ionicframework/original/3X/5/e/5e03de97a7f760f91be492ca1bf42694900dca51.png)

---

<div class="post-metadata">

**Author:** ![KishuPro](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@KishuPro](https://forum.ionicframework.com/u/KishuPro)\
**Post date:** [July 30, 2017, 4:31pm UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/5 "2017-07-30T16:31:04Z")

</div>

The border should stay, can you please post your full `app.scss` code?

As also, I’d rather use `box-shadow` to mimic the border properly on all the platforms like this:

```auto
.tabbar a[aria-selected=true] {
    border: none;
    box-shadow: 0px 2px 0px 0px #488aff inset;    
}

```

---

<div class="post-metadata">

**Author:** ![marko1943](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@marko1943](https://forum.ionicframework.com/u/marko1943)\
**Post date:** [July 30, 2017, 5:05pm UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/6 "2017-07-30T17:05:59Z")

</div>

Same result with box shadow.

There is basically nothing in my app.scss/variables.scss that would cause this behaviour… Can you confirm it works for you?

My Ionic info is

local packages:

```
@ionic/app-scripts : 2.1.3
Ionic Framework : ionic-angular 2.3.0
```

---

<div class="post-metadata">

**Author:** ![KishuPro](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@KishuPro](https://forum.ionicframework.com/u/KishuPro)\
**Post date:** [July 30, 2017, 5:38pm UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/7 "2017-07-30T17:38:58Z")

</div>

> [@marko1943](#):
>
> There is basically nothing in my app.scss/variables.scss that would cause this behaviour

Then you should try updating ionic I guess.

> [@marko1943](#):
>
> Can you confirm it works for you?

Yup it is working at my end, I am on latest versions too.

BTW, I have assumed `tabsHighlight` is not right for your purposes.

---

<div class="post-metadata">

**Author:** ![marko1943](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@marko1943](https://forum.ionicframework.com/u/marko1943)\
**Post date:** [July 30, 2017, 6:16pm UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/8 "2017-07-30T18:16:06Z")

</div>

nah, I have `tabsHighlight = "true"`

Anyway, It works on iOS - just checked.

It’s buggy for android so I guess its the Ionic version problem.

Unfortunately I can’t update to Ionic 3 yet so I guess this will do for now.

Thanks for helping out! 😉

---

<div class="post-metadata">

**Author:** ![KishuPro](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@KishuPro](https://forum.ionicframework.com/u/KishuPro)\
**Post date:** [July 31, 2017, 3:51am UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/9 "2017-07-31T03:51:36Z")

</div>

You are welcome!

> [@marko1943](#):
>
> I have tabsHighlight = “true”

Now that you’ve said the above, I am not sure as to why are you looking for a manual way in the first place? Earlier I had assumed that you were trying to place the highlight bar at the top of the `tabs` regardless of whether the `tabbar` itself was on the top of the screen or bottom.

I’d like to know what does or doesn’t the `tabsHighlight` attribute do in your case so that you need to manually put a border; because it’s always a good practice to use the intrinsically available provisions to do a thing.

---

<div class="post-metadata">

**Author:** ![marko1943](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@marko1943](https://forum.ionicframework.com/u/marko1943)\
**Post date:** [July 31, 2017, 1:36pm UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/10 "2017-07-31T13:36:28Z")

</div>

> [@KishuPro](#):
>
> I’d like to know what does or doesn’t the tabsHighlight attribute do in your case so that you need to manually put a border; because it’s always a good practice to use the intrinsically available provisions to do a thing.

I just want to change the top border **color**

The default tabsHighlight has predefined colors and I’m asking how to change it 🙂

---

<div class="post-metadata">

**Author:** ![KishuPro](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@KishuPro](https://forum.ionicframework.com/u/KishuPro)\
**Post date:** [July 31, 2017, 4:37pm UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/11 "2017-07-31T16:37:49Z")

</div>

> [@marko1943](#):
>
> The default tabsHighlight has predefined colors and I’m asking how to change it

Okay now I get it. Actually, you used the word ‘top border’ so I was confused a bit as that top border becomes the bottom border if the `tab` bar placement is at the top of the screen.

Anyways, we don’t have to manually add borders in this case. But there are complications, heres what I’ve found in this regard. The `$tabs-border-color` is not working yes, and even if it worked, it wouldn’t have been useful right now as there is a [ionic bug](https://github.com/ionic-team/ionic/issues/9912) that stops the highlighted border to show up on `ios`. So from what I’ve checked till now, you’ve got the following two options:

**Option 1:** If you need platform specific look and feel, then first use the css code **blusk0** has posted in the bug link I’ve provided above as a workaround for `ios`. This will ensure that you get the border on `ios` in the first place. Now to actually change the colors for each platform, you’ll have to target each platform in your `css` individually (let me know if you want this and I’ll help you), that is, if you want _just_ the border color to change. Otherwise, you can use the `$tabs-tab-color-active` variable to change the color of the borders as well as the texts and the icons for all the platforms at one go.

**Option 2:** Personally I’d go for this option and it is that you can simply change the `mode` of the `tab` itself to `md`. Firstly this will bypass the bug on ios and show the border there without doing anything else, and secondly, you’ll need simpler `css` to get the proper result on all the platforms. Here is how you can achieve this:

Define your tab like this specifying the mode attribute:

`<ion-tabs mode="md" tabsHighlight="true" tabsPlacement="bottom">`

Then to change the color of the border for all platforms add this `css` in your `app.scss` file:

```auto
.tabs-md[tabsHighlight="true"] .tab-highlight {
    background-color: red;
}

```

If it’s okay for you that the text color, icon color and the border color all change then use the `$tabs-tab-color-active` variable rather.

---

<div class="post-metadata">

**Author:** ![marko1943](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@marko1943](https://forum.ionicframework.com/u/marko1943)\
**Post date:** [July 31, 2017, 5:00pm UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/12 "2017-07-31T17:00:22Z")

</div>

> [@KishuPro](#):
>
> Okay now I get it. Actually, you used the word ‘top border’ so I was confused a bit as that top border becomes the bottom border if the tab bar placement is at the top of the screen.

Yap yap, I meant on tabs on bottom, sorry for the confusion.

Anyway, the **option 2** worked like a charm!  
Works both ways, with changing app.scss tabs-md and changing `$tabs-tab-color-active`

So that’s awesome! Appreciate the help, thanks a lot!

So why isn’t this documented anywhere?  
Or if it is, it’s documented badly cause I’ve spent quite a lot of time searching for a solution and couldn’t find it lol

---

<div class="post-metadata">

**Author:** ![KishuPro](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@KishuPro](https://forum.ionicframework.com/u/KishuPro)\
**Post date:** [July 31, 2017, 5:53pm UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/13 "2017-07-31T17:53:38Z")

</div>

No problem!

Check out this useful link of all the common sass variables you can override: [Overriding Ionic Sass Variables](http://ionicframework.com/docs/theming/overriding-ionic-variables/)

---

<div class="post-metadata">

**Author:** ![kiran\_nd02](https://avatars.discourse-cdn.com/v4/letter/k/a183cd/32.png) [@kiran\_nd02](https://forum.ionicframework.com/u/kiran_nd02)\
**Post date:** [September 4, 2017, 4:07am UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/15 "2017-09-04T04:07:23Z")

</div>

I have same problem, are u got solution? Please help me,

---

<div class="post-metadata">

**Author:** ![marko1943](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@marko1943](https://forum.ionicframework.com/u/marko1943)\
**Post date:** [September 4, 2017, 1:55pm UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/16 "2017-09-04T13:55:47Z")

</div>

Hey Kiran,

There is a solution, this one

> [@Ionic tabs - change active tab border/icon color](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/11):
>
> Okay now I get it. Actually, you used the word ‘top border’ so I was confused a bit as that top border becomes the bottom border if the tab bar placement is at the top of the screen. Anyways, we don’t have to manually add borders in this case. But there are complications, heres what I’ve found in this regard. The $tabs-border-color is not working yes, and even if it worked, it wouldn’t have been useful right now as there is a [ionic bug](https://github.com/ionic-team/ionic/issues/9912) that stops the highlighted border to show up on ios. So fr…

---

<div class="post-metadata">

**Author:** ![HugoPetla](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/hugopetla/32/109273_2.png) [@HugoPetla](https://forum.ionicframework.com/u/HugoPetla)\
**Post date:** [October 10, 2017, 12:42pm UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/17 "2017-10-10T12:42:21Z")

</div>

> [@KishuPro](#):
>
> .tabs-md[tabsHighlight=“true”] .tab-highlight {  
> background-color: red;  
> }

Nice solution, thank you.  
How can I put a border on top for all the tabs menu? Because this one’s for the selected tab, and I also need one fixed for all the tabs, like the default grey, but with other color.

---

<div class="post-metadata">

**Author:** ![singamkarthi](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@singamkarthi](https://forum.ionicframework.com/u/singamkarthi)\
**Post date:** [July 14, 2022, 11:31am UTC](https://forum.ionicframework.com/t/ionic-tabs-change-active-tab-border-icon-color/100110/18 "2022-07-14T11:31:17Z")

</div>

![top-border](https://global.discourse-cdn.com/ionicframework/original/3X/2/c/2cd508350357de8f733025f55e38782ad6858c49.png)  
In my case, top - border for ionic tab button works for me. But, I need bottom - border. Kindly help me to fix my prob.
