When to use it
Show it after a failed submit and focus it so people hear the problem first.
List form errors and move focus to the field that needs attention.
Apple availability
Import LumenUI in the target that uses this component. iPad support follows the iOS package baseline and uses native iPad layout behavior.
Native example
Show it after a failed submit and focus it so people hear the problem first.
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)
}
}
}Reference
The primary shared and platform-specific options exposed by LumenErrorSummary.
| API | Values or type | Default | Description |
|---|---|---|---|
| errors / heading / onSelectError | messages / title / focus callback | required / There is a problem / required | Show it after a failed submit and focus it so people hear the problem first. |
Native behavior
Show it after a failed submit and focus it so people hear the problem first.
A heading names the summary, and each entry focuses its field.
Shared component