@carbon/react
Version:
React components for the Carbon Design System
43 lines (41 loc) • 1.38 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 { deprecate } from "../../prop-types/deprecate.js";
import classNames from "classnames";
import "react";
import PropTypes from "prop-types";
import { jsx } from "react/jsx-runtime";
//#region src/components/DataTable/TableToolbar.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 TableToolbar = ({ ["aria-label"]: ariaLabel = "data table toolbar", ariaLabel: deprecatedAriaLabel, children, size, ...rest }) => {
const prefix = usePrefix();
const className = classNames({
[`${prefix}--table-toolbar`]: true,
[`${prefix}--table-toolbar--${size}`]: size
});
return /* @__PURE__ */ jsx("section", {
role: "group",
"aria-label": deprecatedAriaLabel || ariaLabel,
...rest,
className,
children
});
};
TableToolbar.propTypes = {
["aria-label"]: PropTypes.string,
ariaLabel: deprecate(PropTypes.string, "This prop syntax has been deprecated. Please use the new `aria-label`."),
children: PropTypes.node,
size: PropTypes.oneOf(["sm", "lg"])
};
//#endregion
export { TableToolbar as default };