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.
- Namespace
- Tesserae
- Implements
- IComponent, ISpecialCaseStyling
Constructors
| Name | Description |
|---|---|
| DetailsList | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| StylingContainer | Gets or sets the styling container. |
| PropagateToStackItemParent | Gets or sets the propagate to stack item parent. |
| IsCompact | Gets or sets a value indicating whether the component is rendered in compact form. |
public HTMLElement StylingContainerGets or sets the styling container.
public bool PropagateToStackItemParentGets or sets the propagate to stack item parent.
Methods
| Name | Description |
|---|---|
| Compact | Renders the component in a compact form. |
| WithEmptyMessage | Returns the component configured with the given empty message. |
| WithPaginatedItems | Returns the component configured with the given paginated items. |
| WithListItems | Returns the component configured with the given list items. |
| SortedBy | Configures the sorted by on the component. |
| Render | Renders the component's root HTML element. |
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 T is rendered inside a DetailsList{T}.
- Namespace
- Tesserae
- Implements
- IDetailsListColumn
Constructors
| Name | Description |
|---|---|
| DetailsListColumn | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| SortingKey | Gets or sets the sorting key. |
| Title | Gets or sets the title of the component. |
| Width | Gets or sets the CSS width of the component. |
| MaxWidth | Gets or sets the CSS max-width of the component. |
| IsRowHeader | Returns a value indicating whether the component is row header. |
| EnableColumnSorting | Enables the column sorting on the component. |
| EnableOnColumnClickEvent | Enables the on column click event on 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 IsRowHeader { get; }Returns a value indicating whether the component is row header.
public bool EnableColumnSorting { get; }Enables the column sorting on the component.
Methods
| Name | Description |
|---|---|
| OnColumnClick | Registers a callback invoked when the column click event fires. |
| Render | Renders the component's root HTML element. |
public void OnColumnClick()Registers a callback invoked when the column click event fires.
public class DetailsListIconColumn : IDetailsListColumnA specialized DetailsList{T} column that renders a single icon per row.
- Namespace
- Tesserae
- Implements
- IDetailsListColumn
Constructors
| Name | Description |
|---|---|
| DetailsListIconColumn | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| SortingKey | Gets or sets the sorting key. |
| Icon | Gets or sets the icon shown by the component. |
| Width | Gets or sets the CSS width of the component. |
| MaxWidth | Gets or sets the CSS max-width of the component. |
| IsRowHeader | Returns a value indicating whether the component is row header. |
| EnableColumnSorting | Enables the column sorting on the component. |
| EnableOnColumnClickEvent | Enables the on column click event on the component. |
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.
Methods
| Name | Description |
|---|---|
| OnColumnClick | Registers a callback invoked when the column click event fires. |
| Render | Renders the component's root HTML element. |
public void OnColumnClick()Registers a callback invoked when the column click event fires.
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.