Sha256: f3a8ca16076a9dbf0b5cb6e95b5c9320c1b362948444a3a0a8030a7bae994451

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

import React from "react";
import SelectableCard from "../_selectable_card.jsx";

class SelectableCardSingleSelect extends React.Component {
  state = {
    selected: null
  }

  handleSelect = event => {
    this.setState({
      selected: event.target.value
    })
  }

  render() {
    return (
      <div class="pb--doc-demo-row">

        <SelectableCard
            inputId="male1"
            name="gender"
            value="male"
            multi={false}
            checked={this.state.selected === 'male'}
            onChange={this.handleSelect.bind(this)}>
          {`Male`}
        </SelectableCard>

        <SelectableCard
            inputId="female1"
            name="gender"
            value="female"
            multi={false}
            checked={this.state.selected === 'female'}
            onChange={this.handleSelect.bind(this)}>
          {`Female`}
        </SelectableCard>

        <SelectableCard
            inputId="other1"
            name="gender"
            value="other"
            multi={false}
            checked={this.state.selected === 'other'}
            onChange={this.handleSelect.bind(this)}>
          {`Other`}
        </SelectableCard>
        
      </div>
    );
  }
}

export default SelectableCardSingleSelect;

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
playbook_ui-3.1.0 app/pb_kits/playbook/pb_selectable_card/docs/_selectable_card_single_select.jsx
playbook_ui-3.0.1 app/pb_kits/playbook/pb_selectable_card/docs/_selectable_card_single_select.jsx
playbook_ui-3.0.0 app/pb_kits/playbook/pb_selectable_card/docs/_selectable_card_single_select.jsx