ValidationFormGroup
Handles bootstrap style field validation and handles related aria attributes.
Manages the rendering of bootstrap-style:
- Help text
- Valid and invalid feedback
For children of type input, textarea, and select:
- Appends bootstrap validation class names
- Appends aria-describedby attributes (for help text and feedback)
basic usage
Show editable code example
Any Paragon component or export may be added to the code example.
<ValidationFormGroupfor="firstName"helpText="This is your name."><label htmlFor="firstName">First Name</label><Inputtype="text"id="firstName"name="first-name"value="Casey"onChange={() => {}}/></ValidationFormGroup>
invalid message
Show editable code example
Any Paragon component or export may be added to the code example.
<ValidationFormGroupfor="firstName"invalidinvalidMessage="Wrong!"><label htmlFor="firstName">First Name</label><Inputtype="text"id="firstName"name="first-name"value="Casey"onChange={() => {}}/></ValidationFormGroup>
valid message
Show editable code example
Any Paragon component or export may be added to the code example.
<ValidationFormGroupfor="firstName"validvalidMessage="What a nice name!"><label htmlFor="firstName">First Name</label><Inputtype="text"id="firstName"name="first-name"value="Casey"onChange={() => {}}/></ValidationFormGroup>
with any kind of input
Show editable code example
Any Paragon component or export may be added to the code example.
<><ValidationFormGroupfor="weatherToday"helpText="Look out the window to see."validvalidMessage="Correct!"><label htmlFor="weatherToday">How is the weather today?</label><selectclassName="form-control"id="weatherToday"name="weather"value="Sunny"onChange={() => {}}><option>Sunny</option><option>Cloudy</option><option>Rainy</option><option>Snowy</option></select></ValidationFormGroup><ValidationFormGroupfor="weatherTomorrow"helpText="Incoming weather."invalidinvalidMessage="No good!"><Form.Control type='text' value='Cloudy' /></ValidationFormGroup></>
Props API#
ValidationFormGroup Props API
- for
string
RequiredId of the form input that the validation is for
- className
string
Additional classnames for this component
- invalid
bool
Determines if invalid styles / message will be shown
- valid
bool
Determines if invalid styles / message will be shown
- validMessage
node
Message to display on valid input
- invalidMessage
node
Message to display on invalid input
- helpText
node
Help text for the form input
- children
node
Usage Insights#
ValidationFormGroup
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-account | 20.36.0 | 1 | |
frontend-app-admin-portal | 20.26.3 | 21 |