Skip to main content

Pivotal UI

v19.0.0

Radios

The RadioGroup is a controlled input. The name and onChange props are passed down to all child components, which should be <Radio/> components (or <input type="radio"/>).

Controlled Radios
ReferenceError: React is not defined

Props

RadioGroup props

PropertyRequiredTypeDefaultDescription
idnoStringThe id of the element
nameyesStringThis name is passed to all children, so you don't have to specify name manually each time
onChangenoFunctionCallback that fires each time selection is changed
valuenoAnyShould match the value of one of the Radio children

Radio props

PropertyRequiredTypeDefaultDescription
checkedfalsebooleanWhether the radio is checked, when controlled
childrenfalsenodeContent to place within label to the right of the radio
classNamefalsestringClass name to put on outer div element
defaultCheckedfalsebooleanWhether the radio is checked, when uncontrolled
disabledfalsebooleanWhether the radio is disabled
idfalsestringAuto-generated unique ID with prefix "radio"ID to put on the inner input[type="radio"]
labelClassNamefalsestringClass name to put on the radio label
namefalsestringName to set on inner input[type="radio"]
noSelectfalsebooleanWhen true, prevents the label text from being selectable
onChangefalsefunconChange callback to set on inner input[type="radio"]
stylefalseobjectStyle to put on outer div element
valuetruestringValue of the input[type="radio"]

All other props will be put onto the inner input[type="radio"].

Imports

Import React components (including CSS):

import {Radio, RadioGroup} from 'pivotal-ui/react/radio';

Import CSS only:

import 'pivotal-ui/css/radio';