Skip to content

Commit

Permalink
[@mantine/core] Radio: Allow null to be passed to Radio.Group value…
Browse files Browse the repository at this point in the history
… to clear the value (#6102)
  • Loading branch information
rtivital committed Apr 23, 2024
1 parent a1da2ae commit 16a76e1
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ import { RadioGroupProvider } from '../RadioGroup.context';

export type RadioGroupStylesNames = InputWrapperStylesNames;

export interface RadioGroupProps extends Omit<InputWrapperProps, 'onChange'> {
export interface RadioGroupProps
extends Omit<InputWrapperProps, 'onChange' | 'value' | 'defaultValue'> {
/** `Radio` components and any other elements */
children: React.ReactNode;

/** Controlled component value */
value?: string;
value?: string | null;

/** Default value for uncontrolled component */
defaultValue?: string;
defaultValue?: string | null;

/** Called when value changes */
onChange?: (value: string) => void;
Expand Down Expand Up @@ -48,8 +49,8 @@ export const RadioGroup = factory<RadioGroupFactory>((props, ref) => {
const _name = useId(name);

const [_value, setValue] = useUncontrolled({
value,
defaultValue,
value: value as string,
defaultValue: defaultValue as string,
finalValue: '',
onChange,
});
Expand Down

0 comments on commit 16a76e1

Please sign in to comment.