Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Apple docs
FormsApple

Error summary

List form errors and move focus to the field that needs attention.

Public APILumenErrorSummaryApple / SwiftUISwift product: LumenUI

Apple availability

Supported native targets

Import LumenUI in the target that uses this component. iPad support follows the iOS package baseline and uses native iPad layout behavior.

iPhone · iOS 16+iPad · iPadOS 16+Mac · macOS 13+Apple TV · tvOS 16+Apple Vision · visionOS 1+Apple Watch · watchOS 9+

Native example

Use Error summary

Show it after a failed submit and focus it so people hear the problem first.

Error summary rendered in the iPhone simulator Lumen playground
Captured exampleiPhone simulatorView dark appearance
swift
import LumenUI
import SwiftUI

struct ErrorSummaryExample: View {
    enum Field: String { case email, password }
    @FocusState private var focused: Field?

    private let errors = LumenFormErrors(
        fields: [.init(name: "email", message: "Enter an email address."),
                 .init(name: "password", message: "Use at least 12 characters.")],
        form: ["We couldn't create your account."]
    )

    var body: some View {
        LumenErrorSummary(errors: errors) { error in
            focused = Field(rawValue: error.name)
        }
    }
}
Apple
A form-level summary whose field errors move focus to the matching field.

Reference

Public API

The primary shared and platform-specific options exposed by LumenErrorSummary.

APIValues or typeDefaultDescription
errors / heading / onSelectErrormessages / title / focus callbackrequired / There is a problem / requiredShow it after a failed submit and focus it so people hear the problem first.

Native behavior

Design and accessibility

When to use it

Show it after a failed submit and focus it so people hear the problem first.

Accessibility

A heading names the summary, and each entry focuses its field.

Shared component

Available on other platforms

React NativeAndroid / Compose Web
Apple docsSwiftUI package