@carbon/react
Version:
React components for the Carbon Design System
47 lines (43 loc) • 1.15 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 { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
import PropTypes from 'prop-types';
import React from 'react';
import cx from 'classnames';
import { usePrefix } from '../../internal/usePrefix.js';
function TabContent(props) {
const {
className,
selected,
children,
...other
} = props;
const prefix = usePrefix();
const tabContentClasses = cx(`${prefix}--tab-content`, className);
return /*#__PURE__*/React.createElement("div", _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
};
export { TabContent as default };