Skip to content

RadixToggleGroup.Root has incorrect onValueChange handler type #3738

@DenisBratchikov

Description

@DenisBratchikov

Bug report

According to the latest main (as of 05.11.2025)

onValueChange?(value: string): void;
the onValueChange handler has onValueChange?(value: string): void; type.
However, RadixToggle allows deselecting currently active selected element which means the handler provides undefined value, which is not listed in the handler arguments.

Current Behavior

onValueChange?(value: string): void; provides undefined value in some cases

Expected behavior

onValueChange?(value?: string): void; or onValueChange?(value: string | undefined): void;

Reproducible example

Not needed - the example for deselecting and how to deal with it (e.g. ensuring selection) listed in https://www.radix-ui.com/primitives/docs/components/toggle-group#ensuring-there-is-always-a-value

Suggested solution

Update the type definition

Additional context

N/A

Your environment

N/A

Software Name(s) Version
Radix Package(s) @radix-ui/react-toggle-group ^1.1.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions