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

@revolist/revo-dropdown

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@revolist/revo-dropdown

Minimalistic dropdown with keyboard support and search

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

revo-dropdown

Minimalistic dropdown webcomponent. After long search we couldn't find any cross platform and had to build our own inspired by the latest trends.

Autocomplete

Regular select

Autocomplete dropdownRegular dropdown

Getting Started

To start building a new web component using Stencil, clone this repo to a new directory:

npm i @revolist/revo-dropdown

Module import


import * as loader from '@revolist/revo-dropdown/loader';
if (loader.defineCustomElements) {
  loader.defineCustomElements();
}

Script tag

  • Put a script tag similar to this <script src='https://unpkg.com/revo-dropdown@latest/dist/revo-dropdown.js'></script> in the head of your index.html

Usage

Then you can use the element anywhere in your template, JSX, html etc

<revo-dropdown data-label="name" autocomplete="true" placeholder="Philosophers" max-height="300"></revo-dropdown>
<script type="module">
  const people = [
  {
    eyeColor: 'green',
    name: 'Samantha Molina',
  },
  {
    eyeColor: 'green',
    name: 'Weber Henderson',
  }];
  const dropdowns = document.querySelectorAll('revo-dropdown');
  for (var q = 0; q < dropdowns.length; q++) {
    dropdowns[q].source = people;
  } 
</script>

Need help? Check out docs here.

API

Properties

PropertyAttributeDescriptionTypeDefault
appendToappend-toWhere to append element"body" | "current"'body'
autoCloseauto-closeShould dropdown autoclose on changeValuebooleantrue
autoFocusauto-focusbooleanfalse
autocompleteautocompletebooleanfalse
currentFiltercurrent-filterFilter valueanyundefined
dataIddata-idDefine object mapping for id/valuestringundefined
dataLabeldata-labelDefine object mapping for labelsstringundefined
filterfilterFilter criteria"contains" | "start"undefined
hasFilterhas-filterbooleantrue
maxHeightmax-heightnumberundefined
placeholderplaceholderPlaceholder textstring'Select'
source--Define object mapping for id/valueany[][]
valuevalueSelected valueanyundefined

Events

EventDescriptionType
changedWhen value changedCustomEvent<{ val: any; originalEvent?: MouseEvent; }>
closeBefore element close, can be preventedCustomEvent<any>
openBefore element open, can be preventedCustomEvent<any>

Methods

doChange(val: any, originalEvent?: MouseEvent) => Promise<void>

Change value

Returns

Type: Promise<void>

doClose(isDisconnected?: boolean) => Promise<void>

Close dropdown

Returns

Type: Promise<void>

doOpen() => Promise<void>

Open dropdown

Returns

Type: Promise<void>


Built with StencilJS

Keywords

FAQs

Package last updated on 15 Jan 2021

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