@@ -19,7 +19,7 @@ import React, {createContext, ForwardedRef, forwardRef, useState} from 'react';
19
19
import { TextContext } from './Text' ;
20
20
21
21
export interface RadioGroupProps extends Omit < AriaRadioGroupProps , 'children' | 'label' | 'description' | 'errorMessage' > , RenderProps < RadioGroupRenderProps > , SlotProps { }
22
- export interface RadioProps extends Omit < AriaRadioProps , 'children' > , RenderProps < RadioRenderProps > { }
22
+ export interface RadioProps extends Omit < AriaRadioProps , 'children' > , RenderProps < RadioRenderProps > , SlotProps { }
23
23
24
24
export interface RadioGroupRenderProps {
25
25
/**
@@ -102,6 +102,7 @@ export interface RadioRenderProps {
102
102
}
103
103
104
104
export const RadioGroupContext = createContext < ContextValue < RadioGroupProps , HTMLDivElement > > ( null ) ;
105
+ export const RadioContext = createContext < ContextValue < RadioProps , HTMLInputElement > > ( null ) ;
105
106
let InternalRadioContext = createContext < RadioGroupState | null > ( null ) ;
106
107
107
108
function RadioGroup ( props : RadioGroupProps , ref : ForwardedRef < HTMLDivElement > ) {
@@ -135,7 +136,7 @@ function RadioGroup(props: RadioGroupProps, ref: ForwardedRef<HTMLDivElement>) {
135
136
< Provider
136
137
values = { [
137
138
[ InternalRadioContext , state ] ,
138
- [ LabelContext , { ...labelProps , ref : labelRef } ] ,
139
+ [ LabelContext , { ...labelProps , ref : labelRef , elementType : 'span' } ] ,
139
140
[ TextContext , {
140
141
slots : {
141
142
description : descriptionProps ,
@@ -150,6 +151,7 @@ function RadioGroup(props: RadioGroupProps, ref: ForwardedRef<HTMLDivElement>) {
150
151
}
151
152
152
153
function Radio ( props : RadioProps , ref : ForwardedRef < HTMLInputElement > ) {
154
+ [ props , ref ] = useContextProps ( props , ref , RadioContext ) ;
153
155
let state = React . useContext ( InternalRadioContext ) ! ;
154
156
let domRef = useObjectRef ( ref ) ;
155
157
let { inputProps, isSelected, isDisabled, isPressed : isPressedKeyboard } = useRadio ( {
0 commit comments