Now on v2.0.0. New: tree mode, add-new creation, an imperative open/search/scroll-to API, container-responsive badge collapse and base-icon theming. Upgrading from v1? The event-handler properties (onSelect/onChange) now receive a CustomEvent — see the migration notes.

Installation

Add the package to your project

Package Manager
npm
 
pnpm
 
yarn
 
CDN
CDN Usage
 
Build Tools

Choose Your Method

Install via npm/pnpm/yarn for build tool integration, or use the CDN for quick prototyping and simple projects.

Zero Configuration

The component registers itself automatically when imported. No additional setup required.

Link the Stylesheet in <head>

The component's styles ship inside the JS (shadow DOM), so they can't apply until the script defines <web-multiselect>. Until then the element collapses, and the page jumps when it loads. style.css reserves the input height in the meantime, but only if it's linked in <head>. Importing it from JS only works when your bundler extracts it into a <link> (e.g. a production build). In dev mode it arrives too late.

To shorten that window, preload the module so it downloads in parallel with the HTML: <link rel="modulepreload" href=".../dist/multiselect.js">.

Basic Usage

Your first multiselect component

HTML
HTML Structure
 
JavaScript
JavaScript API
 
Explanation

Member Properties

Use value-member and display-value-member to map object properties to the component.

Reactive API

Use getValue() and setSelected() to interact with the component programmatically.

Framework Integration

Svelte
 
React
 
Vue
 
Angular
 

Next Steps

📚 View Examples

Explore comprehensive examples showcasing all features and use cases.

View Examples →

🔧 API Reference

Learn about all available properties, methods, events and callbacks.

API Docs →

🎨 Styling Guide

Customize the appearance with CSS variables, --ms-rem scaling and the base-icon contract.

Theming →