Select

Single select

Selected: 1

<script>
    import { Select } from 'svelte-spectre'

    let selected = 1,
        options = [ 1, 2, 3 ],
        multiple = false,
        validity = null,
        size = 'md'
</script>

<Select
    options={options}
    bind:value={selected}
    bind:selected={selected}
    bind:multiple={multiple}
    validity={validity}
    size={size} />

Multiple select

Selected: 1

<script>
    import { Select } from 'svelte-spectre'

    let selected = 1,
        options = [ 1, 2, 3 ],
        multiple = false,
        validity = null,
        size = 'md'
</script>

<Select
    options={options}
    bind:value={selected}
    bind:selected={selected}
    validity={validity}
    size={size}
    multiple />
© 2022 — 2023 BASF SE

API Select

options: Option[] = []
Select options array
type Option = Primitive | { value: Primitive; label?: string };
value: Value
Select value
type Value = Primitive[] | Primitive | undefined;
selected: Selected
Select selected option
type Selected = number[] | number | undefined;
inline: boolean = false
Select inline
true | false
multiple: boolean = false
Select multiple
true | false
placeholder: string
Select placeholder
size: Size
Select size
xs | md | lg
validity: Validity = null
Checkbox validity
null | success | error