Interactive previews iPhone iPad

Tab Badge

Generates a badge for a tab from an integer value.

Tab Badge - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview

Platform Compatibility

iOS 18.0+ iPadOS 18.0+ macOS 15.0+ visionOS 2.0+

Tags

SwiftUI Code

Docs
TabView {
    Group {
        Tab {
            Text("0")
        }

        Tab("1", systemImage: "1.circle") {
            Text("1")
        }

        Tab("2", image: "cats24x24") {
            Text("2")
        }

        Tab {
            Text("3")
        } label: {
            Label("3", systemImage: "3.circle")
        }
    }
}.badge(42)

Found an issue or have a suggestion?

Created: April 11, 2026Updated: April 11, 2026

More TabView Components

View all
Collapse Sidebar Sections by Default - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Collapse Sidebar Sections by Default

Collapses the section in the sidebar by default.

Default Tab Bar Placement - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Default Tab Bar Placement

Specifies the preferred placement for the tabs of a TabView in the sidebarAdaptable style on platforms where the tab bar cannot adapt between different representations, and only one representation can be shown. For example, on iOS, it can enforce the sidebar on large-screen devices like the Pro Max, and iPhone Duo. This modifier has no effect on iPadOS.

Default Collapsed Tab Section - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Default Collapsed Tab Section

Sets the default expansion state for the section containing this tab to collapsed when displayed in the sidebar.

Tab View Customization Behavior - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Tab View Customization Behavior

Configures the customization behavior of customizable tab view content.

Tab View Customization - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Tab View Customization

Specifies the customizations to apply to the sidebar representation of the tab view.

Tab View Side Bar Footer - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Tab View Side Bar Footer

Adds a custom footer to the sidebar of a tab view.

Tab View Side Bar Bottom Bar - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Tab View Side Bar Bottom Bar

Adds a custom bottom bar to the sidebar of a tab view.

Default Adaptable Tab Bar Placement - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Default Adaptable Tab Bar Placement

Specifies the default placement for the tabs in a tab view using the adaptable sidebar style.

Explore Other Components

Browse all
Custom Session Async URL Image - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Custom Session Async URL Image

A modifier that adds a URL session for asynchronous images contained in the view to use when fetching image data.

ToolbarSpacer - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

ToolbarSpacer

A standard space item in toolbars

AccessoryLinearCapacityGaugeStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

AccessoryLinearCapacityGaugeStyle

A gauge style that displays bar that fills from leading to trailing edges as the gauge’s current value increases

RenameButton - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
TextField

RenameButton

A button that triggers a standard rename action

NavigationLinkPickerStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

NavigationLinkPickerStyle

A picker style represented by a navigation link that presents the options by pushing a List-style picker view.

SliderTickContentForEach - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

SliderTickContentForEach

A type of slider content that creates content by iterating over a collection.

Glass Button Styles - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

Glass Button Styles

A button style that applies glass border artwork based on the button’s context

Stepped Min Max Label Slider - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Stepped Min Max Label Slider

Creates a slider to select a value from a given range, subject to a step increment, which displays the provided labels