@@ -6,10 +6,12 @@ Choice(
66 @mouseover ="mouseOver = true" ,
77 @mouseout ="mouseOver = false" ,
88)
9- template( #label , v-if ="slots.label" )
10- slot( name ="label" )
11- template( #help-text , v-if ="slots['help-text']" )
12- slot( name ="help-text" )
9+ template( #label , v-if ="hasSlot(slots.label) || label" )
10+ slot( v-if ="hasSlot(slots.label)" , name ="label" )
11+ template( v-else ) {{ label }}
12+ template( #help-text , v-if ="hasSlot(slots['help-text']) || helpText" )
13+ slot( v-if ="hasSlot(slots['help-text'])" , name ="help-text" )
14+ template( v-else ) {{ helpText }}
1315 span( :class ="styles.RadioButton" )
1416 input(
1517 :id ="uniqueId" ,
@@ -32,17 +34,22 @@ Choice(
3234import { ref , computed , useSlots } from ' vue' ;
3335import { classNames } from ' polaris/polaris-react/src/utilities/css' ;
3436import styles from ' @/classes/RadioButton.json' ;
37+ import { hasSlot } from ' @/utilities/has-slot' ;
3538import { UseUniqueId } from ' @/use' ;
3639import { Choice } from ' ../Choice' ;
3740import { helpTextID } from ' ../Choice/utils' ;
3841
3942interface Props {
4043 /** Indicates the ID of the element that describes the the radio button */
4144 ariaDescribedBy? : string ;
45+ /** Label for the radio button */
46+ label? : string ;
4247 /** Visually hide the label */
4348 labelHidden? : boolean ;
4449 /** Radio button is selected */
4550 checked? : boolean ;
51+ /** Additional text to aid in use. This prop will be overriden by `help-text` slot. */
52+ helpText? : string ;
4653 /** Disable input */
4754 disabled? : boolean ;
4855 /** ID for form input */
0 commit comments