Skip to content

MenuItemRadio: support accessing the radio's value #2915

@ciampo

Description

@ciampo

Motivation

When using MenuItemRadio in controlled mode, the onChange callback is usually used to read the new value and therefore set the new radio checked state, but this is currently not possible.

Usage example

			<DropdownMenuRadioItem
				name="radio"
				value="one"
				checked={ radioValue === 'one' }
				onChange={ ( e ) => setRadioValue( e.target.value ) }
			>
				Radio item 1
			</DropdownMenuRadioItem>

Requirements

  • The onChange prop should expose, as an argument, an event object containing e.target.value

Workaround

Currently consumers of the component need to pass the hardcoded value of the radio

Possible implementations

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or enhancement requesthas workaroundIssue has a temporary solution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions