DetailsList
Description
DetailsList is a robust component for displaying an information-rich collection of items. It extends the basic List capabilities by supporting features such as sorting, grouping, multiple selection, and pagination. This component is ideal for scenarios where a dense presentation of metadata is required, such as file explorers or order listings. It is part of the Collections group in Tesserae.
Usage
Instantiate a DetailsList using the static helper method from Tesserae.UI. You must provide one or more column definitions (using helpers like IconColumn and DetailsListColumn) and supply list items that implement the IDetailsListItem interface.
Below is a minimal example of how to create a DetailsList displaying file items:
API reference
public class DetailsList<TDetailsListItem> : IComponent, ISpecialCaseStyling where TDetailsListItem : class, IDetailsListItem<TDetailsListItem>A virtualised, sortable, multi-column table for displaying large lists of typed items, similar to Fluent UI's DetailsList.
Constructors
Properties
public HTMLElement StylingContainerGets or sets the styling container.
public bool PropagateToStackItemParentGets or sets the propagate to stack item parent.
Methods
public DetailsList<TDetailsListItem> Compact()Renders the component in a compact form.
public DetailsList<TDetailsListItem> WithEmptyMessage(Func<IComponent> emptyListMessageGenerator)Returns the component configured with the given empty message.
public DetailsList<TDetailsListItem> WithPaginatedItems(Func<Task<TDetailsListItem[]>> getNextItemPage)Returns the component configured with the given paginated items.
public DetailsList<TDetailsListItem> WithListItems(params TDetailsListItem[] listItems)Returns the component configured with the given list items.
public DetailsList<TDetailsListItem> SortedBy(string columnSortingKey)Configures the sorted by on the component.
public class DetailsListColumn : IDetailsListColumnA typed column definition used to declare how a property of is rendered inside a .
Constructors
Properties
public UnitSize Width { get; }Gets or sets the CSS width of the component.
public UnitSize MaxWidth { get; }Gets or sets the CSS max-width of the component.
public bool IsRowHeader { get; }Returns a value indicating whether the component is row header.
public bool EnableColumnSorting { get; }Enables the column sorting on the component.
public class DetailsListIconColumn : IDetailsListColumnA specialized column that renders a single icon per row.
Constructors
Properties
public string SortingKey { get; }Gets or sets the sorting key.
public Icon Icon { get; }Gets or sets the icon shown by the component.
public UnitSize Width { get; }Gets or sets the CSS width of the component.
public UnitSize MaxWidth { get; }Gets or sets the CSS max-width of the component.
public bool IsRowHeaderReturns a value indicating whether the component is row header.
public bool EnableColumnSorting { get; }Enables the column sorting on the component.
Samples
Sortable DetailsList with 50 Items
This sample populates the list with 50 generated rows so sorting and scrolling are meaningful. Click any column header to re-sort, or click a row to fire its OnListItemClick event (shown via a toast).
DetailsList with Live Pagination
Combine WithPaginatedItems with a real async producer. Each scroll to the bottom appends another 10 rows, simulating remote loading with Task.Delay. A Toast reports each batch so the loading behavior is visible.
DetailsList with Empty Message
Use WithEmptyMessage to render a placeholder when no items are available. The delegate is only invoked when the list is empty, so it can be as elaborate as needed.