什么是react-bootstrap中的controlId

时间:2017-10-16 18:14:49

标签: javascript reactjs react-bootstrap

我刚刚浏览了React-bootstrap form controlId的用途是什么,它类似于我们在遗留形式中使用的name

<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>

1 个答案:

答案 0 :(得分:7)

正如DOCS所说:

  

<FormControl>上的htmlFor<FormGroup.Label>设置ID。

基本上它是输入的id和标签的for属性。

enter image description here