Material Design

Bottom navigation

Open bugs badge

Bottom navigation bars allow movement between primary destinations in an app. Tapping on a bottom navigation icon takes you directly to the associated view or refreshes the currently active view.

An animation showing a change of selection in a bottom navigation component.

Design & API documentation

Table of contents


Overview

MDCBottomNavigationBar can be added to a view hierarchy like any UIView. Material Design guidelines recommend always placing bottom navigation at the bottom of the screen.

MDCBottomNavigationBar works much like a UITabBar and both are populated with an array of UITabBarItems. However, MDCBottomNavigationBar is built with Material Design in mind and should be used with other Material Design components where possible to provide a consistent look and feel in an app. Additionally, while MDCBottomNavigationBar has similar features to MDCTabBar, MDCTabBar is chiefly intended for top navigation, whereas MDCBottomNavigationBar — as the name indicates — in intended for bottom navigation.

It is recommended that three to five items are used to populate the content of the bottom navigation bar. If there are fewer than three destinations, consider using tabs instead. If your top-level navigation has more than six destinations, provide access to destinations not covered in bottom navigation through alternative locations, such as a navigation drawer.

Title visibility can be configured in three ways: only show the title of the selected item, always show title regardless of any item’s selection state, and never show title regardless of any item’s selection state. The default behavior of bottom navigation is to only show the title for an item that is selected.

In landscape orientation, items can be configured to be justified or compactly clustered together. When items are justified the bottom navigation bar is fitted to the width of the device. Justified items can have their titles shown below their respective icons or adjacent to their respective icons.

Guidance

Bottom navigation should be used for top-level destinations in an app of similar importance or destinations requiring direct access from anywhere in the app.

Be cautious when combining bottom navigation with similar navigation placed at the bottom of the screen (e.g. a bottom tab bar), as the combination may cause confusion when navigating an app. For example, tapping across both bottom tabs and bottom navigation could display a mixture of different transitions across the same content.

Installation

Installation with CocoaPods

Add the following to your Podfile:

pod 'MaterialComponents/BottomNavigation'

Then, run the following command:

pod install

Importing

To import the component:

Swift

import MaterialComponents.MaterialBottomNavigation

Objective-C

#import "MaterialBottomNavigation.h"

Extensions

Color Theming

You can theme a bottom navigation with your app’s color scheme using the ColorThemer extension.

You must first add the Color Themer extension to your project:

pod 'MaterialComponents/BottomNavigation+ColorThemer'

Swift

// Step 1: Import the ColorThemer extension
import MaterialComponents.MaterialBottomNavigation_ColorThemer

// Step 2: Create or get a color scheme
let colorScheme = MDCSemanticColorScheme()

// Step 3: Apply the color scheme to your component
MDCBottomNavigationBarColorThemer.applySemanticColorScheme(colorScheme, to: component)

Objective-C

// Step 1: Import the ColorThemer extension
#import "MaterialBottomNavigation+ColorThemer.h"

// Step 2: Create or get a color scheme
id<MDCColorScheming> colorScheme = [[MDCSemanticColorScheme alloc] init];

// Step 3: Apply the color scheme to your component
[MDCBottomNavigationBarColorThemer applySemanticColorScheme:colorScheme
     toBottomNavigation:component];

Typography Theming

You can theme a bottom navigation with your app’s typography scheme using the TypographyThemer extension.

You must first add the Typography Themer extension to your project:

pod 'MaterialComponents/BottomNavigation+TypographyThemer'

Swift

// Step 1: Import the TypographyThemer extension
import MaterialComponents.MaterialBottomNavigation_TypographyThemer

// Step 2: Create or get a typography scheme
let typographyScheme = MDCTypographyScheme()

// Step 3: Apply the typography scheme to your component
MDCBottomNavigationBarTypographyThemer.applyTypographyScheme(typographyScheme, to: component)

Objective-C

// Step 1: Import the TypographyThemer extension
#import "MaterialBottomNavigation+TypographyThemer.h"

// Step 2: Create or get a typography scheme
id<MDCTypographyScheming> typographyScheme = [[MDCTypographyScheme alloc] init];

// Step 3: Apply the typography scheme to your component
[MDCBottomNavigationBarTypographyThemer applyTypographyScheme:colorScheme
     toBottomNavigationBar:component];

Accessibility

To help ensure your bottom navigation item is accessible to as many users as possible, please be sure to review the following recommendations:

-accessibilityLabel The label will be the title of the UITabBarItem. Currently you can’t set this to a custom value.

-accessibilityValue Set an appropriate accessibilityValue value if your item has a badge value. For example, an item with an inbox icon with a badge value for how many emails are unread. You should explicitly set the accessibilityValue when the badge value doesn’t provide enough context. For example, in an inbox example simply having the value “10” doesn’t provide enough context, instead the accessibility value should explain what the badge value symbolizes. The default value if there is a badge value and you haven’t set any accessibilityValue will be that the accessibilityValue is the badgeValue.

Swift

tabBarItem.accessibilityValue = "10 unread emails"

Objective-C

tabBarItem.accessibilityValue = @"10 unread emails";

Minimum touch size

Make sure that your bottom navigation bar respects the minimum touch area. The Material spec calls for touch areas that should be least 48 points high and 48 wide.

Swift

override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
let size = bottomNavBar.sizeThatFits(view.bounds.size)
let bottomNavBarFrame = CGRect(x: 0,
y: view.bounds.height - size.height,
width: size.width,
height: size.height)
bottomNavBar.frame = bottomNavBarFrame
}

Objective-C

- (void)viewWillLayoutSubviews {
  [super viewWillLayoutSubviews];
  CGSize size = [_bottomNavigationBar sizeThatFits:self.view.bounds.size];
  CGRect bottomNavBarFrame = CGRectMake(0,
                                        CGRectGetHeight(self.view.bounds) - size.height,
                                        size.width,
                                        size.height);
  _bottomNavigationBar.frame = bottomNavBarFrame;
}