1.0.0 • Published 5 years ago

@rn-components-kit/radio v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Radio

NPM version

English | 中文

Radio buttons allow users to select one option from a set. It supports following features:

  • disable click
  • customized checked/unChecked icon
  • three animation types

How to use

npm install @rn-components-kit/radio --save
PreviewCode
Demo1 Code
Demo2 Code
Demo3 Code
Demo4 Code

Reference

Props for Radio.Group

style

Allow you to customize style

TypeRequiredDefault
objectno-

defaultValue

Default value to speficy which radio button is selected initially

TypeRequiredDefault
anyno-

onValueChange

(value: any) => void
TypeRequiredDefault
functionno() => {}

A callback will be triggered when selected value changes

Props for Radio.Button

style

Allow you to customize style

TypeRequiredDefault
objectno-

value

According to value for comparison, to determine whether the selected

TypeRequiredDefault
anyyes-

title

Title of radio button

TypeRequiredDefault
stringyes-

titleStyle

Allows you to customize title's style

TypeRequiredDefault
objectno-

iconSize

Size of icon (or width and height for image, if you specify checkedImage/unCheckedImage)

TypeRequiredDefault
numberno20

disabled

Determines whether radio button is available

TypeRequiredDefault
booleannofalse

checked

Flag for checking the icon

TypeRequiredDefault
booleannofalse

checkedIconType

Checked icon (Icon Preset)

TypeRequiredDefault
stringno'check-radio'

checkedIconColor

Color of checked icon

TypeRequiredDefault
stringno'#1890FF'

checkedImage

If you are not satisfied with icon preset, you can specify an image for checked icon

TypeRequiredDefault
stringno-

unCheckedIconType

UnChecked icon (Icon Preset)

TypeRequiredDefault
stringno'circle'

unCheckedIconColor

Color of unChecked icon

TypeRequiredDefault
stringno'#BFBFBF'

unCheckedImage

If you are not satisfied with icon preset, you can specify an image for unChecked icon

TypeRequiredDefault
stringno-

animationType

Determines which animation is adpoted when checked value changes

  • none: no animation
  • opacity: fade in/out
  • size: zoom in/out
TypeRequiredDefault
enum('none', 'opacity', 'size')no'size'

onPress

() => void

A callback will be triggered when radio button is pressed

TypeRequiredDefault
functionno() => {}