UNPKG

react-bootstrap-v5

Version:

Bootstrap 4 components built with React

24 lines (23 loc) 886 B
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; import React, { useMemo } from 'react'; import FormContext from './FormContext'; var FormGroup = React.forwardRef(function (_ref, ref) { var children = _ref.children, controlId = _ref.controlId, _ref$as = _ref.as, Component = _ref$as === void 0 ? 'div' : _ref$as, props = _objectWithoutPropertiesLoose(_ref, ["children", "controlId", "as"]); var context = useMemo(function () { return { controlId: controlId }; }, [controlId]); return /*#__PURE__*/React.createElement(FormContext.Provider, { value: context }, /*#__PURE__*/React.createElement(Component, _extends({}, props, { ref: ref }), children)); }); FormGroup.displayName = 'FormGroup'; export default FormGroup;