Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
react-native-radio-buttons-group
Advanced tools
Readme
Simple, best and easy to use radio buttons for react native apps.
npm i react-native-radio-buttons-group --save
or
yarn add react-native-radio-buttons-group
import React, { useMemo, useState } from 'react';
import RadioGroup from 'react-native-radio-buttons-group';
export default function App() {
const radioButtons = useMemo(() => ([
{
id: '1', // acts as primary key, should be unique and non-empty string
label: 'Option 1',
value: 'option1'
},
{
id: '2',
label: 'Option 2',
value: 'option2'
}
]), []);
const [selectedId, setSelectedId] = useState();
return (
<RadioGroup
radioButtons={radioButtons}
onPress={setSelectedId}
selectedId={selectedId}
/>
);
}
import React, { useMemo, useState } from 'react';
import RadioGroup, {RadioButtonProps} from 'react-native-radio-buttons-group';
export default function App() {
const radioButtons: RadioButtonProps[] = useMemo(() => ([
{
id: '1', // acts as primary key, should be unique and non-empty string
label: 'Option 1',
value: 'option1'
},
{
id: '2',
label: 'Option 2',
value: 'option2'
}
]), []);
const [selectedId, setSelectedId] = useState<string | undefined>();
return (
<RadioGroup
radioButtons={radioButtons}
onPress={setSelectedId}
selectedId={selectedId}
/>
);
}
Key | Type | Required | Default | Valid Values |
---|---|---|---|---|
accessibilityLabel | string | no | Value of label | any string |
borderColor | string | no | color | css color formats |
borderSize | number | 2 | positive numbers | |
color | string | no | #444 | css color formats |
containerStyle | object | no | react style | |
description | ReactNode or string | no | any react node or string | |
descriptionStyle | object | no | react style, applied only if description is a string | |
disabled | boolean | no | false | true / false |
id | string | yes | unique string | |
label | ReactNode or string | no | any react node or string | |
labelStyle | object | no | react style, applied only if label is a string | |
layout | enum | no | row | row / column |
onPress | function | no | any function | |
selected | boolean | no | false | true / false |
size | number | no | 24 | positive numbers |
testID | string | no | any string | |
value | string | no | any string |
Key | Type | Required | Default | Valid Values |
---|---|---|---|---|
accessibilityLabel | string | no | any string | |
containerStyle | object | no | react style | |
labelStyle | object | no | react style | |
layout | enum | no | column | row / column |
onPress | function | no | any function | |
radioButtons | array | yes | array of RadioButton objects | |
selectedId | string | no | unique string | |
testID | string | no | any string |
<RadioGroup
radioButtons={radioButtons}
onPress={onPressRadioButton}
layout='row'
/>
Fork and create a pull request
FAQs
Simple and Best. An easy to use radio buttons for react native apps.
The npm package react-native-radio-buttons-group receives a total of 6,819 weekly downloads. As such, react-native-radio-buttons-group popularity was classified as popular.
We found that react-native-radio-buttons-group demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.