UNPKG

@carbon/react

Version:

React components for the Carbon Design System

44 lines (42 loc) 1.51 kB
/** * 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 OverflowMenu from "../OverflowMenu/index.js"; import classNames from "classnames"; import "react"; import PropTypes from "prop-types"; import { jsx } from "react/jsx-runtime"; import { Settings } from "@carbon/icons-react"; //#region src/components/DataTable/TableToolbarMenu.tsx /** * 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. */ const defaultIconDescription = "Settings"; const TableToolbarMenu = ({ className, renderIcon = Settings, iconDescription = defaultIconDescription, children, menuOptionsClass, ...rest }) => { const prefix = usePrefix(); return /* @__PURE__ */ jsx(OverflowMenu, { renderIcon, className: classNames(className, `${prefix}--toolbar-action ${prefix}--overflow-menu`), iconDescription, menuOptionsClass: classNames(menuOptionsClass, `${prefix}--toolbar-action__menu`), flipped: true, ...rest, children }); }; TableToolbarMenu.propTypes = { children: PropTypes.node.isRequired, className: PropTypes.string, iconDescription: PropTypes.string, menuOptionsClass: PropTypes.string, renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]) }; //#endregion export { TableToolbarMenu as default };