Skip to main content
161

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Web docs
Form system

Forms that keep the platform working

One accessible field contract, native submission by default, and focused adapters when a framework should own form state.

Baseline
Native
Validation
Composable
Targets
3

Architecture

Lumen does not replace a form state manager or server framework. It makes controls, errors, and submission states consistent while preserving native browser behavior.

Lumen

Controls, labels, hints, errors, summaries, pending presentation, native values, and reset behavior.

Browser

FormData, constraint validation, autofill, password managers, ordinary POST, and no-JavaScript fallback.

Integration

React Hook Form state or Astro Action parsing and server validation when the application opts in.

Application

Business rules, authorization, persistence, rate limits, redirects, and domain-specific copy.

Building blocks

Form is a real form element. Field owns the relationship between its Label, hint, control, and FieldError. ErrorSummary collects failures after submit. PasswordField and ListBox preserve native submitted controls behind their enhanced presentation.

There is a problem

Enter a complete email address.

Use at least 12 characters.

astro
---
import { Button, Field, FieldError, Form, Input, Label } from '@santi020k/lumen-astro'
---

<Form action="/profile" method="POST">
  <Field controlId="email" describedBy="email-error">
    <Label for="email">Email</Label>
    <Input
      aria-describedby="email-error"
      id="email"
      name="email"
      required
      type="email"
    />
    <FieldError id="email-error" />
  </Field>
  <Button type="submit">Save profile</Button>
</Form>
---
import { Button, Field, FieldError, Form, Input, Label } from '@santi020k/lumen-astro'
---

<Form action="/profile" method="POST">
  <Field controlId="email" describedBy="email-error">
    <Label for="email">Email</Label>
    <Input
      aria-describedby="email-error"
      id="email"
      name="email"
      required
      type="email"
    />
    <FieldError id="email-error" />
  </Field>
  <Button type="submit">Save profile</Button>
</Form>

Choose one validation owner

Native mode

Use Form plus native attributes such as required, pattern, min, and max. Astro and Elements can enhance the same validity events; React can use useFormValidation.

Managed React mode

React Hook Form owns validation and touched/dirty state. Lumen reflects the result. Do not mount useFormValidation on the same form unless duplicate validation is intentional.

Server-first Astro mode

Astro Actions parse and validate the POST. Render returned values and normalized errors on the server, then redirect after success.

Submitted value contracts

These values are framework-independent and flow through FormData. Arrays are repeated entries; Lumen does not hide objects in undocumented comma-separated strings.

ControlSubmitted value
CheckboxGroupRepeated entries with the same field name
Select / ListBoxOne scalar value, or repeated values in multiple mode
DatePickerISO calendar date: YYYY-MM-DD
DateRangePickerTwo explicitly named ISO date entries
TimeFieldNative local-time string
InputOTPOne scalar string
TagGroupRepeated entries
FileUploadNative File entries
ColorPickerOne CSS color string
TreeSelect / CascaderStable selected keys, never display labels

Integration guides

Web docsFull catalog