Component reference
FormField
Label and feedback compositions for profile fields.
Preview
Live previewOptional six-digit hex. Clear to restore the preset. Check contrast with your brand color.
Changes apply to this preview only.
Profile
A complete form: required fields, a helper, an error, a grouped pair and an action.
Optional links.
Width adapts to the available space
"use client";
import {
Card,
CardHeader,
CardTitle,
CardDescription,
CardContent,
FormField,
FormControl,
Input,
FormGroup,
Textarea,
Button
} from "@pimolu/react";
export function DemoExample() {
return (
<Card>
<CardHeader>
<CardTitle>Profile</CardTitle>
<CardDescription>
A complete form: required fields, a helper, an error, a grouped
pair and an action.
</CardDescription>
</CardHeader>
<CardContent>
<div className="grid gap-5 min-w-0">
<FormField
label="Display name"
required
helperText="Shown on your public profile."
>
<FormControl>
<Input defaultValue="Ada Lovelace" />
</FormControl>
</FormField>
<FormField
label="Email"
required
errorMessage="This address is already in use."
>
<FormControl>
<Input type="email" defaultValue="ada@example.com" invalid />
</FormControl>
</FormField>
<FormGroup
label="Social"
description="Optional links."
orientation="horizontal"
>
<FormField label="GitHub">
<FormControl>
<Input placeholder="ada" />
</FormControl>
</FormField>
<FormField label="Website">
<FormControl>
<Input placeholder="https://" />
</FormControl>
</FormField>
</FormGroup>
<FormField label="Bio" optional optionalLabel="Optional">
<FormControl>
<Textarea rows={3} placeholder="A short introduction" />
</FormControl>
</FormField>
<div className="flex flex-wrap items-center gap-3 min-w-0">
<Button>Save profile</Button>
<Button appearance="ghost">Cancel</Button>
</div>
</div>
</CardContent>
</Card>
);
}More examples
Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.
Field
The label, the control and the message are wired together: htmlFor, id, aria-describedby and aria-invalid.
Error and optional
errorMessage replaces helperText, marks the control invalid and is announced as an alert.
Message
FormMessage also works on its own for a short hint or an error.
Usage
Connect the field's id to its label and descriptive feedback rather than duplicating labels.
API reference
Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.
PimoluFormFieldProps
Type source| Name | Type | Default | Description |
|---|---|---|---|
childrenRequired | ReactNode | — | The control, usually wrapped in FormControl. |
label | ReactNode | — | Visible label. |
id | string | undefined | — | Explicit id of the control; generated when omitted. |
helperText | ReactNode | — | Supporting text below the control. |
errorMessage | ReactNode | — | Error text; takes precedence over helperText. |
required | boolean | undefined | false | Marks the control and its label as required. |
optional | boolean | undefined | false | Shows the optional hint after the label. |
optionalLabel | string | undefined | "Optional" | Text of the optional hint. Defaults to "Optional". |
invalid | boolean | undefined | false | Invalid state without a message. |
disabled | boolean | undefined | false | Disable the field and its label. |
className | string | undefined | — | Public Pimolu prop; see the source declaration for details. |
childrenRequiredReactNodeNo default extracted.
The control, usually wrapped in FormControl.
labelReactNodeNo default extracted.
Visible label.
idstring | undefinedNo default extracted.
Explicit id of the control; generated when omitted.
helperTextReactNodeNo default extracted.
Supporting text below the control.
errorMessageReactNodeNo default extracted.
Error text; takes precedence over helperText.
requiredboolean | undefinedDefault: false
Marks the control and its label as required.
optionalboolean | undefinedDefault: false
Shows the optional hint after the label.
optionalLabelstring | undefinedDefault: "Optional"
Text of the optional hint. Defaults to "Optional".
invalidboolean | undefinedDefault: false
Invalid state without a message.
disabledboolean | undefinedDefault: false
Disable the field and its label.
classNamestring | undefinedNo default extracted.
Public Pimolu prop; see the source declaration for details.
PimoluFormControlProps
Type source| Name | Type | Default | Description |
|---|---|---|---|
childrenRequired | ReactElement<unknown, string | JSXElementConstructor<any>> | — | A single form control. It receives the generated id, aria-describedby, aria-invalid, required and disabled from the surrounding FormField. |
childrenRequiredReactElement<unknown, string | JSXElementConstructor<any>>No default extracted.
A single form control. It receives the generated id, aria-describedby, aria-invalid, required and disabled from the surrounding FormField.
PimoluFormMessageProps
Type source| Name | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Public Pimolu prop; see the source declaration for details. |
variant | "helper" | "error" | undefined | "helper" | Helper text or an error. Defaults to "helper". |
id | string | undefined | — | Explicit id, for aria-describedby. |
className | string | undefined | — | Public Pimolu prop; see the source declaration for details. |
childrenReactNodeNo default extracted.
Public Pimolu prop; see the source declaration for details.
variant"helper" | "error" | undefinedDefault: "helper"
Helper text or an error. Defaults to "helper".
idstring | undefinedNo default extracted.
Explicit id, for aria-describedby.
classNamestring | undefinedNo default extracted.
Public Pimolu prop; see the source declaration for details.
PimoluFormGroupProps
Type source| Name | Type | Default | Description |
|---|---|---|---|
childrenRequired | ReactNode | — | Public Pimolu prop; see the source declaration for details. |
label | ReactNode | — | Group heading. |
description | ReactNode | — | Supporting text under the heading. |
orientation | "horizontal" | "vertical" | undefined | "vertical" | Direction of the items. Defaults to "vertical". |
className | string | undefined | — | Public Pimolu prop; see the source declaration for details. |
childrenRequiredReactNodeNo default extracted.
Public Pimolu prop; see the source declaration for details.
labelReactNodeNo default extracted.
Group heading.
descriptionReactNodeNo default extracted.
Supporting text under the heading.
orientation"horizontal" | "vertical" | undefinedDefault: "vertical"
Direction of the items. Defaults to "vertical".
classNamestring | undefinedNo default extracted.
Public Pimolu prop; see the source declaration for details.
PimoluFieldsetProps
Type source| Name | Type | Default | Description |
|---|---|---|---|
childrenRequired | ReactNode | — | Public Pimolu prop; see the source declaration for details. |
legendRequired | ReactNode | — | Native legend of the fieldset. |
description | ReactNode | — | Supporting text under the legend. |
disabled | boolean | undefined | false | Disable every control in the fieldset. |
className | string | undefined | — | Public Pimolu prop; see the source declaration for details. |
childrenRequiredReactNodeNo default extracted.
Public Pimolu prop; see the source declaration for details.
legendRequiredReactNodeNo default extracted.
Native legend of the fieldset.
descriptionReactNodeNo default extracted.
Supporting text under the legend.
disabledboolean | undefinedDefault: false
Disable every control in the fieldset.
classNamestring | undefinedNo default extracted.
Public Pimolu prop; see the source declaration for details.
Accessibility
- Keep help and errors associated with the input and explain errors in text.