Field
InputMITLabel + input + helper / error wrapper — the building block for every form row.
bun add @otfdashkit/ui
Preview
FieldInput
Loading Storybook preview…
Code
@otfdashkit/uiimport { Field, FieldLabel, FieldDescription, FieldError, Input } from '@otfdashkit/ui'
export function Example() {
return (
<div className="flex flex-col gap-4 max-w-sm">
<Field label="Email" description="We'll never share your email." required>
<Input type="email" placeholder="you@example.com" />
</Field>
<Field label="Username" error="Username is already taken.">
<Input placeholder="johndoe" />
</Field>
<div className="flex flex-col gap-1.5">
<FieldLabel required>Custom label</FieldLabel>
<Input placeholder="value" />
<FieldDescription>Some helper text</FieldDescription>
<FieldError>Validation error message</FieldError>
</div>
</div>
)
}
Free with the SDK. This component ships in @otfdashkit/ui under the MIT license.
Props
Props declared in the Field source. Inherited HTML attributes are not listed.
| Prop | Type | Default | Description |
|---|---|---|---|
| childrenrequired | ReactNode | ||
| className | string | ||
| description | string | ||
| error | string | ||
| label | string | ||
| required | boolean |