Field
Vertical form field stack with label, helper description, and validation error slots.
Clear the @ symbol to preview the invalid field state.
Usage
import { field, fieldDescription, fieldError, fieldLabel } from "coatx/field";
import { input } from "coatx/input";
export const EmailField = ({ error }: { error?: string }) => (
<div {...field()}>
<label for="email" {...fieldLabel()}>
Email
</label>
<input id="email" type="email" {...input({ invalid: Boolean(error) })} />
{error ? (
<p {...fieldError()}>{error}</p>
) : (
<p {...fieldDescription()}>We never share your email.</p>
)}
</div>
);
Exports (coatx/field)
| Export | Description |
|---|---|
field(options?) |
Field stack container |
fieldLabel(options?) |
Field label slot |
fieldDescription(options?) |
Muted helper copy slot |
fieldError(options?) |
Destructive validation message slot |
fieldStyles |
Compiled StyleX style map |