UNPKG

@carbon/react

Version:

React components for the Carbon Design System

47 lines (45 loc) 1.37 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 ListBoxMenuItem from "./ListBoxMenuItem.js"; import { forwardRef } from "react"; import PropTypes from "prop-types"; import { jsx } from "react/jsx-runtime"; //#region src/components/ListBox/ListBoxMenu.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. */ /** * `ListBoxMenu` is a simple container node that isolates the `list-box__menu` * class into a single component. It is also being used to validate given * `children` components. */ const ListBoxMenu = forwardRef(({ children, id, ...rest }, ref) => { return /* @__PURE__ */ jsx("ul", { ref, id, className: `${usePrefix()}--list-box__menu`, role: "listbox", ...rest, children }); }); ListBoxMenu.displayName = "ListBoxMenu"; ListBoxMenu.propTypes = { children: PropTypes.oneOfType([ PropTypes.node, PropTypes.arrayOf(PropTypes.oneOf([ListBoxMenuItem])), PropTypes.shape({ type: PropTypes.oneOf([ListBoxMenuItem]) }), PropTypes.bool ]), id: PropTypes.string.isRequired }; //#endregion export { ListBoxMenu as default };