Tesserae

SearchableList

Description

The SearchableList component is a generic list container designed to display and filter a collection of items that implement the ISearchableItem interface. It provides an integrated search box that allows users to search through the items by typing in a term. The component is highly customizable, supporting features such as custom "no results" messages, background search operations, and the addition of custom components before or after the search box. Use this component when you need a searchable list interface in your application.

Usage

Instantiate a SearchableList using the static helper methods from Tesserae.UI. It accepts an array or an ObservableList of items (each implementing ISearchableItem) and optional column widths for layout purposes. The search box filters items based on whether their IsMatch method returns true for each entered search term.

Below is a minimal sample demonstrating how to implement the ISearchableItem interface and create a SearchableList with a custom "no results" message:

API reference

class

SearchableList<T>

public class SearchableList<T> : IComponent, ISpecialCaseStyling where T : ISearchableItem

A searchable, scrollable list whose items are filtered live as the user types into a built-in search box.

Constructors

Constructor
SearchableList
public SearchableList(T[] items, params UnitSize[] columns) : this(new ObservableList<T>(initialValues: items ?? new T[0]), columns)

Initializes a new instance of this class.

Constructor
SearchableList
public SearchableList(ObservableList<T> items, params UnitSize[] columns)

Initializes a new instance of this class.

Properties

Property
SearchableList.StylingContainer
public HTMLElement StylingContainer

Gets or sets the styling container.

Property
SearchableList.PropagateToStackItemParent
public bool PropagateToStackItemParent

Gets or sets the propagate to stack item parent.

Property
SearchableList.Items
public ObservableList<T> Items { get; }

Adds the given items to the component.

Property
SearchableList.ShowNotMatchingItems
public bool ShowNotMatchingItems { get; set; }

Shows the not matching items.

Methods

Method
SearchableList.WithNoResultsMessage
public SearchableList<T> WithNoResultsMessage(Func<IComponent> emptyListMessageGenerator)

Returns the component configured with the given no results message.

Method
SearchableList.SearchBox
public SearchableList<T> SearchBox(Action<SearchBox> sb)

Configures the inline search box using the supplied callback.

Method
SearchableList.CaptureSearchBox
public SearchableList<T> CaptureSearchBox(out SearchBox sb)

Captures the inline search box into the supplied variable for later reference.

Method
SearchableList.SetKeyboardShortcut
public SearchableList<T> SetKeyboardShortcut(params string[] keys)

Sets the keyboard shortcut of the component.

Method
SearchableList.WithBackgroundSearch
public SearchableList<T> WithBackgroundSearch(Func<string, Task<T[]>> searcher)

Returns the component configured with the given background search.

Method
SearchableList.HideSearchBoxIfLessThan
public SearchableList<T> HideSearchBoxIfLessThan(int items)

Hides the search box if less than.

Method
SearchableList.ShowNotMatching
public SearchableList<T> ShowNotMatching()

Shows the not matching.

Method
SearchableList.BeforeSearchBox
public SearchableList<T> BeforeSearchBox(params IComponent[] beforeComponents)

Adds the given components before the inline search box.

Method
SearchableList.AfterSearchBox
public SearchableList<T> AfterSearchBox(params IComponent[] afterComponents)

Adds the given components after the inline search box.

Method
SearchableList.Virtualize
public SearchableList<T> Virtualize(UnitSize itemHeight)

Configures the component to virtualize.

Method
SearchableList.Render
public dom.HTMLElement Render()

Renders the component's root HTML element.

Method
SearchableList.WithPagination
public SearchableList<T> WithPagination(int pageSize)

Returns the component configured with the given pagination.

interface

ISearchableItem

public interface ISearchableItem

Samples

Live Filtering with 50 Items

This sample produces 50 contact-style rows. Typing in the search box (try 7, Eve, or manager) filters the list as you type — when nothing matches, the custom "No Results" component is shown.

WithBackgroundSearch lets you augment the local matches with results fetched asynchronously (for example from a backend). The delegate is invoked with the current search term after the user pauses typing, and its results are merged into the displayed list.

See also

© 2026 Tesserae. All rights reserved.