Beta v0.6.2

Radio

Radios are used when only one choice may be selected in a series of options.

Import


import { Radio } from "pier-ui";

Usage



import { useState } from "react";
export const ExampleRadio = () => {
const [value, setValue] = useState("1");
return (
<Radio.Group onChange={setValue} value={value}>
<Radio value="1" label="first">
First
</Radio>
<Radio value="2" label="second">
Second
</Radio>
<Radio value="3" label="third">
Third
</Radio>
</Radio.Group>
);
};



Horizontal alignment



import { useState } from "react";
export const ExampleRadio = () => {
const [value, setValue] = useState("1");
return (
<Radio.Group onChange={setValue} value={value} orientation="horizontal">
<Radio value="1" label="first">
First
</Radio>
<Radio value="2" label="second">
Second
</Radio>
<Radio value="3" label="third">
Third
</Radio>
</Radio.Group>
);
};


Colors



import { useState } from "react";
export const ExampleRadio = () => {
const [value, setValue] = useState("1");
return (
<Radio.Group onChange={setValue} value={value} orientation="horizontal">
<Radio value="1" label="first" color="#F87656">
First
</Radio>
<Radio value="2" label="second" color="#F87656">
Second
</Radio>
<Radio value="3" label="third" color="#F87656">
Third
</Radio>
</Radio.Group>
);
};



Props

Radio
PropDescriptionTypeDefault
labellabel for the checkboxstring
classNameclassName for the componentstring
colorColor of the checkboxstringtheme.colors.grey
disabledbooleanfalse
requiredbooleanfalse
defaultCheckedIf true, the radio will be initially checked.booleanfalse
Radio.Group
PropDescriptionTypeDefault
labellabel for the checkboxstring
classNameclassName for the componentstring
orientationorientation of the component: horizontal or verticalstringvertical
defaultValueUse this to provide a default value for an uncontrolled field.string
valuevalue for the field ( controlled )string