Interactive previews iPhone

Value Tab View

Creates a tab view that uses a builder to create and specify selection values for its tabs.

Value Tab View - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview

Platform Compatibility

iOS 18.0+ iPadOS 18.0+ macOS 15.0+ watchOS 11.0+ tvOS 18.0+ visionOS 2.0+

Tags

SwiftUI Code

Docs
@State var selection = "1"

var body: some View {
    let displayedSelection = Text("Selected: \(selection)")

    TabView(selection: $selection) {
        Tab(value: "0") {
            displayedSelection
        }
        Tab("1", systemImage: "1.circle", value: "1") {
            displayedSelection
        }

        Tab("2", image: "cats24x24", value: "2") {
            displayedSelection
        }
        Tab(value: "3") {
            displayedSelection
        } label: {
            Label("3", systemImage: "3.circle")
        }
    }
}

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
Hour Minute Seconds DatePicker - watchOS - Flat Design - Light Mode - Preview
initializer

Hour Minute Seconds DatePicker

A DatePicker for just hour, minute, and second.

Pinned Toolbar Item Placement - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Pinned Toolbar Item Placement

A placement that pins the item to the trailing edge of the toolbar.

List Item Tint - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview
modifier

List Item Tint

Sets a fixed tint color for content in a list.

ToolbarItem Shared Background Visibility - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

ToolbarItem Shared Background Visibility

Controls the visibility of the glass background effect on items in the toolbar. In certain contexts, such as the navigation bar on iOS and the window toolbar on macOS, toolbar items will be given a glass background effect that is shared with other items in the same logical grouping

List Row Separator Tint - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview
modifier

List Row Separator Tint

Sets the tint color associated with a row.

Prefer Vertical Toolbar Items - iOS on iPhone Duo - Landscape - Closed - Liquid Glass - Light Mode - Preview
modifier

Prefer Vertical Toolbar Items

A compression behavior that prioritizes keeping toolbar items visible over other elements, such as tabs. By default, tabs are prioritized.

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

Toggle

Creates a toggle with title, image, systemImage, and custom label.

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

ShareLink

A view that controls a sharing presentation