DETAIL PANEL · DEMO

Sample project review

Keep your context while reviewing the details.

Ready for review
Template route
/felix/components/validation
Project
Riverside workspace (fictitious)
Owner
Morgan Lee (fictitious)

Summary

This is an original example. The underlying page stays visible while the panel holds the details. No account, payment or external service is connected.

Review note

Skip to content

Validation and field states ​

Back to Felix components · Felix molecule reference

This dedicated Felix example uses the current linen, slate and turquoise appearance. Its fg-* classes are local guide styles, not an installed prop API. The controller and fictitious actions remain local. Source-catalog snippets below are references, not dependencies of this Felix demo.

Validation tells people what needs correction and preserves their work. Use visible helper text before entry, specific feedback after a field is visited or a form is submitted, and a confirmed result only after the relevant checks finish. A green border is not proof that an email exists or that a server accepted a record.

Try local validation ​

Submit empty, type an invalid sample, then use sample@example.test. Leaving the field marks it visited. Submit focuses the invalid field; correct input shows a sample format message. Reset returns the neutral state. All data is fictitious and local. Nothing is sent or saved.

Use a fictitious address such as sample@example.test. No mail is sent.

Fictitious local validation. Nothing is sent.

How to use it ​

  1. State the rule first. Keep the label and helper visible. Required, length and format rules should not be a surprise.
  2. Choose when to show errors. Do not label an untouched empty form as failed. After blur or submit, show the current correction next to the field.
  3. Associate the feedback. Use unique IDs and aria-describedby for both help and feedback. Set aria-invalid="true" for a known invalid state.
  4. Use clear language. Say what to change. Do not rely on color, a cross icon or a generic "Invalid" badge alone.
  5. Keep values and restore a path forward. On failed submit, focus the first invalid field or a linked error summary for long forms. Do not erase user work.
  6. Separate local format from server outcome. The server owns authorization, business rules and final acceptance. A matching pattern proves only that pattern matched.

Anatomy ​

PartPurpose
Label and required hintPersistent field name and expectation.
Native controlEditable value, focus and keyboard behavior.
Helper textFormat guidance available before an error.
Feedback textSpecific error or qualified valid-state message.
Submit resultOperation-level feedback, distinct from each field's correction.
Error summaryFor longer forms, links to invalid fields after submit. Not needed for this single-field example.

Data shape ​

FelixValidationUsageDemo.vue has no props or emitted events. Its actual refs/computed values are:

ts
// email: string = ''
// touched: boolean = false
// submitted: boolean = false
// result: string = 'Fictitious local validation. Nothing is sent.'
// field: HTMLInputElement | null
// error: computed string, empty when the sample pattern matches
// show: computed boolean, touched || submitted

The sample rejects an empty trimmed value, then tests /^[^\s@]+@[^\s@]+\.[^\s@]+$/ against the untrimmed value. This intentionally simple rule is not a complete email-address parser or ownership check. Surrounding whitespace is rejected by the format check. The form uses novalidate so this one custom feedback path, rather than native validation popups, runs on submit. The native email type still supplies semantics and the input remains required.

submit() marks submitted, updates local result, waits for Vue's render and focuses the invalid field. reset() clears refs. No timers, network requests, asynchronous validation or server state exist here.

An application can model more than one field explicitly:

ts
type FieldState = { value: string; touched: boolean; error: string | null }
type Submission = 'idle' | 'pending' | 'success' | 'error'

This is an integration model, not a universal validation API across the catalogs.

Usage ​

html
<label for="sample-email">Email (required)</label>
<input id="sample-email" type="email" required
  aria-invalid="true" aria-describedby="sample-help sample-error">
<p id="sample-help">Use the address you want associated with this record.</p>
<p id="sample-error">Enter an email address in the expected format.</p>

Render the error and invalid state only when a check has failed. Remove the invalid state when the value is no longer invalid. With multiple instances, scope all IDs. A class named invalid has no accessibility effect by itself.

Custom submit lifecycle ​

ts
async function submit() {
  submitted.value = true
  if (error.value) {
    await nextTick()
    field.value?.focus()
    return
  }
  // Run the real authorized save here, with pending/error recovery.
  // Announce success only after the server confirms it.
}

Import the Vue functions and refs from your application. For many fields, validate all relevant values and provide a linked summary rather than repeatedly moving focus while typing. If using native constraint validation instead, avoid duplicate custom/native announcements and test the chosen flow.

States and variants ​

  • Neutral: label and helper present; no premature error on untouched fields.
  • Touched: the user left the field; show a correction if invalid. Do not seize focus on blur.
  • Invalid: visible error text plus aria-invalid, with aria-describedby pointing at the rendered feedback.
  • Valid: a qualified local format message, not a claim of identity or successful saving. Do not announce every keystroke as a new alert.
  • Submitted with errors: preserve input; focus the first error or summary. A summary should link to each control.
  • Pending: for real async checks, guard against stale responses, duplicate submits and race conditions. This demo has no pending work.
  • Server error: distinguish field errors from connection/permission errors. Keep data, allow retry and never display success from a click alone.
  • Disabled / read-only: neither means valid. Explain unavailability; do not use a disabled field to hide a required correction.

Template map ​

SurfaceWhat it actually shows
Lustro expandedValidation: .inp.ok / .inp.bad visual specimens and hint colors. Fixed sample values do not run validation.
Felix expandedValidation: corresponding valid/invalid specimen styles. Wire label IDs and real feedback when integrating.
Lumen expandedValidation links to the bundled gallery. Inspect the actual controls there.
Scopecraft expandedValidation: separate template-scoped visual specimens.
Lustro baseUI kit, components, guide: related general form context, not a shared validation engine.
Relay / Folio / Pace / SparkRelay, Folio, Pace, Spark use StudioCatalog. The atom preview marks any nonempty email as a sample error; it does not parse valid addresses. The form layout uses native required constraints. Keep those distinct from this guide's pattern check.

Legacy specimens are visual references, not production-ready validation contracts. This guide documents their limits without silently rewriting their behavior.

Motion and accessibility ​

The border changes over 120ms; reduced motion removes that transition. Text explains every valid/invalid state. The local result uses a polite status region, while field feedback is associated with the input. This avoids turning every typed character into an assertive alert.

Tab follows native controls. Enter submits. Invalid submit focuses the field only after feedback is rendered. Do not move focus as someone types, erase their value or make color the only signal. Test keyboard, zoom, screen-reader descriptions and a narrow viewport with long translated errors.

Integration notes ​

Import FelixValidationUsageDemo.vue for this exact local example. Keep validation logic separate from presentation, use safe text rendering and validate on the server as well. Async checks must ignore stale responses and handle timeout/cancellation. Do not log private input or paste it into demo fields. All addresses and results here are fictitious; no mailbox is contacted or verified.

Lateral detail drawer

Open a detail panel without losing the page behind it. This shared pattern follows the current template's colors. Fictitious data; actions stay local.