3.0.0-0 • Published 5 years ago

@resonate/menu-button v3.0.0-0

Weekly downloads
11
License
MIT
Repository
github
Last release
5 years ago

@resonate/menu-button

Render a menu button

Installation

npm i --save @resonate/menu-button

Usage

const MenuButton = require('@resonate/menu-button')

module.exports = (state, emit) => {
  const menuButton = state.cache(MenuButton, 'super-menu-button')

  const button = menuButton.render({ 
    id: 'super-button',
    orientation: 'left', // popup menu orientation (top, right, left, bottom)
    style: 'blank', (default, blank)
    iconName: 'dropdown', // button icon
    text: 'Click' // optional if icon name present,
    hover: false, // disabled activation on mousehover
    items: [
      { iconName: 'star', text: 'favorite', actionName: 'favorite' },
      { iconName: 'share', text: 'share', actionName: 'share' },
      { iconName: 'plus', text: 'add to playlist', actionName: 'add' }
    ],
    updateLastAction (actionName) {
      const eventName = actionName
      emit(eventName, { props })
    } 
  })

  return button
}

See also

License

MIT

Author(s)