Sharpnado.Tabs 2.0: Xamarin.Forms tabs receive a Badge of honor

  • Fully customizable
  • Underlined tabs, bottom tabs, Segmented control, scrollable tabs
  • Badge on tabs
  • Component oriented architecture
  • Layout your tabs and ViewSwitcher as you want
  • Shadows included in TabHost
  • Bindable

What's really new

  • A BadgeView with a lot of customization
  • Full UWP support!
  • Bindable layout with ItemsSource and ItemTemplate

End of an area

When I started created open source components, I got lazy.
I created only one big library called Sharpnado.Presentation.Forms.
I started created the Xamarin.Forms components in it.
It started with HorizontalListView, Tabs, TaskLoaderView and a very simple MaterialFrame.

Quickly, I figured it was a bad idea for several reasons:

1. Bad visibility for your components

Each component was a bit dissolved in the idea of a toolbox.
For example I wanted to highlight my favorite component, the TaskLoaderView, but felt it was kind of struggling with others having better love.

2. Bad for modularity

Each developer should just use the components he needs.

3. Bad for development

The Silly! App repo is the sample app for all sharpnado's components, but it's also my main development solution.
Since the Sharpnado.Presentation.Forms started to reference others sharpnado's packages like Shadows or MaterialFrame, I coulnd't add them as submodule in the solution.

To sum-up

Now that Tabs is out of the Sharpnado.Presentation.Forms project, the project now only contains source code for the HorizontalListView.
Utimately, it should also have its own repo and then Sharpnado.Presentation.Forms should just become a gateway to the others nugets and maybe also a fat nuget just regrouping all the nugets as dependencies.

BadgeView (Chips)

You can add a badge on any UnderlinedTabItem and BottomTabItem.

By default the BadgeView is placed in the top right corner of the TabItem by setting HorizontalOptions=End and VerticalOptions=Start.

Badges on BottomTabItem

SillyBottomTabsPage.xml from the Silly! app

<!--  Example of segmented tab bar (rounded floating tabs)  -->  
<tabs:TabHostView Grid.Row="2"  
                    SelectedIndex="{Binding Source={x:Reference Switcher}, Path=SelectedIndex, Mode=TwoWay}">
        <tabs:BottomTabItem IconImageSource="house_96.png" Label="{localization:Translate Tabs_Home}">
                <tabs:BadgeView BackgroundColor="White"
                                BorderColor="{StaticResource Accent}"
                                TextColor="{StaticResource Accent}"
                                Text="999+" />
        <tabs:BottomTabItem IconImageSource="list_96.png" Label="{localization:Translate Tabs_List}">
                <tabs:BadgeView BackgroundColor="DodgerBlue"
                                Text="{Binding ListPageViewModel.SillyCount}" />
        <tabs:BottomTabItem IconImageSource="grid_view_96.png" Label="{localization:Translate Tabs_Grid}">
                <tabs:BadgeView Margin="20,5"
                                Text="3" />

Badges on UnderlinedTabItem

SillyDudePage.xml from the Silly! app

<tabs:TabHostView x:Name="TabHost"  
                    BackgroundColor="{DynamicResource DynamicBottomBarBackground}"
                    Shades="{DynamicResource DynamicTabsShadow}"
                    SelectedIndex="{Binding Source={x:Reference Switcher}, Path=SelectedIndex, Mode=TwoWay}">
        <tabs:UnderlinedTabItem Style="{StaticResource SegmentedTabStyle}" Label="Quote">
                <tabs:BadgeView BackgroundColor="{StaticResource Accent}"
                                FontFamily="{StaticResource FontExtraBold}"
                                Text="9" />
        <tabs:UnderlinedTabItem Style="{StaticResource SegmentedTabStyle}" Label="Movies">
                <tabs:BadgeView BackgroundColor="DodgerBlue"
                                Text="new" />
        <tabs:UnderlinedTabItem Style="{StaticResource SegmentedTabStyle}" Label="Meme">
                <tabs:BadgeView Margin="20,0"
                                BorderColor="{StaticResource Accent}"
                                TextColor="{StaticResource Accent}"
                                Text="14" />


Property Description Default
Text Sets the text for the badge text.
If it's an integer, the badge will be hidden if the value is 0.
TextSize Sets the text size used for the badge text. 10
TextColor Sets the text color used for the badge text. Color.White
FontFamily Sets the font family used for the badge text. null
BadgePadding Precisely adjust inner text margin. new Thickness(4, 2)
ShowIndicator Shows a small dot instead of the babdge. false
BackgroundColor Sets the background for the badge. Color.Red
BorderColor Sets a border color for the badge. Transparent
Margin Sets a precise margin for the badge. 10
HorizontalOptions Sets the horizontal location of the badge. LayoutOptions.End
VerticalOptions Sets the vertical location of the badge. LayoutOptions.Start