{"library":"rc-menu","title":"rc-menu: Core React Menu Component","description":"rc-menu is a foundational, unstyled React UI component designed for building highly customizable and accessible hierarchical menus. It provides the core logic and composable primitives like `Menu`, `SubMenu`, and `MenuItem`, offering developers extensive control over styling and behavior. While widely adopted, the `rc-menu` package, currently at version `9.16.1`, is in a maintenance-only state with its last publish over a year ago. Active development and new features have migrated to the `@rc-component/menu` package (latest v1.2.0), which is the recommended choice for new projects and for existing users looking for ongoing support and enhancements. This component is often used as a base for more opinionated UI libraries, such as Ant Design's menu, due to its low-level control.","language":"javascript","status":"renamed","last_verified":"Sun Apr 19","install":{"commands":["npm install rc-menu"],"cli":null},"imports":["import Menu from 'rc-menu';","import { SubMenu } from 'rc-menu';","import { MenuItem } from 'rc-menu';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport Menu, { SubMenu, MenuItem } from 'rc-menu';\nimport 'rc-menu/assets/index.css'; // Don't forget to import basic styles if needed\n\nconst App = () => (\n  <div>\n    <h2>Basic rc-menu Example</h2>\n    <Menu style={{ width: 200, border: '1px solid #ddd' }}>\n      <MenuItem key=\"1\">Option 1</MenuItem>\n      <SubMenu key=\"sub1\" title=\"Submenu\">\n        <MenuItem key=\"2-1\">Sub-option 2-1</MenuItem>\n        <MenuItem key=\"2-2\">Sub-option 2-2</MenuItem>\n      </SubMenu>\n      <MenuItem key=\"3\" disabled>Disabled Option 3</MenuItem>\n    </Menu>\n  </div>\n);\n\nconst container = document.getElementById('root');\nif (container) {\n  const root = ReactDOM.createRoot(container);\n  root.render(<App />);\n} else {\n  console.error(\"Root element not found. Please ensure a div with id 'root' exists in your HTML.\");\n}","lang":"typescript","description":"This example demonstrates a basic `rc-menu` setup with a root menu, a submenu, and individual menu items, including a disabled item, rendered into a DOM element. It also includes the necessary CSS import for basic functionality.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}