import * as React from 'react'; import * as System from '~/components/system'; import Group from '~/components/system/Group'; import SystemPage from '~/components/system/SystemPage'; import ViewSourceLink from '~/components/system/ViewSourceLink'; const RADIO_GROUP_OPTIONS = [ { value: '1', label: ( Option one
I want to have cake and soda for breakfast.
), }, { value: '2', label: ( Option two
I want to have cake and soda for lunch.
), }, { value: '3', label: ( Option three
I want to have cake and soda for dinner.
), }, ]; export default class SystemPageRadios extends React.Component { state = { exampleOne: '2', }; _handleChange = (e) => { this.setState({ [e.target.name]: e.target.value }); }; render() { return ( Radios

The Radio component is used when you require a user to select only one value in a series of options.


Imports

Import React and the RadioGroup Component.

{`import * as React from 'react'; import { RadioGroup } from 'slate-react-system';`}

Usage

Define the radio group values and labels.
{`const RADIO_GROUP_OPTIONS = [ { value: '1', label: ( Option one
I want to have cake and soda for breakfast.
), }, { value: '2', label: ( Option two
I want to have cake and soda for lunch.
), }, { value: '3', label: ( Option three
I want to have cake and soda for dinner.
), } ];`}

Declare the RadioGroup component.
{`class ExampleOne extends React.Component { state = { ExampleOne: '2' } _handleChange = e => this.setState( { [e.target.name]: e.target.value } ); render() { return( ) } }`}

Output



Accepted React Properties

); } }