Error summary
Linked field errors
Check your details
Enter a valid email address.
open System
open FSharp.ViewEngine
open Acme.Components.Primitives
open Acme.Components.Application
open type Html
open type Svg
open type Datastar
let errorSummaryExample =
// Your application supplies this validation error.
let emailError = "Enter a valid email address."
let email =
Input.create "email" "Email address"
|> Input.withId "summary-email"
|> Input.withType InputType.Email
|> Input.withValue "not-an-email"
|> Input.withValidation emailError
div {
_class "grid min-w-0 max-w-xl gap-4 p-4"
ErrorSummary.create "example-errors" "Check your details" [
// The summary link targets the same input rendered below.
FieldError.create (Input.id email) "Email address" emailError
]
|> ErrorSummary.render
Input.render email
}Click the error to focus its field. Your application supplies and clears validation messages.