diff --git a/components/radio/radio-button.tsx b/components/radio/radio-button.tsx index cee3e7cd..46b06c68 100644 --- a/components/radio/radio-button.tsx +++ b/components/radio/radio-button.tsx @@ -9,14 +9,22 @@ const RadioButton = (props: IRadioProps, ref: React.Ref) => { const radioGroupContext = React.useContext(RadioGroupContext) const { getPrefixCls, prefixCls, compDefaultProps: userDefaultProps } = React.useContext(ConfigContext) - const { prefixCls: customPrefixcls, ...radioProps } = getCompProps('Radio', userDefaultProps, props) + let { prefixCls: customPrefixcls, title, children, ...radioProps } = getCompProps('Radio', userDefaultProps, props) + + if (typeof children === 'string' && typeof title === 'undefined') { + title = children + } const radioButtonPrefixCls = getPrefixCls?.(prefixCls, `radio-button`, customPrefixcls) if (radioGroupContext) { radioProps.checked = props.value === radioGroupContext.value radioProps.disabled = props.disabled || radioGroupContext.disabled } - return + return ( + + {children} + + ) } export default React.forwardRef(RadioButton)