@cimpress/react-components
Version:
React components to support the MCP styleguide
112 lines • 4.18 kB
JavaScript
import React from 'react';
import { CodeExample } from '@cimpress/react-components';
import RadioCode from '!raw-loader!./radio.jsx';
import RadioDemo from './radio.jsx';
import RadioInlineCode from '!raw-loader!./radioinline.jsx';
import RadioInlineDemo from './radioinline.jsx';
import ComponentDoc from '../../shared/TabbedComponentDoc';
const RadioDocs = () => {
const radioGroupPropInfos = [
{
name: 'inline',
type: 'boolean',
default: 'false',
description: 'If true, radio options will display in a row instead of stacked. If there is not enough width for all options, radios will wrap.',
},
{
name: 'children',
type: 'node',
default: '',
description: (React.createElement("div", null,
"Pass ",
React.createElement("code", null, "<Radio />"),
" elements as children to the radio group.")),
},
{
name: 'defaultSelected',
type: 'any',
default: '',
description: 'The default radio group selection. If no default is defined, no radio button will be initially selected.',
},
{
name: 'valueSelected',
type: 'any',
default: '',
description: 'The current selected value of the radio group.',
},
{
name: 'onChange',
type: 'function',
default: '',
description: (React.createElement("div", null,
React.createElement("p", null, "Callback function that is fired when the selected radio button changes. "),
React.createElement("p", null,
"Signature: ",
React.createElement("code", null,
"function(event: object, value: undefined) ",
'=>',
" void"),
' '),
React.createElement("p", null,
React.createElement("code", null, "event:"),
" Change event targeting the radio button."),
React.createElement("p", null,
React.createElement("code", null, "value:"),
" Value of the selected radio button",
' '))),
},
];
const propInfos = [
{
name: 'name',
type: 'string',
default: '',
description: 'Name to apply to the child radio buttons.',
},
{
name: 'className',
type: 'string',
default: '',
description: 'Additional classNames to be appended to the parent container of the radio buttons',
},
{
name: 'label',
type: 'string or node',
default: '',
description: 'Label for the radio button.',
},
{
name: 'id',
type: 'string',
default: '',
description: 'ID prop for the input field',
},
{
name: 'value',
type: 'any',
default: '',
description: 'Value of the radio button',
},
{
name: 'disabled',
type: 'boolean',
default: 'false',
description: 'Marks the radio button as disabled',
},
{
name: 'className',
type: 'string',
default: '',
description: 'Additional classNames to be appended to the parent element of the input field',
},
];
return (React.createElement("div", null,
React.createElement(ComponentDoc, { name: "Radio Group", propInfos: radioGroupPropInfos }),
React.createElement(ComponentDoc, { name: "Radio", propInfos: propInfos },
React.createElement(RadioDemo, null),
React.createElement(CodeExample, { code: RadioCode }),
React.createElement(RadioInlineDemo, null),
React.createElement(CodeExample, { code: RadioInlineCode }))));
};
export default RadioDocs;
//# sourceMappingURL=index.js.map