semantic-ui-react
Version:
The official Semantic-UI-React integration.
34 lines (26 loc) • 760 B
JavaScript
import React from 'react'
import { customPropTypes, getElementType, getUnhandledProps } 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.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