Chuyển tới nội dung chính

Radio

Tạo giao diện cho phép người dùng chọn một mục duy nhất trong nhóm các lựa chọn

Properties

Radio

NameTypeDefaultDescription
checkedbooleanTrạng thái của radio, sử dụng dạng controlled component
defaultCheckedbooleanTrạng thái khởi tạo của radio
disabledbooleanTrạng thái radio bị vô hiệu hoá
namestringTên của input radio
labelstringThêm label cho radio
valuestring | numberGiá trị của radio
sizeRadioSizemediumKích thước của radio
onChangefunctionThêm event handler khi trạng thái radio thay đôi

Radio.Group

NameTypeDefaultDescription
defaultValuestring | numberGiá trị mặc định của radio
disabledbooleanVô hiệu hoá các radio trong nhóm
namestringTên của input radio
sizeRadioSizemediumKích thước của radio
optionsArray[]Danh sách các radio cần render thay thế cho cách sử dụng các children là Radio component
onChangefunctionThêm event handler khi giá trị radio group thay đôi

Type

RadioSize

NameDescription
"medium"Kích thước medium - mặc định
"small"Kích thước small

Example

import React from "react";
import { Page, Text, Box, Radio } from "zmp-ui";

export default function HomePage(props) {
return (

<Text.Title size="small">Radio Button</Text.Title>
<Box mt={4}>
<Text bold className="section-page-title">
Medium Size
</Text>
</Box>
<Box mt={6}>

</Box>
<Box mt={6}>

</Box>
<Box mt={6}>

</Box>
<Box mt={6}>

</Box>

<Box mt={4}>
<Text bold className="section-page-title">
Small Size
</Text>
</Box>

<Box mt={6}>

</Box>
<Box mt={6}>

</Box>
<Box mt={6}>

</Box>
<Box mt={6}>

</Box>

);
}