---
title: "Alert Components | Explore SwiftUI"
description: "A representation of an alert presentation. Explore 4 SwiftUI alert components with code examples for iOS, macOS, watchOS, tvOS, and visionOS."
canonical_url: "https://exploreswiftui.com/library/alert"
meta:
  author: "Explore SwiftUI"
  "og:description": "A representation of an alert presentation. Explore 4 SwiftUI alert components with code examples for iOS, macOS, watchOS, tvOS, and visionOS."
  "og:image": "https://exploreswiftui.com/_og/d/c_Default%2Ctitle_Alert%2BComponents%2Cdescription_Explore%2B4%2BSwiftUI%2Bcomponents%2Bvisually%2Cp_Ii9saWJyYXJ5L2FsZXJ0Ig%2Cs_NSmpLn8u6rlegVGk.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Alert Components | Explore SwiftUI"
  "twitter:description": "A representation of an alert presentation. Explore 4 SwiftUI alert components with code examples for iOS, macOS, watchOS, tvOS, and visionOS."
  "twitter:image": "https://exploreswiftui.com/_og/d/c_Default%2Ctitle_Alert%2BComponents%2Cdescription_Explore%2B4%2BSwiftUI%2Bcomponents%2Bvisually%2Cp_Ii9saWJyYXJ5L2FsZXJ0Ig%2Cs_NSmpLn8u6rlegVGk.png"
  "twitter:title": "Alert Components | Explore SwiftUI"
---

> Index of every page on this site: [llms.txt](https://exploreswiftui.com/llms.txt)

# **Alert Components**

A representation of an alert presentation.

4 components

![Message Error Alert - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/199/variants/502?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Message Error Alert**

Presents an alert with a message when an error is present.

![Message Item Alert - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/198/variants/381?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Message Item Alert**

Presents an alert with a message using the given data to produce the alert’s content and a localized string key for a title.

![Item Alert - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/197/variants/365?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Item Alert**

Presents an alert using the given data to produce the alert’s content and a text view as a title.

![Error Alert - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/196/variants/325?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Error Alert**

Presents an alert when an error is present.

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://exploreswiftui.com/#website","@type":"WebSite","description":"A visual library for SwiftUI APIs, components, and modifiers","inLanguage":"en-US","name":"Explore SwiftUI","url":"https://exploreswiftui.com/","publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/alert#webpage","@type":"WebPage","description":"A representation of an alert presentation. Explore 4 SwiftUI alert components with code examples for iOS, macOS, watchOS, tvOS, and visionOS.","name":"Alert Components","url":"https://exploreswiftui.com/library/alert","breadcrumb":{"@id":"https://exploreswiftui.com/library/alert#breadcrumb"},"isPartOf":{"@id":"https://exploreswiftui.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://exploreswiftui.com/library/alert"]}],"primaryImageOfPage":{"@id":"https://exploreswiftui.com/#logo"}},{"@id":"https://exploreswiftui.com/#identity","@type":"Organization","description":"A visual library for SwiftUI APIs, components, and modifiers","name":"Explore SwiftUI","url":"https://exploreswiftui.com","logo":{"@id":"https://exploreswiftui.com/#logo"},"sameAs":["https://x.com/Typ0genius","https://mastodon.social/@Typ0genius"]},{"@id":"https://exploreswiftui.com/library/alert#collectionpage","@type":"CollectionPage","description":"A representation of an alert presentation. Explore 4 SwiftUI alert components with code examples for iOS, macOS, watchOS, tvOS, and visionOS.","inLanguage":"en-US","name":"Alert Components","url":"https://exploreswiftui.com/library/alert","about":{"@type":"Thing","name":"SwiftUI"},"isPartOf":{"@id":"https://exploreswiftui.com/#website"}},{"@id":"https://exploreswiftui.com/library/alert#/schema/item-list/1","@type":"ItemList","name":"Alert Components","itemListElement":[{"@type":"ListItem","position":1,"name":"Message Error Alert","url":"https://exploreswiftui.com/library/alert/message-error-alert"},{"@type":"ListItem","position":2,"name":"Message Item Alert","url":"https://exploreswiftui.com/library/alert/message-item-alert"},{"@type":"ListItem","position":3,"name":"Item Alert","url":"https://exploreswiftui.com/library/alert/item-alert"},{"@type":"ListItem","position":4,"name":"Error Alert","url":"https://exploreswiftui.com/library/alert/error-alert"}]},{"@id":"https://exploreswiftui.com/library/alert#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://exploreswiftui.com","position":1},{"@type":"ListItem","name":"Alert","item":"https://exploreswiftui.com/library/alert","position":2}]},{"@id":"https://exploreswiftui.com/#logo","@type":"ImageObject","caption":"Explore SwiftUI","contentUrl":"https://exploreswiftui.com/apple-touch-icon.png","inLanguage":"en","url":"https://exploreswiftui.com/apple-touch-icon.png"}]}
```