Socket
Socket
Sign inDemoInstall

rc-menu

Package Overview
Dependencies
Maintainers
2
Versions
279
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-menu

menu ui component for react


Version published
Weekly downloads
1.4M
increased by0.64%
Maintainers
2
Weekly downloads
 
Install size
Created

Package description

What is rc-menu?

The rc-menu package is a React component for building menus. It provides a flexible and accessible way to create dropdown, context, and other types of menus in your web application. It supports features like keyboard navigation, animation, and customization through themes.

What are rc-menu's main functionalities?

Basic Menu

This code sample demonstrates how to create a basic menu with three options. When an option is selected, it logs the key of the selected item.

import Menu, { Item as MenuItem } from 'rc-menu';

<Menu onSelect={({ key }) => console.log(key)}>
  <MenuItem key="1">Option 1</MenuItem>
  <MenuItem key="2">Option 2</MenuItem>
  <MenuItem key="3">Option 3</MenuItem>
</Menu>

Sub Menu

This example shows how to create a menu with a sub-menu. The sub-menu contains two options, demonstrating how to nest menus within each other.

import Menu, { SubMenu, Item as MenuItem } from 'rc-menu';

<Menu>
  <SubMenu title="Sub Menu">
    <MenuItem key="sub1">Option 1</MenuItem>
    <MenuItem key="sub2">Option 2</MenuItem>
  </SubMenu>
</Menu>

Vertical Menu

This snippet illustrates how to create a vertical menu by setting the mode prop to 'vertical'. It's useful for sidebar navigation.

import Menu, { Item as MenuItem } from 'rc-menu';

<Menu mode="vertical">
  <MenuItem key="1">Option 1</MenuItem>
  <MenuItem key="2">Option 2</MenuItem>
  <MenuItem key="3">Option 3</MenuItem>
</Menu>
0

Changelog

Source

3.1.0 / 2015-03-26

improved #5 support selected and disabled for menuitem simultaneously

Readme

Source

rc-menu


react menu component. port from https://github.com/kissyteam/menu

NPM version build status Test coverage gemnasium deps node version npm download Sauce Test Status

Sauce Test Status

Screenshot

alt

Usage

var Menu = require('rc-menu');
var SubMenu = Menu.SubMenu;
var MenuItem = Menu.Item;
React.render(<Menu><MenuItem>1</MenuItem><SubMenu title="2"><MenuItem>2-1</MenuItem></SubMenu></Menu>, container);

install

rc-menu

API

menu props

nametypedefaultdescription
classNameStringadditional css class of root dom node
activeKeyObjectfirst active item's keysame with active tabPanel's key
activeFirstBooleanfalsewhether active first menu item when show if activeKey is not set
multipleBooleanfalsewhether allow multiple select
selectedKeysString[][]selected keys of items
onSelectfunction(key:String,child:ReactComponent)called when select a menu item
onDeselectfunction(key:String,child:ReactComponent)called when deselect a menu item
onSelectFunction(key:String)function called with selected menu item's key as param

menu item props

nametypedefaultdescription
classNameStringadditional css class of root dom node
disabledBooleanfalseno effect for click or keydown for this item
keyObjectcorresponding to activeKey

sub menu props

nametypedefaultdescription
classNameStringadditional css class of root dom node
titleString/ReactElementsub menu's content
keyObjectcorresponding to activeKey
disabledBooleanfalseno effect for click or keydown for this item
openOnHoverBooleantruewhether show second sub menu on hover

Development

npm install
npm start

Example

http://localhost:8001/examples/index.md

online example: http://react-component.github.io/menu/build/examples/

Test Case

http://localhost:8000/tests/runner.html?coverage

Coverage

http://localhost:8000/node_modules/rc-server/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:8000/tests/runner.html?coverage

License

rc-menu is released under the MIT license.

Keywords

FAQs

Package last updated on 26 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc