Svelte Select - Bitblue

A powerful select dropdown component built with Svelecte that supports single/multi-select, search, creation of new options, and more.

The Select component provides an enhanced dropdown selection interface with search, multi-select, and option creation. Built on Svelecte with TypeScript support.

For validated forms, use FormSelect inside a parent Form. FormSelect requires Form context.

Setup

<script>
	import { Select } from '.';
</script>

Usage

<script>
	import { Select } from '.';

	let selectedValue = $state('');
	const options = [
		{ value: 'apple', label: 'Apple' },
		{ value: 'banana', label: 'Banana' },
		{ value: 'cherry', label: 'Cherry' }
	];
</script>

<Select bind:value={selectedValue} {options} placeholder="Select a fruit" />

Multi-select

<script>
	import { Select } from '.';
</script>

<Select
	multiple
	options={[
		{ value: 'react', label: 'React' },
		{ value: 'svelte', label: 'Svelte' },
		{ value: 'vue', label: 'Vue' }
	]}
/>

Creatable

<script>
	import { Select } from '.';
</script>

<Select creatable placeholder="Add tags..." />

Disabled

<script>
	import { Select } from '.';

	const options = [
		{ value: 'apple', label: 'Apple' },
		{ value: 'banana', label: 'Banana' }
	];
</script>

<Select disabled {options} />

Object values

<script>
	import { Select } from '.';
</script>

<Select
	valueAsObject
	options={[
		{ id: 1, name: 'John', email: 'john@example.com' },
		{ id: 2, name: 'Jane', email: 'jane@example.com' }
	]}
	valueField="id"
	labelField="name"
/>

Events

Prefer onchange. onChange is deprecated.

<script>
	import { Select } from '.';

	const options = [
		{ value: 'us', label: 'United States' },
		{ value: 'ca', label: 'Canada' }
	];
</script>

<Select {options} onchange={(e) => console.log('Selected:', e)} />

Accessibility

  • Keyboard navigation, ARIA attributes, and focus management via Svelecte.
  • Set inputId and pair with a Label for attribute.
  • Use required / disabled for native semantics; surface validation with Form context helpers.

Props

PropTypeDefaultDescription
optionsArray | object—Selectable options
valueany | any[] | null—Bindable selection
placeholderstring—Empty-state text
namestring—Form field name
inputIdstring—Underlying input id
required / disabledbooleanfalseNative constraints
multiplebooleanfalseMulti-select
searchableboolean—Filter options
clearableboolean—Clear selection control
creatablebooleanfalseAllow creating options
valueAsObjectbooleanfalseReturn full option objects
labelAsValuebooleanfalseUse label when value missing
hasError / hasSuccessboolean—Visual validation state
minHeightnumber—Control min height
valueField / labelFieldstring | null—Option field mapping
groupLabelField / groupItemsFieldstring—Grouped options
disabledFieldstring—Per-option disabled key
rendererfn | string—Custom option render
disableHighlightboolean—Disable search highlight
highlightFirstItemboolean—Highlight first match
selectOnTabboolean | 'select-navigate'—Tab selection behavior
resetOnBlur / resetOnSelectboolean—Reset input text
closeAfterSelectboolean | string—Close dropdown after select
deselectModenative | toggle | none—Deselect behavior
maxnumber—Max selections (multi)
collapseSelectionblur | always | null—Collapse multi chips
keepSelectionInListboolean | auto—Keep selected in list
creatablePrefixstring—Prefix for created items
allowEditing / keepCreatedboolean—Creatable editing
delimiterstring—Multi-value delimiter
createFilter / createHandlerfunctions—Creatable hooks
fetch / fetchProps / fetchModeremote API—Async options
fetchCallback / fetchResetOnBlur / fetchDebounceTimefetch helpers—Remote fetch tuning
minQuerynumber—Min chars before fetch
lazyDropdown / virtualList / vlItemSizelist perf—Virtualization
i18nobject—Locale strings
readSelectionobject | object[] | null—External selection mirror
parentValuestring | number | null—Cascading parent value
emitValuesboolean—Emit raw values
loadingboolean—Loading indicator
onchangeFunction—Selection change
onChangeFunction—Deprecated; prefer onchange
onFocus / onBlurFunction—Focus events
onCreateOption / onCreateFailFunction—Creatable events
onEnterKeyFunction—Enter key
onFetch / onFetchErrorFunction—Remote fetch events
onInvalidValueFunction—Invalid value handler
prepend / appendSnippet—Control adornments
selection / clearIcon / toggleIconSnippet—Custom chrome
listHeader / optionSnippet—List customization
controlClass / dropdownClass / optionClassstring | null—Style hooks
classClassValue—Root classes
positionResolver / anchor_element / dndzone / strictModeadvanced—Positioning / DnD

FormSelect

FormSelect extends SelectProps with required name, optional label and contextKey. Must be a child of Form.


© 2026 Bitblue is a registered trademark. All Rights Reserved.