logoAnt Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
YouMindTRACTIANLobeHub
6.4.3
  • Components Overview
  • Changelog
    v6.4.3
  • General
    • Button
    • FloatButton
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
    • Grid
    • Layout
    • Masonry
      6.0.0
    • Space
    • Splitter
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
    • Tabs
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
    • 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
      DEPRECATED
    • Popover
    • QRCode
    • Segmented
    • Statistic
    • Table
    • Tag
    • Timeline
    • Tooltip
    • Tour
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
  • Other
    • Affix
    • App
    • BorderBeam
      6.4.0
    • ConfigProvider
    • Util
When To Use
Examples
Basic
disabled
Radio Group
Vertical Radio.Group
Block Radio.Group
Radio.Group group - optional
radio style
Radio.Group with name
Size
Solid radio button
Custom semantic dom styling
API
Radio/Radio.Button
Radio.Group
CheckboxOptionType
Methods
Radio
Semantic DOM
Design Token

Radio

Used to select a single state from multiple options.
Importimport { Radio } from 'antd';
GitHub
components/radioIssueOpen issues
Docs
Edit this pageLLMs.md
contributors
    MentionsRate

    Resources

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

    Community

    Awesome Ant Design
    Medium
    X
    yuque logoAnt Design in YuQue
    Ant Design in Zhihu
    Experience Cloud Blog
    seeconf logoSEE Conf-Experience Tech Conference

    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
    WeaveFox logoWeaveFox-AI Development with WeaveFox 🦊
    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.
    tsx
    // When use Radio.Group, recommended ✅
    return (
    <Radio.Group
    value={value}
    options={[
    { value: 1, label: 'A' },
    { value: 2, label: 'B' },
    { value: 3, label: 'C' },
    ]}
    />
    );
    // Not recommended 🙅🏼‍♀️
    return (
    <Radio.Group value={value}>
    <Radio value={1}>A</Radio>
    <Radio value={2}>B</Radio>
    <Radio value={3}>C</Radio>
    </Radio.Group>
    );

    Examples

    API

    Common props ref:Common props

    Radio/Radio.Button

    PropertyDescriptionTypeDefaultVersion
    checkedSpecifies whether the radio is selectedbooleanfalse
    classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-6.0.0
    defaultCheckedSpecifies the initial state: whether or not the radio is selectedbooleanfalse
    disabledDisable radiobooleanfalse
    stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-6.0.0
    valueAccording to value for comparison, to determine whether the selectedany-

    Radio.Group

    Radio group can wrap a group of Radio.

    PropertyDescriptionTypeDefaultVersion
    blockOption to fit RadioGroup width to its parent widthbooleanfalse5.21.0
    buttonStyleThe style type of radio buttonoutline | solidoutline
    classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-6.0.0
    defaultValueDefault selected valueany-
    disabledDisable all radio buttonsbooleanfalse
    nameThe name property of all input[type="radio"] children. If not set, it will fallback to a randomly generated namestring-
    optionsSet children optionalstring[] | number[] | Array<CheckboxOptionType>-
    optionTypeSet Radio optionTypedefault | buttondefault4.4.0
    orientationOrientationhorizontal | verticalhorizontal
    sizeThe size of radio button stylelarge | medium | small-
    stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-6.0.0
    valueUsed for setting the currently selected valueany-
    verticalIf true, the Radio group will be vertical. Simultaneously existing with orientation, orientation takes prioritybooleanfalse
    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
    classNameclassName of the Radio optionstring-5.25.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

    Semantic DOM

    Design Token

    Component TokenHow to use?
    Token NameDescriptionTypeDefault Value
    buttonBgBackground color of Radio buttonstring#ffffff
    buttonCheckedBgBackground color of checked Radio buttonstring#ffffff
    buttonCheckedBgDisabledBackground color of checked and disabled Radio buttonstringrgba(0,0,0,0.15)
    buttonCheckedColorDisabledColor of checked and disabled Radio button textstringrgba(0,0,0,0.25)
    buttonColorColor of Radio button textstringrgba(0,0,0,0.88)
    buttonPaddingInlineHorizontal padding of Radio buttonnumber15
    buttonSolidCheckedActiveBgBackground color of checked solid Radio button text when activestring#0958d9
    buttonSolidCheckedBgBackground color of checked solid Radio button textstring#1677ff
    buttonSolidCheckedColorColor of checked solid Radio button textstring#fff
    buttonSolidCheckedHoverBgBackground color of checked solid Radio button text when hoverstring#4096ff
    dotColorDisabledColor of disabled Radio dotstringrgba(0,0,0,0.25)
    dotSizeSize of Radio dotnumber8
    radioSizeRadio sizenumber16
    wrapperMarginInlineEndMargin right of Radio buttonnumber8
    Global TokenHow to use?
    Token NameDescriptionTypeDefault Value
    colorBgContainerContainer background color, e.g: default button, input box, etc. Be sure not to confuse this with `colorBgElevated`.string#ffffff
    colorBgContainerDisabledControl the background color of container in disabled state.stringrgba(0,0,0,0.04)
    colorBorderDefault border color, used to separate different elements, such as: form separator, card separator, etc.string#d9d9d9
    colorPrimaryBrand color is one of the most direct visual elements to reflect the characteristics and communication of the product. After you have selected the brand color, we will automatically generate a complete color palette and assign it effective design semantics.string#1677ff
    colorPrimaryActiveDark active state under the main color gradient.string#0958d9
    colorPrimaryBorderThe stroke color under the main color gradient, used on the stroke of components such as Slider.string#91caff
    colorPrimaryHoverHover state under the main color gradient.string#4096ff
    colorTextDefault text color which comply with W3C standards, and this color is also the darkest neutral color.stringrgba(0,0,0,0.88)
    colorTextDisabledControl the color of text in disabled state.stringrgba(0,0,0,0.25)
    borderRadiusBorder radius of base componentsnumber6
    borderRadiusLGLG size border radius, used in some large border radius components, such as Card, Modal and other components.number8
    borderRadiusSMSM size border radius, used in small size components, such as Button, Input, Select and other input components in small sizenumber4
    controlHeightThe height of the basic controls such as buttons and input boxes in Ant Designnumber32
    controlHeightLGLG component heightnumber40
    controlHeightSMSM component heightnumber24
    controlOutlineControl the outline color of input component.stringrgba(5,145,255,0.1)
    controlOutlineWidthControl the outline width of input component.number2
    fontFamilyThe font family of Ant Design prioritizes the default interface font of the system, and provides a set of alternative font libraries that are suitable for screen display to maintain the readability and readability of the font under different platforms and browsers, reflecting the friendly, stable and professional characteristics.string-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'
    fontSizeThe most widely used font size in the design system, from which the text gradient will be derived.number14
    fontSizeLGLarge font sizenumber16
    lineHeightLine height of text.number1.5714285714285714
    lineTypeBorder style of base componentsstringsolid
    lineWidthBorder width of base componentsnumber1
    lineWidthFocusControl the width of the line when the component is in focus state.number3
    marginXSControl the margin of an element, with a small size.number8
    motionDurationMidMotion speed, medium speed. Used for medium element animation interaction.string0.2s
    motionDurationSlowMotion speed, slow speed. Used for large element animation interaction.string0.3s
    motionEaseInOutCircPreset motion curve.string
    Cubic Bezier Visualizer
    cubic-bezier(0.78, 0.14, 0.15, 0.86)External Link Icon
    paddingXSControl the extra small padding of the element.number8
    Basic

    The simplest use.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Radio Group

    A group of radio components.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Block Radio.Group

    The block property will make a Radio.Group fit to its parent width.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    5.21.0
    radio style

    The combination of radio button style.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Size

    There are three sizes available: large, medium, and small. It can coordinate with input box.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Custom semantic dom styling

    You can customize the semantic dom style of radio by passing objects/functions through classNames and styles.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    6.0.0
    disabled

    Radio unavailable.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Vertical Radio.Group

    Vertical Radio.Group, with more radios.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Radio.Group group - optional

    Render radios by configuring options. Radio type can also be set through the optionType parameter.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Radio.Group with name

    Passing the name property to all input[type="radio"] that are in the same Radio.Group. It is usually used to let the browser see your Radio.Group as a real "group" and keep the default behavior. For example, using left/right keyboard arrow to change your selection that in the same Radio.Group.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Solid radio button

    Solid radio button style.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon






    • root
      6.0.0
      Root element with layout styles, cursor styles, disabled text color and other basic container styles
    • icon
      6.0.0
      Icon element with border radius, transition animations, border styles, hover states, focus states and other interactive styles
    • label
      6.0.0
      Label element with padding, text color, disabled states, alignment and other text styles