### Clone Repository and Install Dependencies Source: https://github.com/janosh/svelte-multiselect/blob/main/contributing.md Clone the repository, navigate to the project directory, install npm dependencies, and start the development server. ```sh git clone https://github.com/janosh/svelte-multiselect cd svelte-multiselect npm install npm run dev ``` -------------------------------- ### Install svelte-multiselect Source: https://context7.com/janosh/svelte-multiselect/llms.txt Install the svelte-multiselect package using npm or pnpm. ```bash npm install svelte-multiselect # or pnpm add svelte-multiselect ``` -------------------------------- ### Example: Alert on Option Change in Svelte Source: https://github.com/janosh/svelte-multiselect/blob/main/readme.md This example demonstrates how to use the `onchange` event to display alerts for various selection actions like adding, removing, selecting all, or reordering options. ```svelte { if (type === 'add') alert(`You added ${option}`) if (type === 'remove') alert(`You removed ${option}`) if (type === 'removeAll') alert(`You removed ${options}`) if (type === 'selectAll') alert(`You selected all: ${options}`) if (type === 'reorder') alert(`New order: ${options}`) }} /> ``` -------------------------------- ### MultiSelect as a Tagging Component (Start Empty) Source: https://github.com/janosh/svelte-multiselect/blob/main/src/routes/(demos)/allow-user-options/+page.md Configure MultiSelect to start with no options, allowing users to populate it from scratch using `allowUserOptions="append"`. This effectively turns it into a tagging component. `noMatchingOptionsMsg` is set to empty and `createOptionMsg` to null for a cleaner tagging experience. ```svelte {#if selected?.length > 0}
selected = {JSON.stringify(selected)}
{/if} ``` -------------------------------- ### Install Svelte MultiSelect Source: https://github.com/janosh/svelte-multiselect/blob/main/readme.md Install the svelte-multiselect package as a dev dependency using npm. ```sh npm install --dev svelte-multiselect ``` -------------------------------- ### Basic Nav Component Usage Source: https://github.com/janosh/svelte-multiselect/blob/main/src/routes/(demos)/nav/+page.md Demonstrates the basic setup of the Nav component using an array of simple route strings. Auto-generated labels are used for each route. ```svelte