UNPKG

@carbon/react

Version:

React components for the Carbon Design System

52 lines (44 loc) 1.52 kB
/** * Copyright IBM Corp. 2016, 2023 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var cx = require('classnames'); var PropTypes = require('prop-types'); var React = require('react'); var usePrefix = require('../../internal/usePrefix.js'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx); var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes); var React__default = /*#__PURE__*/_interopDefaultLegacy(React); const Content = ({ className: customClassName, children, tagName = 'main', ...rest }) => { const prefix = usePrefix.usePrefix(); const className = cx__default["default"](`${prefix}--content`, customClassName); return /*#__PURE__*/React__default["default"].createElement(tagName, { ...rest, className }, children); }; Content.propTypes = { /** * Provide children nodes to be rendered in the content container */ children: PropTypes__default["default"].node, /** * Optionally provide a custom class name that is applied to the container */ className: PropTypes__default["default"].string, /** * Optionally specify the tag of the content node. Defaults to `main` */ tagName: PropTypes__default["default"].string }; exports["default"] = Content;