@carbon/react
Version:
React components for the Carbon Design System
50 lines (48 loc) • 1.71 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.
*/
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_usePrefix = require("../../internal/usePrefix.js");
const require_ListBoxMenuItem = require("./ListBoxMenuItem.js");
let react = require("react");
react = require_runtime.__toESM(react);
let prop_types = require("prop-types");
prop_types = require_runtime.__toESM(prop_types);
let react_jsx_runtime = require("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 = (0, react.forwardRef)(({ children, id, ...rest }, ref) => {
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
ref,
id,
className: `${require_usePrefix.usePrefix()}--list-box__menu`,
role: "listbox",
...rest,
children
});
});
ListBoxMenu.displayName = "ListBoxMenu";
ListBoxMenu.propTypes = {
children: prop_types.default.oneOfType([
prop_types.default.node,
prop_types.default.arrayOf(prop_types.default.oneOf([require_ListBoxMenuItem.default])),
prop_types.default.shape({ type: prop_types.default.oneOf([require_ListBoxMenuItem.default]) }),
prop_types.default.bool
]),
id: prop_types.default.string.isRequired
};
//#endregion
exports.default = ListBoxMenu;