Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Android docs
FormsAndroid

Error summary

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

Public APILumenErrorSummaryAndroid / Compose

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 Android phone emulator Lumen playground
Captured exampleAndroid phone emulatorView dark appearance
kotlin
import androidx.compose.foundation.layout.Column
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import com.santi020k.lumen.*

@Composable
fun SignUpErrors() {
    var email by remember { mutableStateOf("") }
    val emailFocus = remember { FocusRequester() }
    Column {
        LumenErrorSummary(
            errors = listOf(LumenFieldError("email", "Enter an email address")),
            onSelectError = { emailFocus.requestFocus() }
        )
        LumenTextField(email, { email = it }, label = "Email",
            modifier = Modifier.focusRequester(emailFocus), errorMessage = "Enter an email address")
    }
}
Android
A form-level summary that takes focus when errors appear, with a link that moves focus to the email 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 NativeApple / SwiftUI Web
Android docsCompose module