Listboxes
Interactive listboxes that maintain selection state.
import { ListBox, ListBoxItem } from '@skeletonlabs/skeleton';
Demo
By default the listbox uses a native radio inputs to ensure only one item is selcted at a time.
Multiple Selection
By adding the multiple
property, the component uses native checkboxes inputs, which allows for multi-select.
Lead and Trail Slots
Each Listbox item supports a lead
and trail
slot, which can be useful for icons or actions.
<ListBoxItem bind:group={valueSingle} name="books" value="books">
<svelte:fragment slot="lead">(icon)</svelte:fragment>
(label)
<svelte:fragment slot="trail">(icon)</svelte:fragment>
</ListBoxItem>
Native Alternatives
Consider using the native Select element with either the size
or multiple
attributes set to support single
or multiple selection respectively. However, please be aware that Safari (macOS) does not support all styles.