@resonate/menu-button

3.0.0-0 • Public • Published

@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)

Readme

Keywords

none

Package Sidebar

Install

npm i @resonate/menu-button

Weekly Downloads

0

Version

3.0.0-0

License

MIT

Unpacked Size

20.1 kB

Total Files

8

Last publish

Collaborators

  • resonatecoop