Lab

Sign-up form

Slant / Controls

A sign-up form built from Fields: name, email, a password you can reveal, a plan and the terms, each checked when you submit.

The theme follows the link: share a page with ?theme=moon.

Usage

  • Each control sits in a <Field> with Field.Label, Field.Description and Field.Error; the field gives it an id, aria-describedby, aria-invalid and required, so the parts need no ids.
  • The form is noValidate: Create account checks every field, turns the failing ones invalid so their errors show, and moves focus to the first. After that the errors follow each edit.
  • The password is an InputGroup whose trailing ToggleButton shows or hides the text; the plan is a RadioGroup variant="card" with the price in each aside; the terms are a Checkbox in a required Field.

Keyboard

Tabmoves through the fields, the plan, the checkboxes and Create account
← / → / ↑ / ↓moves the plan while a plan has focus
Spacetoggles the focused checkbox or the password toggle
Entersubmits the form from a text field

Accessibility

  • Each error is linked to its control through aria-describedby only while it shows, and the control is aria-invalid.
  • A status region counts the fields that need attention, then confirms the account; focus moves to the first problem, or to Start over.
  • Required fields carry required; the mark after a label is visual only.

Sign-up form in React and SwiftUI.

Source

The React tab is the component’s real source; the SwiftUI tab is its twin in TUTTNKit.