patchkit-selector

1.0.0 • Public • Published

Selector

Like a radio form-control, but with custom HTML elements

screenshot.png

const opts = [
  { img: '/img/pic1.jpg', label: 'First Item', value: 1 },
  { img: '/img/pic2.jpg', label: 'Second Item', value: 2 },
  { img: '/img/pic3.jpg', label: 'Third Item', value: 3 }
]
const onSelect = opt => this.setState({ current: opt.value })
<Selector options={opts} value={this.state.current} onSelect={onSelect} />
const opts = [
  { el: <div><strong>First</strong> El</div>, value: 1 },
  { el: <div><strong>Second</strong> El</div>, value: 2 },
  { el: <div><strong>Third</strong> El</div>, value: 3 }
]
const onSelect = opt => this.setState({ current: opt.value })
<Selector options={opts} value={this.state.current} onSelect={onSelect} />
</div>

/patchkit-selector/

    Package Sidebar

    Install

    npm i patchkit-selector

    Weekly Downloads

    3

    Version

    1.0.0

    License

    GPL-3.0

    Last publish

    Collaborators

    • pfraze
    • cel