Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

makeup-listbox-button

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

makeup-listbox-button

A JavaScript class representing an ARIA listbox button

  • 0.5.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

makeup-listbox-button

A JavaScript class that represents an ARIA listbox button. No CSS provided.

View Demo.

HTML

The following markup structure and classnames are required. Any SVG icons can be used.

<span class="listbox-button">
  <button class="expand-btn" style="min-width: 150px" aria-expanded="false" aria-haspopup="listbox">
    <span class="expand-btn__cell">
      <span class="expand-btn__text">Option 1</span>
      <svg class="icon icon--dropdown" focusable="false" height="8" width="8" aria-hidden="true">
        <use href="icon.svg#icon-dropdown"></use>
      </svg>
    </span>
  </button>
  <div class="listbox-button__listbox">
    <div class="listbox-button__options" role="listbox" tabindex="0">
      <div class="listbox-button__option" role="option">
        <span class="listbox-button__value">Option 1</span>
        <svg class="icon icon--tick-small" focusable="false" height="8" width="8">
          <use href="icon.svg#icon-tick-small"></use>
        </svg>
      </div>
      <div class="listbox-button__option" role="option">
        <span class="listbox-button__value">Option 2</span>
        <svg class="icon icon--tick-small" focusable="false" height="8" width="8">
          <use href="icon.svg#icon-tick-small"></use>
        </svg>
      </div>
      <div class="listbox-button__option" role="option">
        <span class="listbox-button__value">Option 3</span>
        <svg class="icon icon--tick-small" focusable="false" height="8" width="8">
          <use href="icon.svg#icon-tick-small"></use>
        </svg>
      </div>
    </div>
  </div>
</span>

CSS

No CSS is provided. However, the class is fully compatible with eBay Skin.

JavaScript

import ListboxButton from "makeup-listbox-button";

document.querySelectorAll(".listbox-button").forEach(function (el, i) {
  const widget = new ListboxButton(el, config);

  el.addEventListener("makeup-listbox-button-change", function (e) {
    console.log(e.type, e.detail);
  });
});

Config

The constructor takes a configuration object as its second parameter.

todo

Events

makeup-listbox-button-change

Fired when the listbox selection is changed.

  • fromValue: the old value
  • toValue: the new value

FAQs

Package last updated on 20 Dec 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc