You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to change font size for TabView bar items #1269
but the same approach on iOS (using the appearance proxy: UITabBarItem.appearance().setTitleAttr...) didn't work, I can't be sure what's going on under the hood (are our changes being applied and then overwritten, or just not working outright), but the approaches on Stack Overflow articles that appear to work for regular iOS projects don't seem to be working here, which is strange.
I was wondering what happened to my TabView. :) Great that we can change the size of the TabView button text. But any css applied to TabView in .css is applied to the entire TabView component, also the content of each tab. Is there a way to change font-style & size only to the buttons, and not the entire TabView component?
I have also noticed that the iOS template-icons work different now with the latest {N} version. They are not color painted by iOS anymore. So if the icon is white, is shows white. If it is black, it show it black ect. So now we have to add the right color on all icons we create?
Also the same icons do not have a selected color anymore, they stay the same when selected. The only effect indicating that a TabView-button is pressed is the font-color...
So, in short. How do we change the following in the TabView-buttons with css?
Font color normal
Font color selected
Icon color normal
Icon color selected
Icon size?
Button-bar background color?
Any documentation regarding the changes? For me, this is a breaking change, visually...
Indeed, I also noticed this. I mean, TabView is the parent element so it makes sense that the styles pass down to its children (i.e. its content), but I think the biggest use case is just wanting to style just the tabs. If there was a way to do that, I'd be happy as larry.
@manijak You are indeed right - all font properties are inheritable and so the content of the tab and the tab item both inherit the font-size. I can see your pain here as you will probably want different styles for those.
Currently, the problem is that we don't have a separate element/view for the tab-button. It is configured with the properties of the TabViewItem. One possible solution is to introduce a new element (e.g. TabViewTitle) that you can target separately with CSS. For example:
@manijak
We have also added tabsBackgroundColor and selectedColor properties of the TabView - these will work only on the tab items. You can try them out.
@vakrilov
Your suggestion looks good, and it would be great to have something like this out of the box. Not sure about the naming though. "Title". I know that tabButtons on Android are at the top, so the name fits well, but on iOS its on the bottom, so perhaps "TabViewItem.button" & "TabViewButton" would be better?
This is a bit of a problem now, especially on iOS (not sure about Android), since the last update removed the default iOS-styling of the TabView buttons (which worked well). iOS masked all icons with its own colors for normal and selected states. This should have been kept, but with the ability to override the default behaviour.
You mentioned the new properties for the TabView, I didn't see them earlier. This is good. selectedColor works only on Text, and not the icons. On iOS both the text and the icons change color when selected.
On Android, the selectedColor property only changes the color of the bar that highlights the selected tab. It does not have any effect on the selected tab text. A little more control would be nice.
Also, another important issue with tabs is the inability to style the title independently of the rest of the body. Please consider working on a separate tab element like @vakrilov suggested above.
Maybe we can make use of CSS pseudo selector :active or :selected for this? That would make styling tabs very intuitive, like so:
I faced the selected icon color not changing on iOS tabBar as well and I am using this workaround till it is supported.
vartabBarIcons: Array<string>=[1","2","3","4"];vartabBarIconsActive: Array<string>=[1","2","3","4"];exportfunctionpageLoaded(args: EventData){varpage: Page=<any>args.object;mainTabview=getViewById(page,"main-tabview");if(!(mainTabview.hasListeners(TabView.selectedIndexChangedEvent))){mainTabview.on(TabView.selectedIndexChangedEvent,(data: SelectedIndexChangedEventData)=>{//Select new imagemainTabview.items[data.newIndex].iconSource=tabBarIconsActive[data.newIndex];//Unselect old imagemainTabview.items[data.oldIndex].iconSource=tabBarIcons[data.oldIndex];});}}
@Tyler-V The property itself is on the TabView component, so there shouldn't be any problem with Angular (Angular lacks the TabViewItem components). That being said, I see in your other issue that you are using the new BottomNavigation component, which is a bit different and is still in beta. We will answer you there.
Activity
N3ll commentedon Dec 17, 2015
@maknz , with the release from yesterday 1.5.1, you should be able to change the font-size only by using CSS.
manijak commentedon Dec 17, 2015
I was wondering what happened to my TabView. :) Great that we can change the size of the TabView button text. But any css applied to TabView in .css is applied to the entire TabView component, also the content of each tab. Is there a way to change font-style & size only to the buttons, and not the entire TabView component?
I have also noticed that the iOS template-icons work different now with the latest {N} version. They are not color painted by iOS anymore. So if the icon is white, is shows white. If it is black, it show it black ect. So now we have to add the right color on all icons we create?
Also the same icons do not have a selected color anymore, they stay the same when selected. The only effect indicating that a TabView-button is pressed is the font-color...
So, in short. How do we change the following in the TabView-buttons with css?
Any documentation regarding the changes? For me, this is a breaking change, visually...
maknz commentedon Dec 17, 2015
Indeed, I also noticed this. I mean, TabView is the parent element so it makes sense that the styles pass down to its children (i.e. its content), but I think the biggest use case is just wanting to style just the tabs. If there was a way to do that, I'd be happy as larry.
vakrilov commentedon Dec 18, 2015
@manijak You are indeed right - all font properties are inheritable and so the content of the tab and the tab item both inherit the font-size. I can see your pain here as you will probably want different styles for those.
Currently, the problem is that we don't have a separate element/view for the tab-button. It is configured with the properties of the
TabViewItem. One possible solution is to introduce a new element (e.g.TabViewTitle) that you can target separately with CSS. For example:XML:
CSS:
We can also proxy the current properties of the TabViewItem (
title,iconetc.) to the new class to maintain backwards-compatibility.I would be glad to hear your input on that approach.
vakrilov commentedon Dec 18, 2015
@manijak
We have also added
tabsBackgroundColorandselectedColorproperties of theTabView- these will work only on the tab items. You can try them out.manijak commentedon Dec 18, 2015
@vakrilov
Your suggestion looks good, and it would be great to have something like this out of the box. Not sure about the naming though. "Title". I know that tabButtons on Android are at the top, so the name fits well, but on iOS its on the bottom, so perhaps "TabViewItem.button" & "TabViewButton" would be better?
This is a bit of a problem now, especially on iOS (not sure about Android), since the last update removed the default iOS-styling of the TabView buttons (which worked well). iOS masked all icons with its own colors for normal and selected states. This should have been kept, but with the ability to override the default behaviour.
You mentioned the new properties for the TabView, I didn't see them earlier. This is good.
selectedColorworks only on Text, and not the icons. On iOS both the text and the icons change color when selected.So we should have:
amjd commentedon Jan 13, 2016
+1
On Android, the selectedColor property only changes the color of the bar that highlights the selected tab. It does not have any effect on the selected tab text. A little more control would be nice.
Also, another important issue with tabs is the inability to style the title independently of the rest of the body. Please consider working on a separate tab element like @vakrilov suggested above.
Maybe we can make use of CSS pseudo selector
:activeor:selectedfor this? That would make styling tabs very intuitive, like so:AntonioCuevaUrraco commentedon Jan 18, 2016
I faced the selected icon color not changing on iOS tabBar as well and I am using this workaround till it is supported.
17 remaining items
larssn commentedon Sep 17, 2018
Seems we could change the font size just fine like so (iOS):
MartoYankov commentedon Jan 7, 2019
There is a way to do this for some time now. See #5752.
Basically the
TabViewhas a new propertytabTextFontSizeand corresponding CSS ruletab-text-font-sizewhich affects only the tab title text.Tyler-V commentedon Aug 28, 2019
@MartoYankov how would we achieve this on Angular?
MartoYankov commentedon Aug 29, 2019
@Tyler-V The property itself is on the
TabViewcomponent, so there shouldn't be any problem with Angular (Angular lacks theTabViewItemcomponents). That being said, I see in your other issue that you are using the newBottomNavigationcomponent, which is a bit different and is still in beta. We will answer you there.