@carbon/react
Version:
React components for the Carbon Design System
51 lines (45 loc) • 1.28 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.
*/
;
Object.defineProperty(exports, '__esModule', { value: true });
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
var PropTypes = require('prop-types');
var React = require('react');
var cx = require('classnames');
var usePrefix = require('../../internal/usePrefix.js');
function TabContent(props) {
const {
className,
selected,
children,
...other
} = props;
const prefix = usePrefix.usePrefix();
const tabContentClasses = cx(`${prefix}--tab-content`, className);
return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({
role: "tabpanel"
}, other, {
className: tabContentClasses,
selected: selected,
hidden: !selected
}), children);
}
TabContent.propTypes = {
/**
* Pass in content to render inside the TabContent
*/
children: PropTypes.node,
/**
* Provide a className for the tab content container
*/
className: PropTypes.string,
/**
* Specify whether the TabContent is selected
*/
selected: PropTypes.bool
};
exports.default = TabContent;