Skip to content

Field

The form primitive. It ties the label, hint, and error to their control—an id shared with the label, aria-describedby pointing to the message, aria-invalid, and the required/disabled states. In HTML, that’s the ts input-label, the control, and the ts input-hint, side by side. You write the label, hint, and error once, right there.

Forms · TaishoDS Core, in plain HTML.

Examples

One working example per case. Each example is the HTML of its preview—copy it as is, and with Core’s CSS and JS loaded, it looks and works the same.

Required field with hint

html

When to use

  • Almost every time you add a control. It’s what ties the label, hint, and error to it.
  • You need to show an error or hint that’s tied to the field and announced by screen readers.
  • You want a single place to handle required/disabled for the label and control together.

When not to use

  • The control is self-explanatory and has no visible label (an icon button) → give it an aria-label directly.
  • It’s a standalone toggle or checkbox with its label beside it, not a field with a label on top.

Do

  • Use a real label, not a placeholder. The placeholder disappears as soon as you type.
  • One Field per control. To group several, wrap them in a fieldset.

Don’t

  • Don’t repeat the label or hint on the control. They go once, tied to it.
  • Don’t use it for layout. It wires up accessibility; it isn’t a layout.

TaishoDS Core

Needs Core’s JS, which hooks in through data-ts-* attributes.

It’s a wrapper for the label, hint, and error. The control inside (Input, Textarea) brings its own behavior.

Core hooks into it through these attributes. They go in the markup, and there’s nothing to initialize.

  • data-ts-field-spinner
  • data-ts-input

What it does: Nothing of its own. The example’s <input> carries Input’s attributes (data-ts-input, data-ts-field-spinner) for the loading state and the debounce. Input’s Core script handles them, not Field’s.

From the CDN, without a build, this component has no file of its own—it comes with taisho.base.css and the files below. Also load:

  • taisho.icon.css

For how Core works in general, see Behavior.

Accessibility

  • The label, hint, and error are linked to the control through for/id and aria-describedby. An invalid control carries aria-invalid="true".

Verification

What was actually tested. Anything that wasn’t tested says so—we’d rather say “not verified” than claim too much.

  • axe WCAG 2.2 A + AA in a real browser, in light and dark mode, before every release.
  • keyboard Adds no keys of its own—it uses the browser’s native behavior.
  • screen reader Not verified with a screen reader. Test it in your own combination of components, not just here, where each one appears alone and on its happy path.