Skip to content
IzzyBlazor 0.1.0-alpha.20

Enter all results ↑ ↓ move Esc close

ListView

Since 0.1.0-alpha.20
Items from data, each drawn by a template; links, selection, reordering and paging.

IzzyBlazor.ListView<TItem> in the IzzyBlazor.Core package, generated from the 0.1.0-alpha.20 assembly and its doc comments.

Properties (48)

ChildContentRenderFragment<TItem>?Added in 0.1.0-alpha.20

An item's content. Without it, ItemText, ItemDescription and ItemIcon draw a row.

ItemTextFunc<TItem, string?>? (computed)Added in 0.1.0-alpha.20

The default row's text. Defaults to the item's string form.

ItemDescriptionFunc<TItem, string?>?Added in 0.1.0-alpha.20

The default row's muted second line, such as an email address or a date.

ItemIconFunc<TItem, IconData?>?Added in 0.1.0-alpha.20

The default row's icon, at its start.

ItemLabelFunc<TItem, string>? (computed)Added in 0.1.0-alpha.20

Names an item for screen readers, in its link or button. Defaults to ItemText, then the ItemKey.

ItemHrefFunc<TItem, string?>?Added in 0.1.0-alpha.20

Makes each item a link, such as to its details page. The whole item is clickable; links, buttons and fields inside it still work on their own.

ItemCurrentFunc<TItem, bool>?Added in 0.1.0-alpha.20

The item for what the page is showing, such as the one whose details are beside the list: drawn as selected, and marked aria-current (on its link with ItemHref).

ItemActionsRenderFragment<TItem>?Added in 0.1.0-alpha.20

Content at the end of each item, after its text: icon buttons, a switch, a badge or a time. Its controls work on their own above the item's link. Name each for its item, such as "Star report.pdf"; keep it to one or two, and put the rest in ItemMenu. On a narrow item they go under its text, at the end.

With ItemActions or ItemMenu, Enter in another field of the form submits it with no button's name or value, rather than pressing the first item's button.

ItemMenuRenderFragment<TItem>?Added in 0.1.0-alpha.20

Each item's menu, of MenuItems, opened by a ⋯ button at the item's end, named "Actions for" and the item's label. Items that link or post work on static pages and with JavaScript off. When the fragment writes nothing for an item (an @if around its items), that item has no ⋯ button.

ItemDisabledFunc<TItem, bool>?Added in 0.1.0-alpha.20

Dims an item and leaves it without its link or button; its ItemActions and ItemMenu stay.

OrientationOrientation = Orientation.VerticalAdded in 0.1.0-alpha.20

Orientation.Vertical (the default) lists the items top to bottom; Orientation.Horizontal side by side, wrapping when space runs out.

Columnsint = 1Added in 0.1.0-alpha.20

Lays the items out as cards in this many columns (2 to 6) on screens 640px and wider, such as a gallery of products. Phones get one. Defaults to 1, a list.

MaxHeightLength?Added in 0.1.0-alpha.20

A height limit: the items scroll inside the list's box, with Load more after the last one. With DataPaging.LoadOnScroll, the next page loads as the last item scrolls into view.

Cardsbool = falseAdded in 0.1.0-alpha.20

Draws each item as a card, with space between them rather than lines, such as the tasks in a board's columns. Columns over 1 always draws cards.

Dividersbool = trueAdded in 0.1.0-alpha.20

A line between items in a list. Defaults to true.

Borderedbool = falseAdded in 0.1.0-alpha.20

A rounded border around the list. Defaults to false.

SizeControlSize = ControlSize.MdAdded in 0.1.0-alpha.20

Item spacing and text size. Defaults to ControlSize.Md.

AriaLabelstring?Added in 0.1.0-alpha.20

Names the list for screen readers, when the text around it doesn't.

Reorderablebool = falseAdded in 0.1.0-alpha.20

Lets the user reorder the items: each gets a handle to drag, which also opens a menu (Move up, Move down, Move to top, Move to bottom) for moving without dragging; with DragWholeItem and an ItemMenu, the moves go in each item's ⋯ menu instead, and the item drags from anywhere. Needs an ItemKey and every item shown: no paging and no ItemsProvider. On interactive pages bind the order with @bind-Items; on static pages give it a Name inside a form and pass the posted ListOrder back as Order.

Namestring?Added in 0.1.0-alpha.20

For a Reorderable list on a static page, the prefix of the fields it posts: {Name}.Keys and {Name}.Move, bound as a ListOrder. Without it, a static page shows no handles.

OrderListOrder?Added in 0.1.0-alpha.20

For a Reorderable list on a static page, what the form posted: the list shows the posted order with the move applied, and focuses the moved item's handle (or ⋯ button).

SubmitOnMovebool = falseAdded in 0.1.0-alpha.20Static only

For a Reorderable list on a static page with script, posts the form after each move, for pages that save every move. Otherwise moves stay in the page until the form is submitted. With JavaScript off, each move from an item's menu posts anyway.

DragWholeItembool = falseAdded in 0.1.0-alpha.20

For a Reorderable list, lets a drag start anywhere on an item, not only on its handle: with a mouse after a small move, on touch after a long press (so a swipe still scrolls the page). Links, buttons and fields in the item keep their presses; the item's own link (ItemHref) or button (OnItemClick) still works on a click. With an ItemMenu there are no handles: each item's ⋯ menu ends with a Move submenu (Move up, Move down, Move to top, Move to bottom); without one, the handle stays as the menu of moves.

Without JavaScript: Nothing drags; with an ItemMenu, the moves in each item's ⋯ menu post the form.

Zonestring?Added in 0.1.0-alpha.20

Makes the list a zone of the DropZoneGroup<T> around it: it shows the group's items whose zone is this one, and items move here from the group's other zones. Name each zone with AriaLabel, which also names it in the menu of moves.

AcceptsFunc<TItem, bool>?Added in 0.1.0-alpha.20

For a Zone, which items may move here from other zones, such as t => t.Reviewed.

MaxItemsint?Added in 0.1.0-alpha.20

For a Zone, how many items it holds at most; a full zone takes no more from the others.

@bind-ItemsIEnumerable<TItem>?Added in 0.1.0-alpha.20 @bind: Interactive only

The items. A list is paged in memory; an IQueryable (such as an EF Core query) is paged by the database.

ItemsProviderFunc<DataRequest<TItem>, ValueTask<DataResult<TItem>>>?Added in 0.1.0-alpha.20

Loads the items yourself, in place of Items: the request has the range (and in a Table the sort, the filter and the columns as fields), so request.ToResultAsync(query, ...) or request.Apply(query) does the work. An exception it throws shows "Couldn't load the rows." with Retry (and is logged); a request that was canceled is ignored.

@bind-PageSizeint?Added in 0.1.0-alpha.20 @bind: Interactive only

Items per page. Leave it out to show every item.

PageSizeOptionsIReadOnlyList<int>?Added in 0.1.0-alpha.20

Sizes to choose from in a "Rows per page" menu in the footer, such as new[] { 10, 25, 50 }. The URL carries the choice (?size=25); only these sizes are accepted from it. PageSize is the default (the first option when not set).

@bind-Pageint?Added in 0.1.0-alpha.20 @bind: Interactive only

The page, from 1. Binding it (@bind-Page) on an interactive page keeps it in the component instead of the URL. Set it back to 1 when your filters change.

PagingDataPaging = DataPaging.PagesAdded in 0.1.0-alpha.20

How it moves through its pages when it has a PageSize: numbered pages (DataPaging.Pages, the default, which needs a total), or by cursor, with no total needed: First, Previous and Next (DataPaging.NextPrevious), a "Load more" button after the items (DataPaging.LoadMore, ListView only), or loading as the last item comes into view (DataPaging.LoadOnScroll).

Without JavaScript: With JavaScript off, LoadOnScroll doesn't load as you scroll: its Load more button shows, which reloads the page with one more page.

LoadMoreTextstring? = "Load more"Added in 0.1.0-alpha.20

The "Load more" button's text, such as "Load earlier". Defaults to "Load more".

@bind-Cursorstring?Added in 0.1.0-alpha.20 @bind: Interactive only

The cursor of the page shown when paging by cursor (Paging); null for the first page. Binding it (@bind-Cursor) on an interactive page keeps it in the component instead of the URL; Page is then the page's position.

QueryPrefixstring = ""Added in 0.1.0-alpha.20

Prefix for its query-string keys, so several can share a page: QueryPrefix="orders-" uses ?orders-page= (and a Table's ?orders-sort=).

EmptyContentRenderFragment? (computed)Added in 0.1.0-alpha.20

Shown when there are no items. Defaults to EmptyText.

EmptyTextstring? = "No items"Added in 0.1.0-alpha.20

The text when there are no items. Defaults to "No items".

ErrorContentRenderFragment?Added in 0.1.0-alpha.20

Shown in place of "Couldn't load the rows." when loading fails, before the Retry button.

ItemKeyFunc<TItem, string>? (computed)Added in 0.1.0-alpha.20

A unique, stable key for each item, such as its id. Selection posts and binds these keys. Defaults to the item's string form.

Loadingbool = falseAdded in 0.1.0-alpha.20

Shows it as loading: items dim, or placeholders show while there are none. Set automatically while an ItemsProvider loads on interactive pages.

SelectionModeSelectionMode = SelectionMode.NoneAdded in 0.1.0-alpha.20

Whether items can be selected: one (a radio button on each) or several (a checkbox on each). Inside a form, the selected items post their ItemKey under SelectionName; bind Selection to follow them.

SelectionNamestring? (computed)Added in 0.1.0-alpha.20

The form field name the selection posts under, read back as a Selection with [SupplyParameterFromForm(Name = ...)]. Defaults to "{QueryPrefix}selected": give two selectable views in one form a QueryPrefix (or a name) each.

@bind-SelectionSelection?Added in 0.1.0-alpha.20 @bind: Interactive only

The selected items: keys on any page, or every item matching the filter except some. On a static page pass back the posted one. Selecting all that match is cleared when the filter or search changes.

ItemSelectableFunc<TItem, bool>?Added in 0.1.0-alpha.20

Whether an item can be selected; others show a disabled, unchecked box, and selecting the page or a range leaves them out. "Select all" (every matching item) can't know this rule: leave them out of the query you apply the Selection to.

SelectAllModeSelectAllMode = SelectAllMode.PageAdded in 0.1.0-alpha.20

What the select-all checkbox selects: the items on this page, or every item the filters match, on any page. Those aren't loaded, so act on them with Selection.Apply. With virtual rows, SelectAllMode.Page reaches only the rows drawn.

SelectionActionsRenderFragment<Selection>?Added in 0.1.0-alpha.20

Actions on the selection, in a bar above the items, disabled until something is selected (on a DataGrid with a toolbar, the bar takes the toolbar's place while something is). Submit buttons in the surrounding form post the selection. A link can't be disabled, so it stays live. Without these there's no bar.

SelectAllLabelstring? = "Select all rows"Added in 0.1.0-alpha.20

The select-all checkbox's name for screen readers. Defaults to "Select all rows".

SelectRowLabelstring? = "Select"Added in 0.1.0-alpha.20

The start of each item checkbox's name for screen readers, before the item's label. Defaults to "Select".

Events (2)

OnItemClickEventCallback<TItem>Added in 0.1.0-alpha.20Interactive only

Makes each item a button that runs this, on interactive pages. Items with an ItemHref are links instead.

OnMoveEventCallback<ListMoveEventArgs<TItem>>Added in 0.1.0-alpha.20Interactive only

Runs before a move changes the list, on interactive pages: save it here, or set Cancel to keep the item where it was. A dragged item stays where it was dropped while this runs, for up to 3 seconds; moves made meanwhile are ignored.

Methods (1)

ReloadAsyncAdded in 0.1.0-alpha.20
Task ReloadAsync()

Loads the items again, such as after an edit. With DataPaging.LoadMore it starts over from the page the list began at, dropping the pages added since.

Types (11)

ControlSize

enum

The height of interactive controls. Shared by buttons and form fields, so a button and an input of the same size line up in a row.

ControlSize values
ValueDescription
Sm

32px tall, small text.

Md

36px tall (the default).

Lg

44px tall, large text. For touch-first and marketing pages.

DataPaging

enum

How a Table<T> or ListView with a PageSize moves through its pages.

DataPaging values
ValueDescription
Pages

Numbered pages and "1–10 of 42". Needs the total (Total). The default.

NextPrevious

First, previous and next only, by cursor (Next): for data that has no total, or that pages by a token. Each page replaces the one shown.

LoadMore

A "Load more" button after the items that adds the next page to them, by cursor: for a ListView (a Table pages by number, by cursor or on scroll). On static pages and with JavaScript off it's a link to the same list with one more page (?page=3 shows the first three pages, asked of the provider as one request from the start); with script, focus goes to the first item it added.

LoadOnScroll

The next page loads when the last item scrolls into view and is added to the items: in place on interactive pages, and on static pages by following the Load more link, which enhanced navigation patches in with the scroll kept. The button is there only for the keyboard: out of sight until it has focus, with a spinner in its place while a page loads. With JavaScript off it shows, and grows the list by a page as for DataPaging.LoadMore. Best with a MaxHeight, so content under it stays within reach.

DataRequest

record

What a data component (a Table<T>) asks its ItemsProvider for: a range of rows, sorted and filtered, or the page after a cursor. Apply it to a query with ToResultAsync or Apply; the component's columns say how each key reads an item, so a provider never maps keys to properties itself. It travels: to JSON with System.Text.Json, and to a query string with ToQueryString, for a WebAssembly app that calls an API, where Apply applies it through the fields the server declares.

DataRequest members
MemberDescription
Sort IReadOnlyList<SortField>

The sort, first key first; empty for the source's own order.

Filter Filter?

The filter, or null for none.

Search string?

Free text to look for, in the searchable fields (text, by default); null for none.

Skip int = 0

Rows to skip: any offset, such as 1,036 for a virtual-scrolling grid.

Take int?

Rows to take; null for every row.

Cursor string?

When the component pages by cursor (DataPaging), the Next or Previous of an earlier page, as it was given; null for the first page. Skip is then the page's position (rows 401–600 at 200 a page).

NeedsTotal bool = true

Whether the component needs the total count. False when it pages by cursor, where the total is optional.

CancellationToken CancellationToken = CancellationToken.None

Canceled when the component no longer needs this answer (a newer request, or it went away).

Page int = 1

The page, from 1, for a source that thinks in pages: Skip / Take + 1.

Apply(IQueryable<TItem> source)

Filters, searches, sorts and takes the range of a query, with the component's fields. EF Core translates it.

Apply(IQueryable<TItem> source, IReadOnlyList<DataField<TItem>> fields)

Filters, searches, sorts and takes the range of a query, mapping keys through these fields only: on a server, for a request that came over the wire. A filter on a key that isn't one of them (or isn't filterable) matches nothing, and a sort by one is left out, so a request can't reach other properties.

ApplyFiltering(IQueryable<TItem> source)

Keeps what the filter and search match, with the component's fields: count this for the total.

ApplyFiltering(IQueryable<TItem> source, IReadOnlyList<DataField<TItem>> fields)

Keeps what the filter and search match, through these fields only.

ApplySorting(IQueryable<TItem> source)

Sorts a query, with the component's fields.

ApplySorting(IQueryable<TItem> source, IReadOnlyList<DataField<TItem>> fields)

Sorts a query by the sortable fields named in Sort, through these fields only.

ToODataQuery()

The request as OData query options, for a provider whose API is an OData endpoint: $filter=...&$orderby=customer,total desc&$skip=20&$top=10&$count=true&$search=.... Text that ignores case compares lower-cased (contains(tolower(customer),'ada')), as OData matches case; field paths use /. A cursor isn't part of OData: pass Cursor (or its $skiptoken) yourself. Values are written as the component's fields' types, so a Guid or a date that came back from JSON as text is written as one.

ToODataQuery(IReadOnlyList<DataField<TItem>> fields)

The request as OData query options, with values written as these fields' types.

ToQueryString()

The request as a query string, for a GET API: sort=customer,-total&skip=20&take=10&filter=...&search=...&cursor=..., with total=false when it doesn't need the total. The filter is in the form Parse reads (MatchCase isn't written). Read it back with Parse.

ToResult(IQueryable<TItem> source)

The count of what the filter keeps (when NeedsTotal) and this range's items, with the component's fields, from an in-memory list or a synchronous query.

ToResult(IQueryable<TItem> source, IReadOnlyList<DataField<TItem>> fields)

The count and items, through these fields only (see Apply).

ToResultAsync(IQueryable<TItem> source, Func<IQueryable<TItem>, CancellationToken, Task<int>> count, Func<IQueryable<TItem>, CancellationToken, Task<List<TItem>>> list)

The count of what the filter keeps (only when NeedsTotal) and this range's items, with the component's fields, through your async methods, so Core needs no EF Core: count: (q, ct) => q.CountAsync(ct), list: (q, ct) => q.ToListAsync(ct). Both get the request's CancellationToken.

ToResultAsync(IQueryable<TItem> source, IReadOnlyList<DataField<TItem>> fields, Func<IQueryable<TItem>, CancellationToken, Task<int>> count, Func<IQueryable<TItem>, CancellationToken, Task<List<TItem>>> list)

The count and items through your async methods, mapping keys through these fields only.

DataResult

record

What an ItemsProvider returns: the rows asked for, and the total count or the cursors of the pages around them.

DataResult members
MemberDescription
Items IReadOnlyList<TItem>

The rows.

Total int?

How many rows match in all. A Table with numbered pages (DataPaging.Pages) needs it; paging by cursor, it's optional and adds "of 1,234" to the range.

Next string?

The cursor of the page after this one, or null on the last page. Used when the component pages by cursor.

Previous string?

The cursor of the page before this one, if your data source gives one. Without it a Table goes back to cursors it has seen on interactive pages; on static pages Previous is unavailable past the second page (First still works).

Length

struct

A width, height or flex basis: a size token, a keyword, or a CSS length built with a factory such as Rem.

Length members
MemberDescription
Sm

640px (matches the sm breakpoint).

Md

768px (matches the md breakpoint).

Lg

1024px (matches the lg breakpoint).

Xl

1280px (matches the xl breakpoint).

Prose

A comfortable reading width, 68 characters.

Full

100% of the containing block.

Auto

auto.

FitContent

fit-content: as wide as the content, up to the available space.

MinContent

min-content.

MaxContent

max-content.

Px(double value)

Pixels.

Rem(double value)

Root ems (16px each by default).

Percent(double value)

Percent of the containing block.

Ch(double value)

Character widths, for text measures.

Vw(double value)

Percent of the viewport width.

Dvh(double value)

Percent of the dynamic viewport height (accounts for mobile browser bars).

Of(string css)

Any CSS length, such as calc(100% - 2rem). Checked for unsafe characters.

Css string

The CSS value this length renders as.

ListMoveEventArgs

class

A move in a reorderable ListView or between drop zones, before the list changes.

ListMoveEventArgs members
MemberDescription
Item TItem

The item that moves.

Key string

Its key.

FromIndex int = 0

Its place before the move, from 0, among the items of its zone (or the list).

ToIndex int = 0

Its place after the move, from 0, among the items of the zone it moves to (or the list).

FromZone string?

The zone it moves from; null outside a DropZoneGroup.

ToZone string?

The zone it moves to; null outside a DropZoneGroup.

Cancel bool = false

Set to keep the item where it was, such as when saving the move failed.

ListOrder

class

What a reorderable ListView or a DropZoneGroup posts on a static page: its keys in the order shown (and in a group each item's zone), and the move a menu asked for. Bind it with [SupplyParameterFromForm(FormName = "...", Name = "...")] under the list's (or group's) Name, pass it back as Order so it shows the new order, and save Arrange (or, for zones, Arrange) when the post is the form's own submit (Move is null).

ListOrder members
MemberDescription
Keys string[]?

The items' keys, in the order the list showed them (after any moves made with script).

Zones string[]?

In a group of zones, each item's zone, in the same order as Keys.

Move string?

The move a handle's menu posted, such as up:42; null when the form's own submit posted.

Arrange<TItem>(IReadOnlyList<TItem> items, Func<TItem, string> key)
Arrange<TItem>(IReadOnlyList<TItem> items, Func<TItem, string> key, Func<TItem, string> zoneOf)
ZoneOf(string key)

The zone the post put an item in (its posted zone, or the move's), or null when the post didn't name it.

Orientation

enum

Whether items run across or down.

Orientation values
ValueDescription
Vertical

Top to bottom.

Horizontal

Side by side, wrapping when space runs out.

SelectAllMode

enum

What a select-all checkbox selects.

SelectAllMode values
ValueDescription
Page

The items on this page.

All

Every item the filters match, on any page, as a Selection that says so rather than listing them.

Selection

class

The items selected in a Table or ListView: some keys, or every item matching a filter and search except some keys (SelectAllMode.All). Bind it with @bind-Selection, or on a static page with [SupplyParameterFromForm(FormName = "...", Name = "...")] under the view's SelectionName. For a bulk action, Apply gives the selected items from a query.

Selection members
MemberDescription
None

Nothing selected.

Of(IEnumerable<string> keys)

These keys selected.

AllOf<TItem>(DataRequest<TItem> request)
Keys string[]?

The selected keys; with All, the keys left out.

All bool = false

Every item matching Filter and Search is selected, except Keys.

Filter string?

With All, the filter it was made under, in the ?filter= form; null for none.

Search string?

With All, the search it was made under; null for none.

KeyList string?

The keys as one JSON list, as the script posts a selection kept across pages: one field rather than one per key, which stays under the server's limit of 1,024 form values. Added to Keys. For the form post, not for code.

IsEmpty bool = true

Nothing is selected.

Apply<TItem>(IQueryable<TItem> source, Expression<Func<TItem, string>> key)
Apply<TItem>(IQueryable<TItem> source, Expression<Func<TItem, string>> key, IReadOnlyList<DataField<TItem>> fields)
Contains(string key)

Whether the item with this key is selected (for All, among the matching items).

Count(int? total)

How many are selected, given how many match; null when All and the total isn't known.

MatchesScope(Filter? filter, string? search)

Whether All was made under this filter and search; when not, the selection no longer means the same items.

With(string key, bool selected)

A copy with this key selected or cleared.

SelectionMode

enum

How many items can be selected.

SelectionMode values
ValueDescription
None

No selection. The default.

Single

One item, with a radio button on each.

Multiple

Any number, with a checkbox on each; with script, a box to select them all (see SelectAllMode).

Connection lost

Rejoining the server…