Socket
Socket
Sign inDemoInstall

react-simple-radio-button

Package Overview
Dependencies
0
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-simple-radio-button

Custom radio button group for react projects


Version published
Weekly downloads
21
increased by950%
Maintainers
1
Install size
265 kB
Created
Weekly downloads
 

Readme

Source

react-simple-radio-button

Installation

npm install react-simple-radio-button --save

Features

  • React RadioButton
  • You can create radio group with n number of options
  • You can pass options as array
  • Set a default value
  • Get the selected value as string
  • Customized UI
  • Can override the styles

Usage

<ReactRadioGroup 
    options={'Option 1', 'Option 2', 'Option 3'}
    defaultSelected='Option 2'/>

Props

<ReactSingleDropdown>

NameTypeDefaultDescription
optionsarray[]Specify the select(Dropdown) component options as an array of values. For example ['option 1', 'options 2', option 3']
defaultSelectedstringnullSpecify one option from the options array as default selected option if required.
onChangefunctionselected valueThis is a call-back function which returns the selected value back on onChange.

Example

import React from 'react'

import ReactRadioGroup from 'react-simple-radio-button'

export default class Demo extends React.Component {

  onOptionSelect = (value) => {
    console.log('Selected value=', value)
  }
  
  render() {
    return <div>
      <h1>react-simple-radio-button Demo</h1>
      <ReactRadioGroup 
      defaultSelected = 'Option 3'
      onChange={this.onOptionSelect}
      options={['Option 1','Option 2','Option 3']} />
    </div>
  }
}

License

MIT

Keywords

FAQs

Last updated on 26 Jul 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc