Skip to content

react-z/react-radio-toggle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-radio-toggle

npm version

A simple radio button toggle component

Install

yarn add react-radio-toggle

Use

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

Styles

Uses styled-components 💅 for the base styling.

Development

yarn
yarn dev

Test

yarn test

Build

yarn
yarn build

Publish

npm login
npm version patch
git add -A
git push origin master
npm publish

License

MIT

About

a radio button toggle component

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published