Forms
FormField
A pattern that wires a label, a control, and an optional error together. It composes Input and Message and adds no styling beyond the sw-field layout.
import { FormField, Input } from "@somewhere-com/ds";
<FormField label="Password" error={error}>
<Input type="password" />
</FormField>;
Props
label(required): the visible label, rendered as<label for>, so clicking it focuses the control.error: rendered below the control as an errorMessage, announced as an alert, and linked witharia-describedby. It setsaria-invalidon the control.id: the control’s id. It’s generated when omitted. Set it here, not on the Input.children: the control, usually anInput.
A form-level status, like “Access granted”, is a standalone Message outside any field.
Examples
Rendered from the Storybook stories. To change props and see every state live, open FormField in Storybook.