Spirit Design System
Form Validations - Development Preview
GitHub Project
Spirit Docs →
Real-World examples
Username
ZIP code
Your age (min. 14)
Password
Retype password
Email
Phone
I accept the terms and conditions (required)
Submit
Common Validations
Required TextField
TextField
type="email"
, not required
TextField
minlength="2"
TextField
type="number"
, not required
TextField
type="number"
,
min="100"
, not required
TextField
type="number"
,
min="100"
, required
TextField with
pattern="/^\d+\.\d{2}$/"
(match decimal with 2 points), required
TextField with same as above field, but with custom message
Submit
Custom global validator
Required TextField, Range 10 - 30
Submit
Custom validator to a specific field
Required TextField, First Letter Capitalized
Submit
Custom error messages
Required TextField
Required TextField,
type="number"
,
min="100"
I accept the terms and conditions
Submit