Remove text from Back button keeping the icon
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
A clean navigation bar can make a big difference in how polished your app feels. Many designers prefer a back button that shows only the arrow icon without the preceding screen's title text. This is easy to achieve on iOS, Android, and the web, but the approach differs on each platform. This article walks through the specific implementation for each, with code examples you can drop directly into your project.
iOS: Removing Back Button Text in Swift
On iOS, the navigation bar's back button is controlled by the UINavigationItem of the view controller that pushes the next screen. This is a common source of confusion, because you configure the back button on the parent view controller, not the one currently displayed.
iOS 14 and Later
Starting with iOS 14, Apple introduced the backButtonDisplayMode property, which makes this straightforward:
Setting .minimal removes the title text and leaves only the chevron icon. This is the cleanest approach and respects the system's Dynamic Type and accessibility settings.
iOS 11 to iOS 13
For older iOS versions, set the backButtonTitle to an empty string on the parent view controller:
Alternatively, you can set it using UIBarButtonItem:
Applying Globally via UIAppearance
If you want every screen in your app to have a text-free back button, you can set this globally in your AppDelegate or SceneDelegate:
This sets the back button title color to clear, effectively hiding it while preserving the tap target area.
SwiftUI
In SwiftUI, the navigation bar back button is managed by NavigationStack (or NavigationView in older versions). You can hide the default back button and provide a custom one:
This gives you full control over the back button's appearance. The chevron.left SF Symbol matches the default iOS back arrow.
Android: Removing Back Button Text with Kotlin
On Android, the Toolbar (or ActionBar) typically shows only an icon by default, since Android's design language does not include text next to the navigation icon. However, if a title appears that you want to remove, you can configure it like this:
setDisplayShowTitleEnabled(false) removes the activity title from the toolbar. setDisplayHomeAsUpEnabled(true) adds the back arrow. If you want a custom icon instead of the default arrow, use setHomeAsUpIndicator:
Jetpack Compose
In Jetpack Compose, the TopAppBar composable gives you full control:
Passing an empty composable as the title parameter ensures no text is rendered.
Web: CSS Approach
On the web, if you have a back button implemented with an icon and a text span, you can hide the text using CSS:
Setting display: none on the text span removes it visually and from the accessibility tree. If you want screen readers to still announce the text, use visibility: hidden with position: absolute instead, or add an aria-label to the button.
Common Pitfalls
Setting the back button on the wrong view controller (iOS). The back button text comes from the view controller that pushes, not the one being displayed. If you set backButtonTitle on the detail view controller, nothing will change.
Forgetting accessibility. Removing visible text is fine for sighted users, but screen readers rely on labels. On iOS, the system automatically provides an accessibility label for the back button. On the web, always add an aria-label="Go back" to icon-only buttons.
Using a custom back button that breaks swipe gestures (iOS). If you use navigationBarBackButtonHidden(true) and add a custom button, the interactive pop gesture (swipe from left edge) is disabled by default. You need to re-enable it by setting navigationController?.interactivePopGestureRecognizer?.delegate = self.
Hardcoding icon sizes. On Android and iOS, navigation bar icons should use the system's standard size. Hardcoding pixel values can cause the icon to look too large or too small on different screen densities.
Summary
Removing text from the back button while keeping the icon is a common UI refinement. On iOS 14+, use backButtonDisplayMode = .minimal. On older iOS, set backButtonTitle to an empty string on the parent view controller. On Android, call setDisplayShowTitleEnabled(false) on the ActionBar. On the web, hide the text span with CSS. Whichever platform you are on, always verify that the icon-only button remains accessible to users with assistive technologies.
Related reading
- Remove the cell highlight color of UITableView
- Removing an activity from the history stack
- Removing duplicate elements from an array in Swift
- Removing object from array in Swift 3
- Removing the title text of an iOS UIBarButtonItem
- Removing viewcontrollers from navigation stack
- Renew Provisioning Profile
- Renew Push certificate and keep current App Store App working
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.