1.0.3 • Published 4 years ago

azir-radio v1.0.3

Weekly downloads
7
License
MIT
Repository
github
Last release
4 years ago

Azir Framwork : https://azir.io/docs

If you want to read documentaion about Radio Group, Checkbox, Switch, Checkbox group please check azir docs. https://azir.io/docs

Radio

An advance Radio component that should render nicely on any platform. Supports a great level of customization.

Installation

to install the latest version of azir-radio you only need to run:

this package incluse also : (Radio, Switch, CheckBox, RadioGroup, CheckboxGroup )

npm install azir-radio --save

or

yarn add azir-radio

Examples

Basic

import { Radio } from "azir-radio";
---
<Radio
  id="1"
  value="5"
  onChange={event => {
    console.log(event);
  }}>
  Nice Radio :)
</Radio>

Advance

import { Radio } from "azir-radio";
---
<Radio
  id="1"
  value="5"
  onChange={event => {
    console.log(event);
  }}
  checked
  hideIconBorder={true}
  size={60}
  iconActiveColor="success"
  textActiveColor="#00ff00"
  textStyle={ { fontSize: 18 } }>
  active Radio :)
</Radio>
<Radio
  id="2"
  value="10"
  onChange={event => {
    console.log(event);
  }}
  checked={false}
  hideInActiveIcon={false}
  hideLable={false}
  size={30}
  iconInActiveColor="red"
  textInActiveColor="theme"
  textStyle={ { fontSize: 14 } }
  iconStyle={ { borderRadius: 0 } }
  style={ { borderWidth: 1, borderColor: "#ff9900", padding: 5 } }>
  inactive Radio :(
</Radio>

Custom Icons

import { Radio } from "azir-radio";
import  { SolidIcons } from "azir-icon";
---
<Radio
  id="1"
  value="5"
  onChange={event => {
    console.log(event);
  }}
  iconActive={SolidIcons.box}
  iconInActive={SolidIcons.boxOpen}
  hideInActiveIcon={false}
  iconStyle={ { width: 50, height: 50, borderRadius: 25 } }
>
  Box
</Radio>

Props


Reference

id

the id of your component, should be unique when u use radioGroup.

TypeRequired
stringYes

value

the value property do not appear in the user interface.The value property only has meaning when you click on the component and you want to receive the value for which radio has been selected.

TypeRequired
stringYes

onChange

Handler to be called when the user click the the component, ; passes the event as an argument.

Event Object {
  "checked": false,
  "id": "1",
  "value": "5",
}
TypeRequired
functionYes

disabled

If true, disable all interactions for this component.

TypeRequiredDefault
boolNofalse

checked

the default state if it checked or not .

TypeRequiredDefault
boolNofalse

flexDirection

flexDirection controls which directions children of a container go.(radio icon, and label) row goes left to right, column goes top to bottom

TypeRequiredDefault
'row', 'row-reverse', 'column', 'column-reverse'Norow

size

set the size of the icon .

TypeRequiredDefault
NumberNoAzirTheme.SIZES.RADIO_SIZE

hideLable

Hide Radio label when it set to true . or you simply not pass text children to the radio component.

TypeRequiredDefault
boolNofalse

textActiveColor

the text color of the component label when its checked .

TypeRequiredDefault
azir-colorNotheme

textInActiveColor

the text color of the component label when its unchecked .

TypeRequiredDefault
azir-colorNoAzirTheme.COLORS.BLACK

textDisabledColor

the text color of the component label when its disabled .

TypeRequiredDefault
azir-colorNoAzirTheme.COLORS.MUTED

iconActive

if you want to change the default icon of the radio button when its active, you need just to pass the new icon name using this prop.

TypeRequiredDefault
azir-icon (SolidIcons, RegularIcons, BrandIcons,customIcons)NoAzirTheme.STRINGS.RADIO_DEFAULT_ICON

iconInActive

if you want to change the default icon of the radio button when its inActive, you need just to pass the new icon name using this prop.

TypeRequiredDefault
azir-icon (SolidIcons, RegularIcons, BrandIcons,customIcons)NoAzirTheme.STRINGS.RADIO_DEFAULT_ICON

iconActiveColor

the color of the radio icon and its border when its checked .

TypeRequiredDefault
azir-colorNotheme

iconInActiveColor

the color of the radio icon and its border when its unchecked .

TypeRequiredDefault
azir-colorNoAzirTheme.COLORS.BLACK

iconDisabledColor

the color of the radio icon and its border when its disabled .

TypeRequiredDefault
azir-colorNoAzirTheme.COLORS.MUTED

hideInActiveIcon

by default when radio button is uncheced we only show the border and hide the icon by default.if you want to keep the icon when the radio is unchecked you need to set the prop to false.

TypeRequiredDefault
boolNotrue

hideIconBorder

by default we show the radio icon border , this is very important in the case hideInActiveIcon set to true.if you dont like to show the icon border just set this prop to true.

TypeRequiredDefault
boolNofalse

style

override radio button (label + icon) container style for example if you want to change width,height,padding,....

TypeRequired
styleNo

textStyle

override radio button label style for example if you want to change fontSize,....

TypeRequired
styleNo

iconStyle

override radio button icon style for example if you want to change borderRadius,....

TypeRequired
styleNo