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.
Neutral (default) state
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.
Built-in validation rules
| Rule | Syntax | Checks |
|---|---|---|
required | required | Value is not empty |
email | email | Valid email format |
url | url | Valid URL format |
numeric | numeric | Numeric string |
alpha | alpha | Letters only |
phone | phone | Phone number format |
min | min:8 | Minimum length / numeric value |
max | max:100 | Maximum length / numeric value |
pattern | pattern:^[a-z]+$ | Matches a regex |
match | match:password | Equals 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
| Class | Purpose |
|---|---|
.is-invalid | On control: red border + tinted label; reveals .lp-invalid-feedback |
.is-valid | On control: green border + tinted label; reveals .lp-valid-feedback |
.is-warning | Launchpad extension: amber border + tinted label; reveals .lp-warning-feedback |
.is-info | Launchpad extension: blue border + tinted label; reveals .lp-info-feedback |
.lp-{invalid|valid|warning|info}-feedback | Message element paired with each state (hidden by default) |
.lp-form-text | Muted 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.