semantic-ui-react
Version:
The official Semantic-UI-React integration.
45 lines (36 loc) • 868 B
JavaScript
import React from 'react'
import {
customPropTypes,
getElementType,
getUnhandledProps,
META,
} from '../../lib'
import Radio from '../../addons/Radio'
import FormField from './FormField'
/**
* Sugar for <Form.Field control={Radio} />.
* @see Form
* @see Radio
*/
function FormRadio(props) {
const { control } = props
const rest = getUnhandledProps(FormRadio, props)
const ElementType = getElementType(FormRadio, props)
return <ElementType {...rest} control={control} />
}
FormRadio._meta = {
name: 'FormRadio',
parent: 'Form',
type: META.TYPES.COLLECTION,
}
FormRadio.propTypes = {
/** An element type to render as (string or function). */
as: customPropTypes.as,
/** A FormField control prop. */
control: FormField.propTypes.control,
}
FormRadio.defaultProps = {
as: FormField,
control: Radio,
}
export default FormRadio