logoAnt Design

⌘ K
  • 디자인
  • 개발
  • 컴포넌트
  • 블로그
  • 자료
5.21.3
  • Components Overview
  • General
    • Button
    • FloatButton
      5.0.0
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
      5.10.0
    • Grid
    • Layout
    • Space
    • Splitter
      5.21.0
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
      5.5.0
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
    • Popover
    • QRCode
      5.1.0
    • Segmented
    • Statistic
    • Table
    • Tabs
    • Tag
    • Timeline
    • Tooltip
    • Tour
      5.0.0
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
      5.1.0
  • Other
    • Affix
    • App
      5.1.0
    • ConfigProvider
    • Util
      5.13.0

Radio

Used to select a single state from multiple options.
가져오기import{ Radio }from"antd";
소스components/radio
문서
이 페이지 수정변경 로그

Resources

Ant Design Charts
Ant Design Pro
Ant Design Pro Components
Ant Design Mobile
Ant Design Mini
Ant Design Landing-Landing Templates
Scaffolds-Scaffold Market
Umi-React Application Framework
dumi-Component doc generator
qiankun-Micro-Frontends Framework
ahooks-React Hooks Library
Ant Motion-Motion Solution
China Mirror 🇨🇳

Community

Awesome Ant Design
Medium
Twitter
yuque logoAnt Design in YuQue
Ant Design in Zhihu
Experience Cloud Blog
seeconf logoSEE Conf-Experience Tech Conference
Work with Us

Help

GitHub
Change Log
FAQ
Bug Report
Issues
Discussions
StackOverflow
SegmentFault

Ant XTech logoMore Products

yuque logoYuQue-Document Collaboration Platform
AntV logoAntV-Data Visualization
Egg logoEgg-Enterprise Node.js Framework
Kitchen logoKitchen-Sketch Toolkit
Galacean logoGalacean-Interactive Graphics Solution
xtech logoAnt Financial Experience Tech
Theme Editor
Made with ❤ by
Ant Group and Ant Design Community
loading

When To Use

  • Used to select a single state from multiple options.
  • The difference from Select is that Radio is visible to the user and can facilitate the comparison of choice, which means there shouldn't be too many of them.

Examples

API

Common props ref:Common props

Radio/Radio.Button

PropertyDescriptionTypeDefault
autoFocusWhether get focus when component mountedbooleanfalse
checkedSpecifies whether the radio is selectedbooleanfalse
defaultCheckedSpecifies the initial state: whether or not the radio is selectedbooleanfalse
disabledDisable radiobooleanfalse
valueAccording to value for comparison, to determine whether the selectedany-

RadioGroup

Radio group can wrap a group of Radio。

PropertyDescriptionTypeDefaultVersion
buttonStyleThe style type of radio buttonoutline | solidoutline
defaultValueDefault selected valueany-
disabledDisable all radio buttonsbooleanfalse
nameThe name property of all input[type="radio"] childrenstring-
optionsSet children optionalstring[] | number[] | Array<CheckboxOptionType>-
optionTypeSet Radio optionTypedefault | buttondefault4.4.0
sizeThe size of radio button stylelarge | middle | small-
valueUsed for setting the currently selected valueany-
blockOption to fit RadioGroup width to its parent widthbooleanfalse5.21.0
onChangeThe callback function that is triggered when the state changesfunction(e:Event)-

CheckboxOptionType

PropertyDescriptionTypeDefaultVersion
labelThe text used to display as the Radio optionstring-4.4.0
valueThe value associated with the Radio optionstring | number | boolean-4.4.0
styleThe style to apply to the Radio optionReact.CSSProperties-4.4.0
disabledSpecifies whether the Radio option is disabledbooleanfalse4.4.0
titleAdds the Title attribute valuestring-4.4.0
idAdds the Radio Id attribute valuestring-4.4.0
onChangeTriggered when the value of the Radio Group changes(e: CheckboxChangeEvent) => void;-4.4.0
requiredSpecifies whether the Radio option is requiredbooleanfalse4.4.0

Methods

Radio

NameDescription
blur()Remove focus
focus()Get focus

Design Token

컴포넌트 토큰어떻게 사용하나요?

토큰 이름설명타입기본값
buttonBg单选框按钮背景色string#ffffff
buttonCheckedBg单选框按钮选中背景色string#ffffff
buttonCheckedBgDisabled单选框按钮选中并禁用时的背景色stringrgba(0, 0, 0, 0.15)
buttonCheckedColorDisabled单选框按钮选中并禁用时的文本颜色stringrgba(0, 0, 0, 0.25)
buttonColor单选框按钮文本颜色stringrgba(0, 0, 0, 0.88)
buttonPaddingInline单选框按钮横向内间距number15
buttonSolidCheckedActiveBg单选框实色按钮选中时的激活态背景色string#0958d9
buttonSolidCheckedBg单选框实色按钮选中时的背景色string#1677ff
buttonSolidCheckedColor单选框实色按钮选中时的文本颜色string#fff
buttonSolidCheckedHoverBg单选框实色按钮选中时的悬浮态背景色string#4096ff
dotColorDisabled单选框圆点禁用颜色stringrgba(0, 0, 0, 0.25)
dotSize单选框圆点大小number8
radioSize单选框大小number16
wrapperMarginInlineEnd单选框右间距number8

글로벌 토큰어떻게 사용하나요?

Basic
codepen icon
External Link Icon
expand codeexpand code
Radio Group
codepen icon
External Link Icon
expand codeexpand code
Block Radio.Group
codepen icon
External Link Icon
expand codeexpand code
5.21.0
radio style
codepen icon
External Link Icon
expand codeexpand code
Size
codepen icon
External Link Icon
expand codeexpand code
Badge style
codepen icon
External Link Icon
expand codeexpand code
Component Token
codepen icon
External Link Icon
expand codeexpand code
disabled
codepen icon
External Link Icon
expand codeexpand code
Vertical Radio.Group
codepen icon
External Link Icon
expand codeexpand code
Radio.Group group - optional
codepen icon
External Link Icon
expand codeexpand code
Radio.Group with name
codepen icon
External Link Icon
expand codeexpand code
Solid radio button
codepen icon
External Link Icon
expand codeexpand code
Wireframe
codepen icon
External Link Icon
expand codeexpand code
12