🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

react-dropdown-button

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-dropdown-button

A carefully crafted drop-down button for React

1.0.2
Source
npm
Version published
Weekly downloads
22
29.41%
Maintainers
1
Weekly downloads
 
Created
Source

react-dropdown-button

A carefully crafted drop-down button for React

Install

$ npm install react-dropdown-button --save

Description

The drop-down button uses two other React components:

  • react-button
  • react-menus

Changelog

See Changelog

Usage


var DDButton = require('react-dropdown-button')

var saveItems = [
	{
		label: 'PDF'
	},
	'-', // a separator
	{
		label: '.DOCX'
	},
	{
		label: 'ODF',
		onClick: function(){
			console.log('save as ODF')
		}
	}
]

function onClick(event, itemProps){
	console.log('You clicked: ' + itemProps.data.label +
	 ' at index ' + itemProps.index)
}

<DDButton items={saveItems} onChildClick={onClick}>
	Save as
</DDButton>

Also see zippyui/react-button

Props

You have the same props as for the react-button, so see docs. Besides the button specific props, you can specify the items prop as an array of objects to be passed to the menu component.

  • items: Array - an array of menu items for the menu of this drop-down button
  • menuProps: Object - props to be passed to the menu component
  • menu: ReactElement - instead of menuProps, you can directly pass in a menu instance

Contributing

$ npm install
$ npm run dev # to start webpack-dev-server
$ npm run serve # to start http-server on port 9091

now navigate to localhost:9091

License

MIT

Keywords

button

FAQs

Package last updated on 31 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