@carbon/react
Version:
React components for the Carbon Design System
41 lines (39 loc) • 1.26 kB
JavaScript
/**
* Copyright IBM Corp. 2016, 2026
*
* 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 { usePrefix } from "../../internal/usePrefix.js";
import classNames from "classnames";
import { forwardRef } from "react";
import PropTypes from "prop-types";
import { jsx } from "react/jsx-runtime";
//#region src/components/DataTable/TableCell.tsx
/**
* Copyright IBM Corp. 2016, 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const TableCell = forwardRef((props, ref) => {
const { children, className, hasAILabelHeader, colSpan, ...rest } = props;
const tableCellClassNames = classNames(className, { [`${usePrefix()}--table-cell--column-slug`]: hasAILabelHeader });
return /* @__PURE__ */ jsx("td", {
className: tableCellClassNames ? tableCellClassNames : void 0,
ref,
colSpan,
...rest,
children
});
});
TableCell.displayName = "TableCell";
TableCell.propTypes = {
children: PropTypes.node,
className: PropTypes.string,
colSpan: PropTypes.number,
hasAILabelHeader: PropTypes.bool,
headers: PropTypes.string
};
//#endregion
export { TableCell as default };