UNPKG

889 BJavaScriptView Raw
1import classNames from 'classnames';
2import * as React from 'react';
3import { useBootstrapPrefix } from './ThemeProvider';
4import { jsx as _jsx } from "react/jsx-runtime";
5const defaultProps = {
6 fluid: false
7};
8const Container = /*#__PURE__*/React.forwardRef(({
9 bsPrefix,
10 fluid,
11 // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
12 as: Component = 'div',
13 className,
14 ...props
15}, ref) => {
16 const prefix = useBootstrapPrefix(bsPrefix, 'container');
17 const suffix = typeof fluid === 'string' ? `-${fluid}` : '-fluid';
18 return /*#__PURE__*/_jsx(Component, {
19 ref: ref,
20 ...props,
21 className: classNames(className, fluid ? `${prefix}${suffix}` : prefix)
22 });
23});
24Container.displayName = 'Container';
25Container.defaultProps = defaultProps;
26export default Container;
\No newline at end of file