Radio

Radio

import Radio from "@kiwicom/orbit-components/lib/Radio";
<Radio label="Radio" />

Props

NameTypeDefaultDescription
checkedbooleanfalseIf true, the Radio will be checked.
defaultCheckedbooleanIf true, the Radio will be checked by default. Only to be used in uncontrolled.
dataTeststringOptional prop for testing purposes.
idstringSet id for Radio input
disabledbooleanfalseIf true, the Radio will be set up as disabled.
hasErrorbooleanfalseIf true, the border of the Radio will turn red. See Functional specs
infoReact.NodeThe additional info about the Radio.
labelstringThe label of the Radio.
namestringThe name for the Radio.
onChangeevent => void \| PromiseFunction for handling onChange event.
reffuncProp for forwarded ref of the Radio. See Functional specs
tabIndexstring \| numberSpecifies the tab order of an element
tooltipElement<Tooltip>Optional property when you need to attach Tooltip to the Radio. See Functional specs
valuestringThe value of the Radio.

Functional specs

class Component extends React.PureComponent<Props> {
componentDidMount() {
this.ref.current && this.ref.current.focus();
}
ref: { current: React.ElementRef<*> | null } = React.createRef();
render() {
return <Radio ref={this.ref} />;
}
}
  • The tooltip property is useful when you need to visually attach Tooltip component only to the Radio’s glyph, not the label or other parts of the Radio.