Interactive previews iPhone

Item Alert

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

Item Alert - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview

Platform Compatibility

iOS 27.0+ iPadOS 27.0+ macOS 27.0+ watchOS 27.0+ tvOS 27.0+ visionOS 27.0+

Tags

SwiftUI Code

Docs
struct Item {}

@State var item: Item? = .init()

var body: some View {
    Text("Foo")
        .alert("Title", item: $item) { alertItem in
            Button("Ok") {
                print("Item nilled")
            }
        }
}

Found an issue or have a suggestion?

Created: June 9, 2026Updated: June 9, 2026

More Alert Components

View all
Message Error Alert - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

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
modifier

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.

Error Alert - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Error Alert

Presents an alert when an error is present.

Explore Other Components

Browse all
RenameButton - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
TextField

RenameButton

A button that triggers a standard rename action

Color Gradient - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview
modifier

Color Gradient

The Color gradient modifier

Icon Phase Store View - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Icon Phase Store View

Creates a view to load a collection of products from the App Store using product identifiers, and merchandise them using their promotional images and a custom placeholder icon.

Current Value Gauge  - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Current Value Gauge

Creates a gauge showing a value within a range and that describes the gauge’s purpose and current value

Button Tint - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

Button Tint

Sets the buttons tint color

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

Gauge

Creates a gauge showing a value within a range and describes the gauge’s purpose and current value

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.

AccessoryCircularCapacityGaugeStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

AccessoryCircularCapacityGaugeStyle

A gauge style that displays a closed ring that’s partially filled in to indicate the gauge’s current value