ComponentsIconsGuidesExamplesGetting started
ComponentsIconsGuidesExamplesGetting started
GitHub repository

Virtual List

Windowed list with built-in search, sorting, selection and an async data source.

Attributes

NameTypeDefaultDescription
itemsunknown[][]The items to display. An array in the property, JSON in the attribute.
item-keystring—Field used as the identity of an item, for selection and typeahead. Falls back to the item index.
label-fieldstring—Field read for a row's primary text. Defaults to label, name, title or value, then the item itself.
description-fieldstring—Field read for a row's second, muted line.
disabled-fieldstring—Field whose truthy value makes a row unselectable.
searchablebooleanfalseShows the built-in search field above the list.
searchstring—The query the list is filtered by. Set by the built-in field, or from outside.
search-fieldsstring[][]Fields the query is matched against: an array in the property, ;-separated in the attribute.
min-search-lengthnumber1Queries shorter than this are ignored, so the list is not filtered on the first keystroke.
search-debouncenumber200Milliseconds the built-in field waits after the last keystroke before the query is applied.
search-placeholderstringSearchPlaceholder of the built-in search field.
highlightbooleanfalseWraps the matched part of a row's text in <mark part="highlight">.
sortSortEntry | undefined—The sort: SortEntry in the property, field:asc in the sort attribute.
selectionVirtualListSelectionModenonesingle selects one row at a time, multiple supports ⌘/ctrl-click and shift-click ranges.
valuestring[][]Keys of the selected items: an array in the property, ;-separated in the attribute.
virtualVirtualListVirtualModeautoauto windows past virtual-threshold items; always and never force it.
item-heightnumber36Item height in pixels used before the first row has been measured.
overscannumber6Rows rendered above and below the viewport while windowing.
virtual-thresholdnumber100Item count past which virtual="auto" starts windowing.
block-sizenumber100Number of items the list asks a dataSource for at a time.
loadingbooleanfalseShows the loading state; implied while a dataSource resolves its first block.
errorstring—Shows the error state with this message.
empty-messagestringNo itemsMessage shown when there are no items at all.
no-results-messagestringNo matchesMessage shown when a search is active and nothing matches.

Slots

NameDescription
searchReplaces the built-in search field. Set search yourself from its events.
toolbarExtra controls beside the search field, for a filter chip or a count. Hidden when empty.
footerBar below the list, for a total or a pager. Hidden when empty.
emptyReplaces the built-in "no items" message.
no-resultsReplaces the built-in "no matches" message shown while a search is active.
loadingReplaces the built-in spinner shown while the first items load.
errorReplaces the built-in message shown when error is set.

Events

NameTypeDescription
search-changeCustomEvent<VirtualListSearchChangeEventDetail>Fired after the query settles, with the number of items that match.
item-clickCustomEvent<VirtualListItemEventDetail>Fired when a row is clicked, before the selection is applied.
selection-changeCustomEvent<VirtualListSelectionChangeEventDetail>Fired after the user changes the selection. detail.value is the array of selected keys, detail.items the matching items. Does not bubble: several components fire selection-change, so a listener belongs on the element itself rather than on an ancestor.

CSS parts

Shadow DOM styling hooks used with ::part(name). Prefer CSS custom properties when they cover the change.

NameDescription
searchHeader row containing the built-in search field and the search and toolbar slots.
viewportScroll container that holds the listbox and its empty, loading or error state.
itemsInner listbox containing the rendered rows and virtual-scroll spacers.
itemEvery rendered c2-list-item, including loading placeholders.
item-selectedA rendered item while it is selected; exposed in addition to item.
skeletonPlaceholder shown inside an item while its remote data block is loading.
stateShared container for the empty, loading, or error slot and its fallback message.
highlightA <mark> around text that matches the active search query.
footerFooter row containing the footer slot.

CSS custom properties

Grouped by semantic target and state from --c2-component__target__state--property. Click a group to collapse it; click a name to copy it.

NameTypeDefaultDescription
c2-virtual-list
--c2-virtual-list--backgroundcolor#ffffff
--c2-virtual-list--colorcolor#18181b
--c2-virtual-list--font-sizefont-size14px
--c2-virtual-list--max-heightpixelnoneCaps the height when the host is not sized itself; the list scrolls.
--c2-virtual-list--border-topborder—
--c2-virtual-list--border-rightborder—
--c2-virtual-list--border-bottomborder—
--c2-virtual-list--border-leftborder—
--c2-virtual-list--border-top-left-radiusborder-radius8px
--c2-virtual-list--border-top-right-radiusborder-radius8px
--c2-virtual-list--border-bottom-left-radiusborder-radius8px
--c2-virtual-list--border-bottom-right-radiusborder-radius8px
--c2-virtual-list--box-shadowbox-shadow—
c2-virtual-list > search
--c2-virtual-list__search--backgroundcolortransparent
--c2-virtual-list__search--paddingpadding8px
--c2-virtual-list__search--gappixel8px
--c2-virtual-list__search--border-bottomborder1px solid #e4e4e7
c2-virtual-list > search-field
--c2-virtual-list__search-field--backgroundcolor#ffffffThemes the built-in c2-text-field.
--c2-virtual-list__search-field--borderborder1px solid #e4e4e7
--c2-virtual-list__search-field--border-radiusborder-radius6px
--c2-virtual-list__search-field--min-heightpixel32px
c2-virtual-list > viewport
--c2-virtual-list__viewport--paddingpixel4px
c2-virtual-list > item
--c2-virtual-list__item--heightpixel36pxRow height; windowing needs it uniform.
c2-virtual-list > highlight
--c2-virtual-list__highlight--backgroundcolor#fef08a
--c2-virtual-list__highlight--colorcolorinherit
--c2-virtual-list__highlight--font-weightfont-weight600
--c2-virtual-list__highlight--border-radiusborder-radius4px
c2-virtual-list > skeleton
--c2-virtual-list__skeleton--backgroundcolor#f4f4f5Placeholder shown in rows whose dataSource block is still loading.
--c2-virtual-list__skeleton--border-radiusborder-radius4px
c2-virtual-list > state
--c2-virtual-list__state--colorcolor#71717aColour of the empty, no-results and loading messages.
--c2-virtual-list__state--paddingpadding32px 12px
--c2-virtual-list__state--font-sizefont-size14px
c2-virtual-list > state > error
--c2-virtual-list__state__error--colorcolorrgb(211, 21, 16)
c2-virtual-list > footer
--c2-virtual-list__footer--backgroundcolortransparent
--c2-virtual-list__footer--paddingpadding8px 12px
--c2-virtual-list__footer--border-topborder1px solid #e4e4e7
escAccordionConnected, animated panels with shared borders and single or multiple expansion.LayoutArea chartA line chart with the region under each line filled — every line-chart attribute, plus a fill opacity.ChartAttachmentFile and image attachments with metadata, upload progress, failure states, and actions.Data displayAutocompleteSearchable combobox for local or remote items with customizable list rows.InputsAvatarImage, initials or icon for a person, with status dot and badge.Data displayBadgeTinted pill for status text, counts and dots, optionally pinned to a corner of another element.Data displayBar chartBars over categories or time buckets, with several series drawn side by side within each band.ChartBorder BeamA decorative beam that travels around the border of any positioned container.LayoutBreadcrumbNavigation trail of link buttons with separators, a current page and optional collapsing.NavigationButtonThemeable button with slots for text, prefix, suffix and running icons.ButtonsButton GroupJoined actions and polished segmented controls with single or multiple selection.ButtonsCandlestick chartAn ECharts OHLC chart for market sessions and other open-close ranges, with semantic positive and negative colours.ChartCardGroups related content and actions on a single bordered surface.LayoutCascaderSelect a value from related, multi-level data in one floating panel.InputsChat InputAuto-growing message composer with keyboard submission, toolbar actions and native form support.ChatChat MessageFlexible message row for conversations, assistant answers and activity updates.ChatCheckboxNative checkbox behaviour in a quiet, themeable box with an opt-in hover layer.InputsCode EditorEditable, syntax-highlighted source field on CodeMirror 6, themed entirely through CSS variables.InputsCode ViewerSyntax-highlighted code with line numbers, copy button and dark mode, powered by shiki.Data displayColor AreaTwo-dimensional area for picking saturation and value of a colour.InputsColor SelectColour swatch that opens a full picker built from area and slider.InputsColor SliderHorizontal slider for choosing a hue from 0 to 360.InputsCopy ButtonButton that copies text to the clipboard — the element it sits in, another element by id, or a literal string.ButtonsDashboardGrid of resizable panes, dragged by the edges they share.LayoutDate InputForm-associated single-date input with native picker, constraints, helper text and error states.InputsDate SelectorAccessible one- or two-month calendar for choosing a date range.InputsDetailsCollapsible disclosure built on native details and summary.LayoutGauge chartA focused radial KPI gauge drawn by ECharts, with a configurable scale, progress arc and pointer.ChartHeaderArranges brand, navigation, actions and a mobile trigger in a reusable site shell.LayoutIcon ButtonRound, hoverable button wrapping a slotted SVG icon.ButtonsKbdKeyboard key label for shortcuts and command hints, with the semantics of the native kbd element.Data displayLabelCaption that names and activates the control referenced by its for attribute, with a required marker.InputsLine chartA line chart over a time or numeric x axis, drawn on canvas by uPlot, with series declared as children.ChartLink ButtonText-styled control for link and navigation actions, rendered as a real anchor or a button.NavigationListVertical list container with single or multiple selection.Data displayList ItemSelectable row with icon slots, used on its own or as the option of list and select.Data displayMenuCommands, links, checkboxes and submenus in a popover anchored to a trigger.NavigationModalDialog built on the native dialog element: focus trap, backdrop, Escape, title, body and footer.FeedbackNavigation MenuSite navigation bar whose triggers open panels of links below the header.NavigationNumber InputForm-associated numeric input with native validation, step controls, adornments and helper states.InputsOverlayAnchored popup built on the browser Popover API, positioned with floating-ui.FeedbackPaginationPage navigation in three layouts: numbered pages, a simple page status, or a table-footer row with rows-per-page.NavigationPie chartA pie or donut chart drawn by ECharts, where one row is one slice and label-field names it.ChartProgressLinear progress bar, indeterminate or filling to a value, with an optional label and count.FeedbackQR CodeGenerate accessible, themeable QR codes locally as crisp SVG graphics.Data displayQuestionnaireA multi-step single- and multiple-choice flow with validation, shortcuts and form submission.InputsRadar chartCompare several profiles across the same set of normalized indicators.ChartRadioRadio options built on native inputs, grouped into one value with keyboard navigation.InputsRateAccessible star rating input with hover preview, keyboard control and optional half values.InputsReorder ListReorder a vertical queue with pointer or keyboard input while the application owns persistence.Data displayScatter chartAn ECharts scatter plot for finding relationships, clusters and outliers across two numeric measures.ChartSelectDropdown that pairs a themeable trigger with an anchored list of c2-list-item options.InputsSeperatorHorizontal or vertical rule with an optional label, for dividing content and toolbars.LayoutSheetDialog pinned to an edge of the screen, for content that complements the page rather than interrupting it.FeedbackSide NavResponsive navigation drawer beside the page: pushes the content on large screens, slides over it with a backdrop on small ones.NavigationSkeletonPlaceholder block standing in for content that has not arrived, in three shapes and three animations.FeedbackSliderRange input with a themeable track, thumb, step ticks and value bubble.InputsSparklineA chromeless trend line sized for a table cell, a list row or the trend slot of a c2-stat.ChartSpinnerCircular progress indicator, indeterminate or showing a value, with optional text.FeedbackStatDisplays a KPI with an optional icon, trend and supporting description.Data displayStatus PanelCommunicate empty states, operation outcomes and recoverable errors with clear next steps.FeedbackStepsA vertical trace of a task as it runs: statuses, durations, and stages that open while they work and close when they are done.Data displaySwitchOn/off toggle on a native switch input, with label, description and thumb icons.InputsTableVirtualized data grid with declarative columns, sorting, selection, pinning and resizing.Data displayTabsTab strip that shows one content panel at a time.NavigationText FieldSingle-line input with icon slots, clear button, helper and error text, and a character counter.InputsTextareaMultiline text input with resizing, helper and error text, and a character counter.InputsTheme SelectColour-theme switcher: click to step to the next mode, hover for the full menu.InputsToastNotification cards and a manager for stacked, queued notifications with independent lifetimes.FeedbackTooltipContextual hint shown when its target is hovered or focused, rendered in the top layer.FeedbackTreeHierarchical tree view with expansion, selection, checkboxes and lazy loading.Data displayUploadDrag-and-drop file selection with validation, upload progress, retry, cancellation, and attachment results.InputsVirtual ListWindowed list with built-in search, sorting, selection and an async data source.Data displayFeather Icons287 open-source Feather icons, one web component each.IconsMat Icon2,234 Material Icons ligatures rendered through a single element.IconsPhosphor Icons1,512 flexible icons in six weights, one web component each.IconsThemingTheme every c2n component from a handful of design tokens with @c2n/theme, or reach for any component variable directly.GuideFrameworksUse the components from React, Vue, Angular, Svelte, Lit or plain HTML — typed events, generated template types, and the one piece of configuration each framework needs.GuideUsing c2n in an applicationThe workflow behind every c2n app: load the theme once, use c2-* tags directly, and turn every repeated pattern into a small variant or composed component.GuideAI toolsGive Claude Code, Codex or Google Antigravity the c2n skill, live component APIs, examples and application conventions.Guide