Virtualization support for ComboBox, Dropdown, and MultiSelect
A long-requested feature set is virtualized lists.
Virtualization is a technique that renders only the items currently visible in the viewport, improving performance for large lists. A common use case is to support in-memory typeahead and filtering. Rendering and updating hundreds or thousands of items is expensive, leading to a laggy UI.
By default, ComboBox, Dropdown, and MultiSelect components will automatically virtualize lists with more than 100 items.
Set virtualize to true to explicitly enable it for lists with fewer than 100 items. Alternatively, configure a threshold for which virtualization should be enabled. Set virtualize to false to opt out altogether. Overscan and item heights can be customized.
See examples in the docs:
- https://svelte.carbondesignsystem.com/components/ComboBox#virtualized-items-large-lists
- https://svelte.carbondesignsystem.com/components/Dropdown#virtualized-items-large-lists
- https://svelte.carbondesignsystem.com/components/MultiSelect#virtualized-items-large-lists
In the example below, 10,000 items are provided to the combobox, but only 11 items (8 visible items + 3 overscan items) are rendered in the DOM.
combo-box-virtualization.mov
Improved generics support for DataTable, Dropdown, ComboBox, MultiSelect, and TreeView
The id property is now generic, inferred by the item type passed to the component. Previously, a dedicated type alias was used to type the id, and was not generic.
Implicit grouping for RadioButton
Previously, RadioButton required a parent RadioButtonGroup. However, in some scenarios, this is undesirable since RadioButtonGroup wraps its children with additional markup.
Now, multiple standalone RadioButton components sharing the same name attribute automatically form a group and synchronize their checked state.
Read the docs for more.
<script>
import { RadioButton, Stack } from "carbon-components-svelte";
const options = [
{ value: "option1", label: "Option 1" },
{ value: "option2", label: "Option 2" },
{ value: "option3", label: "Option 3" },
];
let checked = options.map(() => false);
$: selected = options.find((_, i) => checked[i]);
</script>
<Stack gap={3}>
<Stack orientation="horizontal">
{#each options as option, i}
<RadioButton
bind:checked={checked[i]}
value={option.value}
labelText={option.label}
name="implicit-group"
/>
{/each}
</Stack>
<span>
Selected:
<strong>{selected?.label ?? "None"}</strong>
</span>
</Stack>
Documentation for LLMs
- The documentation website now supports copying pages as Markdown, aiding agentic coding with LLMs.
- Or, append
.mdto a component page to view the Markdown: https://svelte.carbondesignsystem.com/components/Button.md llms.txtis also supported.llms-full.txtis forthcoming.
What's Changed
⚠ BREAKING CHANGES
- header: rename slot "skip-to-content" to "skipToContent" for Svelte 5 support (#2546) by @metonym
- data-table: rename slot "cell-header" to "cellHeader" for Svelte 5 support (#2546) by @metonym
Features
- combo-box: support virtualized items (350a54e) (#2270) by @metonym, closes #2395
- dropdown: support virtualized items (f15f853) (#2571) by @metonym, closes #2396
- local-storage: auto-sync updates across tabs (f966856) (#2556) by @metonym
- multi-select: support virtualized items (a9acb11) (#2572) by @metonym, closes #1623
- radio-button: support implicit grouping via
nameattribute (11b2684) (#2523) by @metonym and @brunnerh - tree-view: add
autoCollapse(226d301) (#2493) by @metonym, closes #2491 - tree-view: pass all tree view node props via slots (1084461)
Bug Fixes
- combo-box:
clearFilterOnOpenrestores value after typing (4e4b582) (#2580) by @metonym, closes #2579 - combo-box:
ComboBoxItemIdis generic, defaulting toany(31336b1) (#2564) by @metonym - combo-box: keyboard navigation starts at selected item index (73a90aa) (#2581) by @metonym
- data-table:
DataTableRowIdis generic, defaulting toany(aae89c0) (#2570) by @metonym - dropdown:
DropdownItemid generic, defaulting toany(72820f7) (#2568) by @metonym, closes #2564 - dropdown: keyboard navigation starts at selected item index (23549f6) (#2577) by @metonym, closes #2575
- multi-select:
MultiSelectItemIdis generic, defaulting toany(01549bb) (#2567) by @metonym - number-input: add styles for
type="text"(83ac138) (#2548) by @metonym - number-input: allow deleting all characters if
allowDecimalis true (5d36b14) (#2550) by @metonym - number-input: include correct styles for
allowDecimalinput (e32fb3e) (#2583) by @metonym - overflow-menu: item supports
targetandrelprops (61ef1ba) (#2562) by @metonym, closes #2559 - toolbar-search:
ToolbarSearchpreserves generic row ID types (87b2cfe) - tree-view:
TreeNodeIdis generic, defaulting tostring | number(3b5f8c1) (#2569) by @metonym - types: generic component props should extend default values (9d4b1f0) (#2566) by @metonym
Full Changelog: v0.98.8...v0.99.0