Igloo branding

FormGroup

The FormGroup is a component that displays a label and an error message for a form input.

Installation

To install @igloo-ui/form-group in your project, you will need to run the following command using npm:

npm install @igloo-ui/form-group

If you prefer Yarn, use the following command instead:

yarn add @igloo-ui/form-group

Usage

Then to use the component in your code just import it!

import FormGroup from '@igloo-ui/form-group';
import Input from '@igloo-ui/input';

<FormGroup label="Name" message="This field is required" showMessage>
  <Input type="text" placeholder="John Doe" error />
</FormGroup>;

API

PropTypeDescription
childrenReactNodeThe form element that needs an error and/or a label.
classNamestringAdd a className for the form group div
dataTeststringAdd a data-test tag for automated tests
messagestringAdd a message below the form element
messageTypeMessageTypeSpecifies the type of message to display
htmlForstringAdd the htmlFor attribute to the label of the form element
labelstringAdd label text above the form element
showMessagebooleanDecides when to show the message