MultiSelect

Multi-select is a user interface pattern that allows users to select multiple items from a list or grid simultaneously.

countries.ts

export let countries = [
	{ value: 'us', label: 'United States'},
	{ value: 'fr', label: 'France'},
	{ value: 'gb', label: 'United Kingdom' },
	{ value: 'de', label: 'Germany' },
	{ value: 'jp', label: 'Japan' },
	{ value: 'au', label: 'Australia' },
	{ value: 'cn', label: 'China' },
	{ value: 'in', label: 'India' },
	{ value: 'mx', label: 'Mexico' },
]

+page.svelte

<script lang="ts">import { countries } from "$lib/countries";
import { MultiSelect } from "@grampro/svelte-block";
let selected = void 0;
</script>

<div>
	<Select items={countries} bind:value={selected} />
</div>

Sample

Nb: Style issue with svx may cause some abnormalities in the component preview style. Working to fix this.

Props

Property Type Description
placeholder String The placeholder text displayed when no item is selected.
items Array An array of items to populate the select dropdown.
selected Any Array The currently selected items.
lazy Boolean If set to true, the multi select component enables lazy loading of items.
truncate Boolean If set to false, the multi select component disables truncating selected items.
enableSelectAll Boolean If set to true, the multi select component enables select all option