what is a controlId in react-bootstrap

bashIt picture bashIt · Oct 16, 2017 · Viewed 10.4k times · Source

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>

Answer

Sagiv b.g picture Sagiv b.g · Oct 16, 2017

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