Skip to content

Commit

Permalink
fix: RadioGroup typing, controlled prop
Browse files Browse the repository at this point in the history
  • Loading branch information
malangcat committed Jan 15, 2025
1 parent c8b053f commit 64df09d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/react-headless/radio-group/src/RadioGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ RadioGroupLabel.displayName = "RadioGroupLabel";
export interface RadioGroupItemProps
extends RadioItemProps,
PrimitiveProps,
Omit<React.InputHTMLAttributes<HTMLLabelElement>, "value"> {}
Omit<React.LabelHTMLAttributes<HTMLLabelElement>, "value"> {}

export const RadioGroupItem = forwardRef<HTMLLabelElement, RadioGroupItemProps>((props, ref) => {
const { value, invalid, disabled, ...otherProps } = props;
Expand Down Expand Up @@ -76,7 +76,7 @@ RadioGroupItemControl.displayName = "RadioGroupItemControl";

export interface RadioGroupItemHiddenInputProps
extends PrimitiveProps,
React.HTMLAttributes<HTMLInputElement> {}
React.InputHTMLAttributes<HTMLInputElement> {}

export const RadioGroupItemHiddenInput = forwardRef<
HTMLInputElement,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-headless/radio-group/src/useRadioGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export function useRadioGroup(props: UseRadioGroupProps) {
}
},
disabled: itemState.disabled,
defaultChecked: itemState.checked,
defaultChecked: isControlled ? undefined : itemState.checked,
checked: isControlled ? itemState.checked : undefined,
style: visuallyHidden,
}),
Expand Down

0 comments on commit 64df09d

Please sign in to comment.