<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/TabContent",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI10TabContentP"
  },
  "title" : "TabContent"
}
-->

# TabContent

A type that provides content for programmatically selectable tabs in a
tab view.

```
@MainActor @preconcurrency protocol TabContent<TabValue>
```

## Overview

A type conforming to this protocol inherits `@preconcurrency @MainActor`
isolation from the protocol if the conformance is included in the type’s
base declaration:

```
struct MyCustomType: Transition {
    // `@preconcurrency @MainActor` isolation by default
}
```

Isolation to the main actor is the default, but it’s not required. Declare
the conformance in an extension to opt out of main actor isolation:

```
extension MyCustomType: Transition {
    // `nonisolated` by default
}
```

## Topics

### Setting tab content

[`var body: Self.Body`](/documentation/SwiftUI/TabContent/body-swift.property)

The value of this type’s nested content.

[`associatedtype Body : TabContent`](/documentation/SwiftUI/TabContent/Body-swift.associatedtype)

The type of content representing the body of this content type.

[`associatedtype TabValue : Hashable`](/documentation/SwiftUI/TabContent/TabValue)

The type used to drive selection for the containing tab view.

### Configuring tab content

[`func badge(_:)`](/documentation/SwiftUI/TabContent/badge(_:))

Generates a badge for the tab from a localized string resource.

[`func contextMenu<M>(menuItems: () -> M) -> some TabContent<Self.TabValue>`](/documentation/SwiftUI/TabContent/contextMenu(menuItems:))

Adds a context menu to a tab.

[`func customizationBehavior(TabCustomizationBehavior, for: AdaptableTabBarPlacement...) -> some TabContent<Self.TabValue>`](/documentation/SwiftUI/TabContent/customizationBehavior(_:for:))

Configures the customization behavior of customizable tab view content.

[`func customizationID(String) -> some TabContent<Self.TabValue>`](/documentation/SwiftUI/TabContent/customizationID(_:))

Sets the identifier for a tab to persist its state.

[`func defaultSectionExpansion(TabSectionExpansion) -> some TabContent<Self.TabValue>`](/documentation/SwiftUI/TabContent/defaultSectionExpansion(_:))

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

[`struct TabSectionExpansion`](/documentation/SwiftUI/TabSectionExpansion)

The default expansion state for a tab section in the sidebar.

[`func defaultVisibility(Visibility, for: AdaptableTabBarPlacement...) -> some TabContent<Self.TabValue>`](/documentation/SwiftUI/TabContent/defaultVisibility(_:for:))

Configures the default visibility of a tab in customizable contexts.

[`func disabled(Bool) -> some TabContent<Self.TabValue>`](/documentation/SwiftUI/TabContent/disabled(_:))

Controls whether users can interact with this tab.

[`func draggable<T>(@autoclosure () -> T) -> some TabContent<Self.TabValue>`](/documentation/SwiftUI/TabContent/draggable(_:))

Activates this tab as the source of a drag and drop operation.
This tab can only be dragged when in the sidebar.

[`func dropDestination<T>(for: T.Type, action: ([T]) -> Void) -> some TabContent<Self.TabValue>`](/documentation/SwiftUI/TabContent/dropDestination(for:action:))

Defines the destination of a drag and drop operation that handles the
dropped content with a closure that you specify.

[`func help(_:)`](/documentation/SwiftUI/TabContent/help(_:))

Adds help text to a tab using a text view that you provide.

[`func hidden(Bool) -> some TabContent<Self.TabValue>`](/documentation/SwiftUI/TabContent/hidden(_:))

Hides the tab from the user.

[`func popover<Content>(isPresented: Binding<Bool>, attachmentAnchor: PopoverAttachmentAnchor, arrowEdge: Edge?, content: () -> Content) -> some TabContent<Self.TabValue>`](/documentation/SwiftUI/TabContent/popover(isPresented:attachmentAnchor:arrowEdge:content:))

Presents a popover when a given condition is true.

[`func popover<Item, Content>(item: Binding<Item?>, attachmentAnchor: PopoverAttachmentAnchor, arrowEdge: Edge?, content: (Item) -> Content) -> some TabContent<Self.TabValue>`](/documentation/SwiftUI/TabContent/popover(item:attachmentAnchor:arrowEdge:content:))

Presents a popover using the given item as a data source for the
popover’s content.

[`func sectionActions<Content>(content: () -> Content) -> some TabContent<Self.TabValue>`](/documentation/SwiftUI/TabContent/sectionActions(content:))

Adds custom actions to a tab section.

[`func springLoadingBehavior(SpringLoadingBehavior) -> some TabContent<Self.TabValue>`](/documentation/SwiftUI/TabContent/springLoadingBehavior(_:))

Sets the spring loading behavior for the tab.

[`func swipeActions<T>(edge: HorizontalEdge, allowsFullSwipe: Bool, content: () -> T) -> some TabContent<Self.TabValue>`](/documentation/SwiftUI/TabContent/swipeActions(edge:allowsFullSwipe:content:))

Adds custom swipe actions to a tab in a tab view.

[`func tabPlacement(TabPlacement) -> some TabContent<Self.TabValue>`](/documentation/SwiftUI/TabContent/tabPlacement(_:))

Specifies the placement of a tab.

[`struct TabPlacement`](/documentation/SwiftUI/TabPlacement)

A place that a tab can appear.

### Configuring tab accessibility

[`func accessibilityHint(_:isEnabled:)`](/documentation/SwiftUI/TabContent/accessibilityHint(_:isEnabled:))

Communicates to the user what happens after selecting the tab.

[`func accessibilityIdentifier(String, isEnabled: Bool) -> some TabContent<Self.TabValue>`](/documentation/SwiftUI/TabContent/accessibilityIdentifier(_:isEnabled:))

Uses the string you specify to identify the view.
Use this value for testing. It isn’t visible to the user.

[`func accessibilityInputLabels(_:isEnabled:)`](/documentation/SwiftUI/TabContent/accessibilityInputLabels(_:isEnabled:))

Sets alternate input labels with which users identify a tab.

[`func accessibilityLabel(_:isEnabled:)`](/documentation/SwiftUI/TabContent/accessibilityLabel(_:isEnabled:))

Adds a label to the tab that describes its contents.

[`func accessibilityValue(_:isEnabled:)`](/documentation/SwiftUI/TabContent/accessibilityValue(_:isEnabled:))

Adds a textual description of the value that the tab contains.

## Relationships

### Conforming Types

[`Group`](/documentation/SwiftUI/Group)

[`ForEach`](/documentation/SwiftUI/ForEach)

[`AnyTabContent`](/documentation/SwiftUI/AnyTabContent)

[`Tab`](/documentation/SwiftUI/Tab)

[`TabSection`](/documentation/SwiftUI/TabSection)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)