shadcn.io is an independent project built on shadcn/ui
Email is filled with invalid-email. The border is in the error color, and under the field an alert icon sits beside the words Please enter a valid email address. That message is always showing.
Show a message like this after submit, or on blur, once the value is wrong. A banner for the whole form is an Alert. In React, Ark UI does not write the error text.
Installation
Anatomy

Usage
<Field className="w-full max-w-sm" invalid>
<FieldLabel>Email</FieldLabel>
<Input
className="bg-background"
defaultValue="invalid-email"
placeholder="you@example.com"
type="email"
/>
<FieldError className="flex items-center gap-2">
<CircleAlertIcon aria-hidden="true" className="size-4 shrink-0" />
Please enter a valid email address
</FieldError>
</Field>FAQ
How is the field marked invalid?
invalid on Field. It sets aria-invalid on the input, which the input's styles turn into a destructive border and ring, and screen readers announce the field as invalid.
How is the message shown?
In FieldError after the input, in destructive text with a CircleAlertIcon at size-4. The icon has aria-hidden, since the text says it all.
When does the error show?
In this example, always: the field is marked invalid with invalid-email as its default value. In a form, set invalid from your validation, after submit or when the field loses focus, and render the message only then.
Is the error announced?
FieldError is a live region, so screen readers announce the message when it appears.
API Reference
Field
Sets invalid. The rest is on the Field page.
Input
Sets defaultValue="invalid-email", placeholder="you@example.com" and type="email". The rest is on the Input page.





