0.0.1 • Published 4 years ago

@revolist/dropdown v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Built With Stencil

Description

This is minimalistic dropdown webcomponent built with StencilJs.

Stencil

Stencil is a compiler for building fast web apps using Web Components.

Getting Started

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

git clone https://github.com/revolist/revodropdown.git revo-dropdown
cd revo-dropdown
git remote rm origin

and run:

npm install
npm start

To build the component for production, run:

npm run build

To run the unit tests for the components, run:

npm test

Need help? Check out our docs here.

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
  • Then you can use the element anywhere in your template, JSX, html etc

revo-dropdown

Properties

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

Events

EventDescriptionType
changeValueWhen 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() => Promise<void>

Close dropdown

Returns

Type: Promise<void>

doOpen() => Promise<void>

Open dropdown

Returns

Type: Promise<void>

Dependencies

Depends on

Graph

graph TD;
  revo-dropdown --> revo-list
  style revo-dropdown fill:#f9f,stroke:#333,stroke-width:4px

Built with StencilJS

0.0.1

4 years ago