Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@anypoint-web-components/anypoint-menu-button

anypoint-web-components2.7kApache-2.00.1.5TypeScript support: included

An icon button to trigger a dropdown menu

anypoint-web-components, dropdown-menu, icon-button

readme

Published on NPM

Build Status

anypoint-menu-button

A material design button that triggers a menu, also styled for Anypoint platform.

Anypoint web components are set of components that allows to build Anypoint enabled UI in open source projects.

Menu button renders a trigger icon button which, once activated, renders a drodown menu. The button is to be used as a context action list.

Usage

Installation

npm install --save @anypoint-web-components/anypoint-menu-button

In an html file

<html>
  <head>
    <script type="module">
      import '@anypoint-web-components/anypoint-menu-button/anypoint-menu-button.js';
      import '@anypoint-web-components/anypoint-button/anypoint-icon-button.js';
      import '@anypoint-web-components/anypoint-listbox/anypoint-listbox.js';
      import '@anypoint-web-components/anypoint-item/anypoint-item.js';
      import '@polymer/iron-icons/iron-icons.js';
      import '@polymer/iron-icon/iron-icon.js';
    </script>
  </head>
  <body>
    <anypoint-menu-button>
      <anypoint-icon-button
        slot="dropdown-trigger"
        aria-label="activate for context menu">
        <iron-icon icon="menu" alt="menu"></iron-icon>
      </anypoint-icon-button>
      <anypoint-listbox slot="dropdown-content">
        <anypoint-item>alpha</anypoint-item>
        <anypoint-item>beta</anypoint-item>
        <anypoint-item>gamma</anypoint-item>
        <anypoint-item>delta</anypoint-item>
        <anypoint-item>epsilon</anypoint-item>
      </anypoint-listbox>
    </anypoint-menu-button>

    <script>
    {
      document.querySelector('anypoint-menu-button').onselect = () => {
        // an item is selected.
        // This is the same event dispatched by the `anypoint-listbox`
      };
    }
    </script>
  </body>
</html>

In a LitElement

import { LitElement, html } from 'lit-element';
import '@anypoint-web-components/anypoint-menu-button/anypoint-menu-button.js';
import '@anypoint-web-components/anypoint-button/anypoint-icon-button.js';
import '@anypoint-web-components/anypoint-listbox/anypoint-listbox.js';
import '@anypoint-web-components/anypoint-item/anypoint-item.js';
import '@polymer/iron-icons/iron-icons.js';
import '@polymer/iron-icon/iron-icon.js';

class SampleElement extends LitElement {
  render() {
    return html`
    <anypoint-menu-button
      slot="content"
      ?compatibility="${compatibility}"
      ?disabled="${disabled}"
      ?ignoreSelect="${ignoreSelect}"
      ?noOverlap="${noOverlap}"
      ?closeOnActivate="${closeOnActivate}"
    >
      <anypoint-icon-button
        slot="dropdown-trigger"
        aria-label="activate for context menu"
        ?compatibility="${compatibility}">
        <iron-icon icon="menu" alt="menu"></iron-icon>
      </anypoint-icon-button>
      <anypoint-listbox
        slot="dropdown-content"
        ?compatibility="${compatibility}">
        <anypoint-item>alpha</anypoint-item>
        <anypoint-item>beta</anypoint-item>
        <anypoint-item>gamma</anypoint-item>
        <anypoint-item>delta</anypoint-item>
        <anypoint-item>epsilon</anypoint-item>
      </anypoint-listbox>
    </anypoint-menu-button>
    `;
  }
}
customElements.define('sample-element', SampleElement);

Development

git clone https://github.com/anypoint-web-components/anypoint-menu-button
cd anypoint-menu-button
npm install

Running the demo locally

npm start

Running the tests

npm test

changelog

0.1.0 (2020-05-29)

Build

  • publishing stable version 4ca9bc5 by Pawel

Testing

  • updated Travis configuration to connect to Sauce Labs 3c7481a by Pawel

0.1.1 (2020-05-29)

Refactor

  • upgrading to open-wc standards 773173c by Pawel

0.1.2 (2020-11-26)

Update

  • upgrading types 340552c by Pawel Psztyc
  • upgrading test runner 4e7ee7d by Pawel Psztyc
  • [ci skip] automated merge master->stage. syncing main branches 8021588 by Ci agent

Refactor

  • upgrading to open-wc standards 773173c by Pawel

0.1.3 (2020-11-26)

Update

  • [ci skip] automated merge master->stage. syncing main branches 6a6ee0b by Ci agent
  • upgrading types 340552c by Pawel Psztyc
  • upgrading test runner 4e7ee7d by Pawel Psztyc
  • [ci skip] automated merge master->stage. syncing main branches 8021588 by Ci agent

Refactor

  • fixing shadow CSS var name 058c745 by Pawel Psztyc

0.1.4 (2020-11-26)

Update

  • [ci skip] automated merge master->stage. syncing main branches 3b03205 by Ci agent
  • [ci skip] automated merge master->stage. syncing main branches 6a6ee0b by Ci agent

Features

  • adding border-radius CSS variable db36773 by Pawel Psztyc

Refactor

  • fixing shadow CSS var name 058c745 by Pawel Psztyc

0.1.5 (2021-03-30)

Update

  • update dependencies 39215b8 by Pawel Psztyc
  • [ci skip] automated merge master->stage. syncing main branches b9961e8 by Ci agent
  • [ci skip] automated merge master->stage. syncing main branches 3b03205 by Ci agent

Features

  • adding border-radius CSS variable db36773 by Pawel Psztyc