Design
System
Browse field guides

Text fields

Collect a short answer with a visible label, a hint and recoverable validation.

Interactive example

Check an empty name to see the error, then enter a name and check again.

Use a name your team will recognize.

View HTML
HTML
<label for="workspace">Workspace name</label>
<input id="workspace" name="workspace" required
       maxlength="60" aria-describedby="name-hint">
<p id="name-hint">Use a name your team will recognize.</p>

Native markup

HTML
<label for="workspace">Workspace name</label>
<input id="workspace" name="workspace" required
       maxlength="60" aria-describedby="name-hint">
<p id="name-hint">Use a name your team will recognize.</p>

Implementation contract

Label and hint
Connect the label with for and point aria-describedby to the hint.
Constraints
Use required and maxlength when the application has those constraints. Match those rules when validating the submitted value.
Error state
On a failed submission, set aria-invalid="true" and include the error message ID in aria-describedby. Clear the error association after a valid submission.

For product-specific imports and props, check the Agrikit reference and the package version your project uses.

Label and hint

Give the control a persistent label. Place format instructions next to the field before someone starts typing. Use a placeholder only for an optional example.

Validation

In the example, submit an empty name, then enter a name and submit again. The error explains what to fix and the field retains its value. Validate at a meaningful point, such as submit, and show the message next to the field so it stays in context.

Documentation history

The initial guide introduced the workspace-name example with empty and valid submission states. The tabbed edition adds explicit markup and validation contracts.

Read nextWorkflows →