A simple radio button toggle component
yarn add react-radio-toggle
import Toggle from 'react-radio-toggle'
import ReactDOM from 'react-dom'
import React, { Component } from 'react'
class TestComponent extends Component {
toggled(value) {
console.log(value)
}
render() {
let items = ['apple', 'orange', 'lemon', 'peach']
return (
<div>
<Toggle
items={items}
checked="apple"
name="toggleFruits"
onToggle={this.toggled.bind(this)}
/>
</div>
)
}
}
ReactDOM.render(<TestComponent />, document.getElementById('root'))
Uses styled-components 💅 for the base styling.
yarn
yarn dev
yarn test
yarn
yarn build
npm login
npm version patch
git add -A
git push origin master
npm publish