Skip to content

FormField

FormField

Basic with Input

With Description

Must be at least 8 characters with one number

With Error State

We'll never share your email
This field is required

Required Field

With Textarea

Tell us a little about yourself
import { FormField, Input } from "@f0rbit/ui";
<FormField label="Username" id="username">
<Input id="username" placeholder="Enter username" />
</FormField>

Add helper text below the input:

<FormField
label="Password"
description="Must be at least 8 characters with one number"
id="password"
>
<Input id="password" type="password" />
</FormField>

Display validation errors:

<FormField
label="Email"
error="Please enter a valid email address"
id="email"
>
<Input id="email" error />
</FormField>

Show a required indicator:

<FormField label="Full Name" required id="fullname">
<Input id="fullname" />
</FormField>

FormField works with any form input:

<FormField label="Role" required id="role">
<Select id="role">
<option value="">Select a role</option>
<option value="admin">Admin</option>
<option value="user">User</option>
</Select>
</FormField>
<FormField
label="Bio"
description="Tell us a little about yourself"
id="bio"
>
<Textarea id="bio" placeholder="I'm a software developer who..." />
</FormField>
PropTypeDefaultDescription
labelstringLabel text for the field
descriptionstringHelper text below the input
errorstringError message to display
requiredbooleanfalseShow required indicator
idstringID to associate label with input