Field
A label, a control, a hint and an error, tied together.
import { Field, Input } from "@forgeron/ui";Shown to everyone you invite.
import { Field, Input } from "@forgeron/ui";
export default function Default() {
return (
<div style={{ width: 320 }}>
<Field label="Workspace name" hint="Shown to everyone you invite.">
{(control) => <Input {...control} defaultValue="Atelier Moreau" />}
</Field>
</div>
);
}Shown to everyone you invite.
This name is taken. Try another one.
import { Field, Input } from "@forgeron/ui";
export default function Default() {
return (
<div style={{ display: "grid", gap: 20, width: 320 }}>
<Field label="Workspace name" hint="Shown to everyone you invite.">
{(control) => <Input {...control} defaultValue="Atelier Moreau" />}
</Field>
<Field label="Subdomain" error="This name is taken. Try another one.">
{(control) => <Input {...control} mono defaultValue="atelier" />}
</Field>
</div>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | — | Above the control. |
hint | ReactNode | — | Help under the control. |
error | ReactNode | — | What happened, then what to do. |
children | (control) => ReactNode | — | Spread `control` on the input: id, aria-describedby, aria-invalid. |
className | string | — | Extra classes. |