Package Exports
- react-dropdown-button
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-dropdown-button) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-dropdown-button
A carefully crafted drop-down button for React
Install
$ npm install react-dropdown-button --saveDescription
The drop-down button uses two other React components:
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 9091now navigate to localhost:9091