
Security News
Open Source Maintainers Demand Ability to Block Copilot-Generated Issues and PRs
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
react-styled-radio
Advanced tools
Radio button component for React built with styled-components < π >
Radio button component for React built with styled-components < π >
npm install --save react-styled-radio
yarn add react-styled-radio
import React, { Component } from 'react';
import { RadioGroup, Radio } from 'react-styled-radio';
class Example extends Component {
render () {
return (
<RadioGroup horizontal name="gender">
<Radio small value="male" label="male"/>
<Radio small value="female" label="female"/>
</RadioGroup>
)
}
}
The RadioGroup component accepts the following props.
Prop | Type | Default | Description: Options |
---|---|---|---|
vertical | boolean | false | Display radios vertically |
onChange | function | null | Function to run when value changes |
The Radio component accepts the following props.
Prop | Type | Default | Description: Options |
---|---|---|---|
small | boolean | false | Button size |
large | boolean | false | Button size |
handleChange | function | null | Function to run when value changes |
The handleChange prop is automatically passed the event object. See below example.
class Example extends Component {
onChange = e => {
console.log(e.target.value)
/*
If the first radio is clicked this will log 'male'
If the second radio is clicked this will log 'female'
*/
}
render () {
return (
<RadioGroup horizontal name="gender" onChange={this.onChange}>
<Radio small value="male" label="male"/>
<Radio small value="female" label="female"/>
</RadioGroup>
)
}
}
The theme object can be used to customize the look of the components, with the following values.
Prop | Type | Default |
---|---|---|
inputBg | string | #20232A |
inputBorder | string | #292C34 |
inputColor | string | #212529 |
inputPlace | string | #6B757C |
inputOutline | string | #007BFF |
inputLabel | string | #212529 |
There are two ways to use the theme object.
import { ThemeProvider } from 'styled-components';
...
return (
<ThemeProvider theme={theme}>
<RadioGroup horizontal name="gender" handleChange={this.handleChange}>
<Radio small value="male" label="male"/>
<Radio small value="female" label="female"/>
</RadioGroup>
</ThemeProvider>
);
...
...
return (
<RadioGroup horizontal name="gender" handleChange={this.handleChange}>
<Radio theme={theme} small value="male" label="male"/>
<Radio theme={theme} small value="female" label="female"/>
</RadioGroup>
);
...
Class | Description |
---|---|
.radio__group | Radio group wrapper |
.radio__button | Radio button wrapper |
.radio__text | Radio button label |
Follow these steps to setup a local development environment. Use yarn or npm - not both.
git clone https://github.com/alexcasche/react-styled-radio
npm install && npm start
yarn install && yarn add
cd example
npm install && npm start
yarn install && yarn start
MIT Β© alexcasche
FAQs
Radio button component for React built with styled-components < π >
The npm package react-styled-radio receives a total of 14 weekly downloads. As such, react-styled-radio popularity was classified as not popular.
We found that react-styled-radio demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Β It has 1 open source maintainer collaborating on the project.
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.
Security News
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
Research
Security News
Malicious Koishi plugin silently exfiltrates messages with hex strings to a hardcoded QQ account, exposing secrets in chatbots across platforms.
Research
Security News
Malicious PyPI checkers validate stolen emails against TikTok and Instagram APIs, enabling targeted account attacks and dark web credential sales.