search Esc

Form Validation

Validation states, messages, and live validation via the FormController / Field components. Uses Bootstrap-5 shape: the state class (.is-invalid / .is-valid) lives on the control itself, and a sibling .lp-invalid-feedback / .lp-valid-feedback carries the message.

Contextual states

Add .is-{invalid|valid|warning|info} to the control. The matching sibling feedback (.lp-{invalid|valid|warning|info}-feedback) becomes visible, the label is tinted, and the control border — including hover and focus — matches the state color.

⊗ Please enter a valid email address
✓ Username is available
⚠ Password is weak, consider adding special characters
ⓘ We'll send a verification code to this number
Neutral (default) state
Include country code when dialing internationally.
Hover & focus preview

Move your cursor over each control to see the matching contextual hover border, then click to see the matching focus ring.

Live validation (FormController)

Each field has data-lp-rules listing validation rules. The form validates on blur and on submit.

Must be at least 8 characters.
Built-in validation rules
RuleSyntaxChecks
requiredrequiredValue is not empty
emailemailValid email format
urlurlValid URL format
numericnumericNumeric string
alphaalphaLetters only
phonephonePhone number format
minmin:8Minimum length / numeric value
maxmax:100Maximum length / numeric value
patternpattern:^[a-z]+$Matches a regex
matchmatch:passwordEquals another field's value

Separate multiple rules with |. Parameters follow a colon. Rules can also be registered programmatically via Validator.register(name, fn).

CSS reference
ClassPurpose
.is-invalidOn control: red border + tinted label; reveals .lp-invalid-feedback
.is-validOn control: green border + tinted label; reveals .lp-valid-feedback
.is-warningLaunchpad extension: amber border + tinted label; reveals .lp-warning-feedback
.is-infoLaunchpad extension: blue border + tinted label; reveals .lp-info-feedback
.lp-{invalid|valid|warning|info}-feedbackMessage element paired with each state (hidden by default)
.lp-form-textMuted hint text (auto-hidden when any state class is present on the control)

Hover and focus rings automatically pick up the state color — e.g. a control with .is-warning keeps its amber border on hover and gets an amber focus halo instead of the default primary blue.