Form

Coordinate fields: one effect at a time, the first invalid field, the button ready to submit.

Resources

Place an order

All fields are required.

Delivery

Frames
0
Active effects
0
Renderer
none

When to use it

  • To group fields and a submission. With guide, on a form people discover: sign-up, checkout.
  • guide is useless on a short, familiar form (search, sign-in): the glow teaches nothing there.

Recommendations

  • Return a promise from onSubmit: sending, success and failure play with no extra code.
  • ready for what the library cannot read: captcha, payment.
  • Do not disable the button while the form is incomplete.

Accessibility

The library

  • Native <form> element: Enter submits, native validation kept.
  • On submit, focus moves to the first invalid field; the error wave follows the form order, counts as a single effect and lasts under 5 s.
  • Double submit ignored, without disabling the button.
  • The "required" glow is CSS and its space is reserved: it never shifts the layout.
  • No effect on a field that cannot be seen.

Integration

  • The requirement written in the label (an explained asterisk, or "required"): the glow doubles it, never carries it.
  • Tied error texts, and the success or failure of the submission announced with aria-live.

WCAG 2.2 criteria: Use of Color · Pause, Stop, Hide · Error Identification · Labels or Instructions · Status Messages

Props

PropTypePurpose
onSubmit(e) => unknownA returned promise: busy button, double submit ignored, then success or failure.
guidebooleanOn first interaction, a glow after the label of each required field.
readybooleanWhat the library cannot read (captcha, payment): false until ready.
…FormHTMLAttributesThe attributes of a native <form>.

Spec

The normative spec for this component: Formulaire

Availability and resources

Status
available · open source
Packages
@shader-ui/react (React, Next.js)
@shader-ui/core (TypeScript, plain HTML)
Source code
form.ts (core) · Form.tsx (React)