ListView
Since 0.1.0-alpha.20IzzyBlazor.ListView<TItem> in the IzzyBlazor.Core package, generated from the 0.1.0-alpha.20 assembly
and its doc comments.
Properties (48)
ChildContentRenderFragment<TItem>?An item's content. Without it, ItemText, ItemDescription and ItemIcon draw a row.
ItemTextFunc<TItem, string?>? (computed)The default row's text. Defaults to the item's string form.
ItemDescriptionFunc<TItem, string?>?The default row's muted second line, such as an email address or a date.
ItemIconFunc<TItem, IconData?>?The default row's icon, at its start.
ItemLabelFunc<TItem, string>? (computed)ItemHrefFunc<TItem, string?>?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>?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>?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.
ItemDisabledFunc<TItem, bool>?Dims an item and leaves it without its link or button; its ItemActions and ItemMenu stay.
OrientationOrientation = Orientation.VerticalOrientation.Vertical (the default) lists the items top to bottom; Orientation.Horizontal side by side, wrapping when space runs out.
Columnsint = 1Lays 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?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 = falseDraws 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 = trueA line between items in a list. Defaults to true.
Borderedbool = falseA rounded border around the list. Defaults to false.
SizeControlSize = ControlSize.MdItem spacing and text size. Defaults to ControlSize.Md.
AriaLabelstring?Names the list for screen readers, when the text around it doesn't.
Reorderablebool = falseLets 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?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?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 = falseFor 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 = falseFor 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?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>?For a Zone, which items may move here from other zones, such as t => t.Reviewed.
@bind-ItemsIEnumerable<TItem>?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>>>?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?Items per page. Leave it out to show every item.
PageSizeOptionsIReadOnlyList<int>?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?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.PagesHow 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"The "Load more" button's text, such as "Load earlier". Defaults to "Load more".
@bind-Cursorstring?QueryPrefixstring = ""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)Shown when there are no items. Defaults to EmptyText.
EmptyTextstring? = "No items"The text when there are no items. Defaults to "No items".
ErrorContentRenderFragment?Shown in place of "Couldn't load the rows." when loading fails, before the Retry button.
ItemKeyFunc<TItem, string>? (computed)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 = falseShows it as loading: items dim, or placeholders show while there are none. Set automatically while an ItemsProvider loads on interactive pages.
SelectionModeSelectionMode = SelectionMode.NoneWhether 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)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?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>?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.PageWhat 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>?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"The select-all checkbox's name for screen readers. Defaults to "Select all rows".
SelectRowLabelstring? = "Select"The start of each item checkbox's name for screen readers, before the item's label. Defaults to "Select".
Plus 16 item props and 4 common props.
Show them hereEvents (2)
OnItemClickEventCallback<TItem>Makes each item a button that runs this, on interactive pages. Items with an ItemHref are links instead.
Methods (1)
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
enumThe 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.
| Value | Description |
|---|---|
Sm | 32px tall, small text. |
Md | 36px tall (the default). |
Lg | 44px tall, large text. For touch-first and marketing pages. |
DataPaging
enumHow a Table<T> or ListView with a PageSize moves through its pages.
| Value | Description |
|---|---|
Pages | Numbered pages and "1–10 of 42". Needs the total ( |
NextPrevious | First, previous and next only, by cursor ( |
LoadMore | A "Load more" button after the items that adds the next page to them, by cursor: for a |
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 |
DataRequest
recordWhat 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.
| Member | Description |
|---|---|
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 ( |
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 | |
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 |
ToODataQuery() | The request as OData query options, for a provider whose API is an OData endpoint: |
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: |
ToResult(IQueryable<TItem> source) | The count of what the filter keeps (when |
ToResult(IQueryable<TItem> source, IReadOnlyList<DataField<TItem>> fields) | The count and items, through these fields only (see |
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 |
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
recordWhat an ItemsProvider returns: the rows asked for, and the total count or the cursors of the pages around them.
| Member | Description |
|---|---|
Items IReadOnlyList<TItem> | The rows. |
Total int? | How many rows match in all. A Table with numbered pages ( |
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
structA width, height or flex basis: a size token, a keyword, or a CSS length built with a factory such as Rem.
| Member | Description |
|---|---|
Sm | 640px (matches the |
Md | 768px (matches the |
Lg | 1024px (matches the |
Xl | 1280px (matches the |
Prose | A comfortable reading width, 68 characters. |
Full | 100% of the containing block. |
Auto |
|
FitContent |
|
MinContent |
|
MaxContent |
|
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 |
Css string | The CSS value this length renders as. |
ListMoveEventArgs
classA move in a reorderable ListView or between drop zones, before the list changes.
| Member | Description |
|---|---|
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 |
ToZone string? | The zone it moves to; null outside a |
Cancel bool = false | Set to keep the item where it was, such as when saving the move failed. |
ListOrder
classWhat 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).
| Member | Description |
|---|---|
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 |
Move string? | The move a handle's menu posted, such as |
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
enumWhether items run across or down.
| Value | Description |
|---|---|
Vertical | Top to bottom. |
Horizontal | Side by side, wrapping when space runs out. |
SelectAllMode
enumWhat a select-all checkbox selects.
| Value | Description |
|---|---|
Page | The items on this page. |
All | Every item the filters match, on any page, as a |
Selection
classThe 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.
| Member | Description |
|---|---|
None | Nothing selected. |
Of(IEnumerable<string> keys) | These keys selected. |
AllOf<TItem>(DataRequest<TItem> request) | |
Keys string[]? | The selected keys; with |
All bool = false | |
Filter string? | With |
Search string? | With |
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 |
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 |
Count(int? total) | How many are selected, given how many match; null when |
MatchesScope(Filter? filter, string? search) | Whether |
With(string key, bool selected) | A copy with this key selected or cleared. |
SelectionMode
enumHow many items can be selected.
| Value | Description |
|---|---|
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 |