Skip to content

Field

Provides a flexible container for form inputs, labels, and helper text.

Please enter your first name
Please enter your last name
Select your occupation
Please type in your bio
import { Field } from '@fintech-sandpit/ui/react';
return (
<Field.Root required>
<Field.Label>
First name
<Field.RequiredIndicator />
</Field.Label>
<Field.Input placeholder="John" />
<Field.ErrorText>
Invalid first name
</Field.ErrorText>
<Field.HelperText>
Please enter your first name
</Field.HelperText>
</Field.Root>
<Field.Root required>
<Field.Label>
Last name
<Field.RequiredIndicator />
</Field.Label>
<Field.Input placeholder="Doe" />
<Field.ErrorText>
Invalid last name
</Field.ErrorText>
<Field.HelperText>
Please enter your last name
</Field.HelperText>
</Field.Root>
<Field.Root required>
<Field.Label>
Occupation
<Field.RequiredIndicator />
</Field.Label>
<Field.Select>
<option disabled>
Select an occupation
</option>
<option value="software-engineer">
Software Engineer
</option>
<option value="product-manager">
Product Manager
</option>
<option value="designer">
Designer
</option>
</Field.Select>
<Field.ErrorText>
Invalid text
</Field.ErrorText>
<Field.HelperText>
Select your occupation
</Field.HelperText>
</Field.Root>
<Field.Root>
<Field.Label>
Bio
</Field.Label>
<Field.Textarea
placeholder="Enter your bio here..."
rows={3}
autoresize
/>
<Field.ErrorText>
Invalid text
</Field.ErrorText>
<Field.HelperText>
Please type in your bio
</Field.HelperText>
</Field.Root>
);
NameTypeRequiredDefaultDescription
orientationOrientationverticalOrientation of the field
sizeSizemdSize of the field
requiredbooleanfalseWhether the field is required
invalidbooleanfalseWhether the field is invalid
readOnlybooleanfalseWhether the field is read only
disabledbooleanfalseWhether the field is disabled
type Orientation = 'horizontal' | 'vertical'
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl'