<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ContentUnavailableView",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI22ContentUnavailableViewV"
  },
  "title" : "ContentUnavailableView"
}
-->

# ContentUnavailableView

An interface, consisting of a label and additional content, that you
display when the content of your app is unavailable to users.

```
nonisolated struct ContentUnavailableView<Label, Description, Actions> where Label : View, Description : View, Actions : View
```

## Overview

It is recommended to use `ContentUnavailableView` in situations where a view’s
content cannot be displayed. That could be caused by a network error, a
list without items, a search that returns no results etc.

You create an `ContentUnavailableView` in its simplest form, by providing a
label and some additional content such as a description or a call to action:

```
ContentUnavailableView {
    Label("No Mail", systemImage: "tray.fill")
} description: {
    Text("New mails you receive will appear here.")
}
```

The system provides default `ContentUnavailableView`s that you can use in
specific situations. The example below illustrates the usage of the
[`search`](/documentation/SwiftUI/ContentUnavailableView/search) view:

```
struct ContentView: View {
    @ObservedObject private var viewModel = ContactsViewModel()

    var body: some View {
        NavigationStack {
            List {
                ForEach(viewModel.searchResults) { contact in
                    NavigationLink {
                        ContactsView(contact)
                    } label: {
                        Text(contact.name)
                    }
                }
            }
            .navigationTitle("Contacts")
            .searchable(text: $viewModel.searchText)
            .overlay {
                if searchResults.isEmpty {
                    ContentUnavailableView.search
                }
            }
        }
    }
}
```

## Topics

### Getting built-in unavailable views

[`search`](/documentation/SwiftUI/ContentUnavailableView/search)

Creates a `ContentUnavailableView` instance that conveys a search state.

[`search(text:)`](/documentation/SwiftUI/ContentUnavailableView/search(text:))

Creates a `ContentUnavailableView` instance that conveys a search state.

### Creating an unavailable view

[`init(label:description:actions:)`](/documentation/SwiftUI/ContentUnavailableView/init(label:description:actions:))

Creates an interface, consisting of a label and additional content, that you
display when the content of your app is unavailable to users.

[`init ( _ : image : description :)`](/documentation/SwiftUI/ContentUnavailableView/init(_:image:description:))

Creates an interface, consisting of a title generated from a localized
string resource, an image and additional content, that you display when
the content of your app is unavailable to users.

[`init ( _ : systemImage : description :)`](/documentation/SwiftUI/ContentUnavailableView/init(_:systemImage:description:))

Creates an interface, consisting of a title generated from a localized
string resource, a system icon image and additional content, that you
display when the content of your app is unavailable to users.

### Supporting types

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

A structure that represents the body of a static placeholder search view.

## Relationships

### Conforms To

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

---

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)