---
title: "tabItem(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/tabitem(_:)"
---

# tabItem(_:)

Sets the tab bar item associated with this view.

## Declaration

```swift
nonisolated func tabItem<V>(@ContentBuilder _ label: () -> V) -> some View where V : View

```

## Parameters

- `label`: The tab bar item to associate with this view.

## Discussion

Discussion Use tabItem(_:) to configure a view as a tab bar item in a TabView. The example below adds two views as tabs in a TabView: struct View1: View {     var body: some View {         Text("View 1")     } }

struct View2: View {     var body: some View {         Text("View 2")     } }

struct TabItem: View {     var body: some View {         TabView {             View1()                 .tabItem {                     Label("Menu", systemImage: "list.dash")                 }

View2()                 .tabItem {                     Label("Order", systemImage: "square.and.pencil")                 }         }     } }

## See Also

### Deprecated Types

- [NavigationView](swiftui/navigationview.md)
