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.
Native example
Show it after a failed submit and focus it so people hear the problem first.
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")
}
}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