chenglou / react-radio-group

Better radio buttons.
MIT License
445 stars 75 forks source link

allow to pass className via props #25

Closed mqklin closed 8 years ago

mqklin commented 8 years ago

it will be nice

razh commented 8 years ago

RadioGroup only renders its children. The Radio component passes its props to the <input> element. Therefore this:

<RadioGroup name="fruit" selectedValue={this.state.selectedValue} onChange={this.handleChange}>
  {Radio => (
    <div className="radio-group">
      <Radio value="apple" className="custom-radio-class"/>Apple
      <Radio value="orange" />Orange
      <Radio value="watermelon" />Watermelon
    </div>
  )}
</RadioGroup>

renders to:

<div class="radio-group">
  <input type="radio" name="fruit" value="apple" class="custom-radio-class">Apple
  <input type="radio" name="fruit" value="orange">Orange
  <input type="radio" name="fruit" value="watermelon/>Watermelon
</div>
nkbt commented 8 years ago

Thanks, @razh, that is right.