• /
  • Log in
  • Free account

RadioGroup

A group of <Radio> buttons. The <Radio> buttons may either be direct children or descendants of the radio group. <Radio> buttons inside a radio group must have a unique value assigned.

Once a radio group is established, selecting any <Radio> in that group automatically deselects any currently-selected <Radio> in the group.

Usage

import { RadioGroup } from 'nr1'

Examples

Basic

ReferenceError: RadioGroup is not defined

Controlled component

Props

childrennode

Content of the RadioGroup.

classNamestring

Appends class names to the component.

defaultValueany

Default value of the radio group. The <Radio> with the matching value will be selected.

Useful when you don't want to use a controlled component.

infostring

Additional information can be displayed in an info tooltip next to the Label.

labelstring

Text to display as label.

onChangefunction

Callback which is fired when the radio group value changes (a <Radio> in the group is selected).

function (
event: Event, //

Event source of the callback.

value: any //

The value of the selected radio button.

) => undefined
styleobject

Inline style for custom styling.

testIdstring

Adds a data-test-id.

Used to target the component in unit and e2e testing.

valueany

Value of the radio group. The radio button with the matching value will be selected.

If defined, it turns the component into a controlled component.

Methods

RadioGroup.render

function () => undefined
Create issueEdit page
Copyright © 2021 New Relic Inc.