@carbon/react
Version:
React components for the Carbon Design System
42 lines (38 loc) • 1.02 kB
JavaScript
/**
* 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.
*/
import cx from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
import { usePrefix } from '../../internal/usePrefix.js';
const Content = ({
className: customClassName,
children,
tagName = 'main',
...rest
}) => {
const prefix = usePrefix();
const className = cx(`${prefix}--content`, customClassName);
return /*#__PURE__*/React.createElement(tagName, {
...rest,
className
}, children);
};
Content.propTypes = {
/**
* Provide children nodes to be rendered in the content container
*/
children: PropTypes.node,
/**
* Optionally provide a custom class name that is applied to the container
*/
className: PropTypes.string,
/**
* Optionally specify the tag of the content node. Defaults to `main`
*/
tagName: PropTypes.string
};
export { Content as default };