Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is a controlId in react-bootstrap

Tags:

I was just going through the React-bootstrap form what is the use of controlId is it similar to name we use in legacy form?

<form>     <FormGroup       controlId="formBasicText" ---------------------->> what is the use?       validationState={this.getValidationState()}     >       <ControlLabel>Working example with validation</ControlLabel>       <FormControl         type="text"         value={this.state.value}         placeholder="Enter text"         onChange={this.handleChange}       />       <FormControl.Feedback />       <HelpBlock>Validation is based on string length.</HelpBlock>     </FormGroup>   </form> 
like image 930
bashIt Avatar asked Oct 16 '17 18:10

bashIt


People also ask

What is controlId in React Bootstrap?

Sets id on <FormControl> and htmlFor on <FormGroup. Label> . Basically it's the input's id and the label's for attribute.

What is controlId in React form?

controlId: It is used to set the id on <FormControl> and htmlFor on <FormGroup. Label> component.

How do you make a horizontal form in React?

Create horizontal forms with the grid by adding as={Row} to form groups and using Col to specify the width of your labels and controls. Be sure to add the column prop to your FormLabel s as well so they're vertically centered with their associated form controls.


1 Answers

As the DOCS says:

Sets id on <FormControl> and htmlFor on <FormGroup.Label>.

Basically it's the input's id and the label's for attribute.

enter image description here

like image 158
Sagiv b.g Avatar answered Sep 19 '22 18:09

Sagiv b.g