Form control wrapper that provides reusable label, description, required, invalid, and error association semantics.
Install @wyrd-company/react or the Flutter package and use it directly —
your DESIGN.md does the styling.
catalog/contracts/form-field.ymlsource of truth · verbatim
$schema: https://thewyrdingway.dev/schemas/component-contract.schema.ymlcontractVersion: 0.1.0identity:name: FormFieldtag: wyrd-form-fieldpackage: wyrd.component.form-fieldtitle: Form Fieldsummary: Form control wrapper that provides reusable label, description, required, invalid, and error association semantics.relationships:related-to: - quality-parity-and-gatesclassification:category: form-fieldcomposition: multi-slotinteractive: falsetarget-strategy:react: requiredflutter: requiredsurface:properties: - name: is-requiredtype:kind: booleanrequired: falsedefault: falsereflects: trueserializable: truesummary: Marks the wrapped control as required. - name: is-invalidtype:kind: booleanrequired: falsedefault: falsereflects: trueserializable: truesummary: Marks the wrapped control as invalid and associates the error slot.slots: - name: labelrequired: truecardinality: exactly-oneaccepts: - text - nodesummary: Visible label and accessible-name source for the wrapped control. - name: controlcontent: truerequired: truecardinality: exactly-oneaccepts: - component - nodesummary: Wrapped input, select, or other form control. - name: descriptionrequired: falsecardinality: zero-or-oneaccepts: - text - nodesummary: Hint or help text associated with the wrapped control. - name: errorrequired: falsecardinality: zero-or-oneaccepts: - text - nodesummary: Validation message associated when is-invalid is true.events: []states: - name: defaultsource: platformsummary: Field with label and control. - name: requiredsource: propertysummary: Required state derived from is-required. - name: invalidsource: propertysummary: Invalid state derived from is-invalid.parts: - name: rootsummary: Field container.slots: - label - control - description - error - name: labelsummary: Label text.slots: - label - name: required-indicatorsummary: Required-state visual indicator. - name: controlsummary: Wrapped form control region.slots: - control - name: descriptionsummary: Description text.slots: - description - name: errorsummary: Error text.slots: - errortokens:root:gap: spacing.xslabel:color: color.on-surfacetext: typography.label-mdrequired-indicator:color: color.errordescription:color: color.on-surface-varianttext: typography.body-mderror:color: color.errortext: typography.body-mdmessages: []obligations:accessibility:role: groupname: Label slot provides the accessible name for the wrapped control.description: Description and error slots are programmatically associated with the wrapped control when the target platform exposes control association hooks.keyboard: - Keyboard behavior is owned by the wrapped control.semantics: - Required and invalid states are exposed on the wrapped control when the target platform allows it. - Error text is associated only when invalid.behavior:model: statelessinteractions: - The wrapped control owns value and interaction behavior. - Invalid state associates the error slot and updates visual state.hostEffects: - Generate stable label, description, and error associations for the wrapped control where supported.conditions: - rtl - reduced-motion - cvd-deuteranopia - density-compact - text-expansionsdui:status: serializableserializableProperties: - is-required - is-invalidserializableSlots: - label - control - description - erroreventBindings: []notes: Form Field serializes wrapper semantics only; wrapped controls retain their own value and event contracts.examples: - name: emptystate: defaultproperties: {}slots:label: Namecontrol: Text inputdescription: Use the name shown to collaborators. - name: requiredstate: requiredproperties:is-required: trueslots:label: Namecontrol: Text inputdescription: We need this to greet you. - name: invalidstate: invalidproperties:is-invalid: trueis-required: trueslots:label: Namecontrol: Text inputerror: Name is required.
01
Examples
Generated from the contract's examples block.
Previews are the published @wyrd-company/react component, themed by the
brand's role tokens — flip the site's light/dark toggle and they follow.
emptystate: default
Text input
Use the name shown to collaborators.
Usage
import { WyrdFormField } from"@wyrd-company/react";
<WyrdFormField label="Name" description="Use the name shown to collaborators.">
Text input
</WyrdFormField>
import'package:wyrd_flutter/wyrd_flutter.dart';
WyrdFormField(
label: Text('Name'),
child: Text('Text input'),
description: Text('Use the name shown to collaborators.'),
)
requiredstate: required
Text input
We need this to greet you.
Usage
import { WyrdFormField } from"@wyrd-company/react";
<WyrdFormField isRequired label="Name" description="We need this to greet you.">
Text input
</WyrdFormField>
import'package:wyrd_flutter/wyrd_flutter.dart';
WyrdFormField(
isRequired: true,
label: Text('Name'),
child: Text('Text input'),
description: Text('We need this to greet you.'),
)
invalidstate: invalid
Text input
Name is required.
Usage
import { WyrdFormField } from"@wyrd-company/react";
<WyrdFormField isInvalid isRequired label="Name" error="Name is required.">
Text input
</WyrdFormField>
Marks the wrapped control as invalid and associates the error slot.
03
Slots & events
Slot
Cardinality
Accepts
Summary
label
exactly-one
text, node
Visible label and accessible-name source for the wrapped control.
control
exactly-one
component, node
Wrapped input, select, or other form control.
description
zero-or-one
text, node
Hint or help text associated with the wrapped control.
error
zero-or-one
text, node
Validation message associated when is-invalid is true.
04
Tokens
The contract's token bindings. Open the shared contextual sidebar from any example;
primary swatches reflect the color you pick there. Error swatches show the active
preset's values; editing any knob switches to custom and resets error to TWW · Ink.
Binding
Token
root.gap
spacing.xs
label.color
color.on-surface
label.text
typography.label-md
required-indicator.color
color.error
description.color
color.on-surface-variant
description.text
typography.body-md
error.color
color.error
error.text
typography.body-md
05
States
State
Source
Summary
default
platform
Field with label and control.
required
property
Required state derived from is-required.
invalid
property
Invalid state derived from is-invalid.
06
Accessibility
From the contract's accessibility obligations. Role group; Label slot provides the accessible name for the wrapped control.
Keyboard behavior is owned by the wrapped control.
Required and invalid states are exposed on the wrapped control when the target platform allows it.