### Quick example: DataView with columns Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/README.md Displays a DataView bound to an 'orders' collection with sorting, searching, and formatting options. ```razor ``` -------------------------------- ### Install TabBlazor package with dotnet CLI Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/README.md Adds the TabBlazor NuGet package to the project. Requires .NET 10. ```bash dotnet add package TabBlazor ``` -------------------------------- ### Add service hosts to main layout Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md Required setup step: place ModalContainer, ToastContainer, and OffcanvasContainer in the main layout. Without them, IModalService, IOffcanvasService, and ToastService calls show nothing. ```razor ``` -------------------------------- ### Run demo locally Source: https://github.com/tabblazor/tabblazor/blob/master/README.md Starts the demo project from the docs folder. ```bash cd docs/Tabler.Docs.Wasm dotnet run ``` -------------------------------- ### Install Linq2GraphQL.Generator tool Source: https://github.com/tabblazor/tabblazor/blob/master/TabBlazor.Linq2GraphQL.Tests/README.md Installs the global .NET tool for generating the Linq2GraphQL client. The version must match the Linq2GraphQL.Client package. ```bash dotnet tool install --global Linq2GraphQL.Generator --version 1.0.67-prerelease ``` -------------------------------- ### Register TabBlazor services in Program.cs Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md Required setup step: call AddTabBlazor in Program.cs to register services. The options lambda can set EnablePopper for dynamic positioning. AddTabBlazor returns a TabBlazorBuilder for chaining custom validators. ```csharp builder.Services.AddTabBlazor(options => { options.EnablePopper = true; // optional: dynamic tooltip/dropdown/popover positioning }); ``` -------------------------------- ### Install TabBlazor.QuickTable.EntityFramework package Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor.QuickTable.EntityFramework/README.md Adds the TabBlazor.QuickTable.EntityFramework NuGet package to the project. Run this command in the project directory. ```bash dotnet add package TabBlazor.QuickTable.EntityFramework ``` -------------------------------- ### ClassBuilder usage example Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/utilities.md Example of fluent usage: builds a CSS class string conditionally, returning "card text-end" or null when empty. ```csharp var css = new ClassBuilder("card") .AddIf("table-striped", isStriped) .AddCompare(align, new Dictionary { [Align.End] = "text-end" }) .ToString(); // "card text-end", or null when empty ``` -------------------------------- ### Custom Validator Example Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/validation.md Example of implementing a custom IFormValidator and registering it via AddValidation() at startup. ```csharp builder.Services.AddTabBlazor() .AddValidation(); public class FluentFormValidator : IFormValidator { public Type Component => typeof(FluentValidationValidator); // e.g. FluentValidation's validator component public Task ValidateAsync(object validatorInstance, EditContext editContext) => Task.FromResult(editContext.Validate()); public bool Validate(object validatorInstance, EditContext editContext) => editContext.Validate(); } ``` -------------------------------- ### Install TabBlazor packages Source: https://github.com/tabblazor/tabblazor/blob/master/README.md Adds the TabBlazor NuGet package and the optional EF Core adapter for QuickTable. Requires .NET 10. ```bash dotnet add package TabBlazor dotnet add package TabBlazor.QuickTable.EntityFramework # optional, EF Core adapter for QuickTable ``` -------------------------------- ### Flag component usage examples Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/flags.md Razor examples showing how to use the Flag component with CountryCode and Size, including rotation. ```razor ``` -------------------------------- ### AddTabBlazor usage example Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/startup.md Recommended way to register TabBlazor services with optional EnablePopper configuration. ```csharp builder.Services.AddTabBlazor(options => { options.EnablePopper = true; // optional }); ``` -------------------------------- ### Build and test commands Source: https://github.com/tabblazor/tabblazor/blob/master/CLAUDE.md Commands for building the solution, running tests, running the demo site, and packing NuGet packages. Requires .NET 10.0 SDK. ```bash # Build entire solution dotnet build TabBlazor.slnx --configuration Release # Run tests (xUnit) dotnet test dotnet test --no-build --configuration Release # after building # Run a single test dotnet test --filter "FullyQualifiedName~RenderComponentTests.RenderComponent_can_render_when_setting_parameters" # Run demo site (WebAssembly) cd docs/Tabler.Docs.Wasm && dotnet run # Pack NuGet packages dotnet pack src/TabBlazor/TabBlazor.csproj -c Release dotnet pack src/TabBlazor.QuickTable.EntityFramework/TabBlazor.QuickTable.EntityFramework.csproj -c Release dotnet pack src/TabBlazor.Linq2GraphQL/TabBlazor.Linq2GraphQL.csproj -c Release ``` -------------------------------- ### AddValidation usage in Program.cs Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/startup.md Example of registering TabBlazor and replacing the default IFormValidator with a custom implementation. ```csharp // Program.cs var builder = WebApplication.CreateBuilder(args); builder.Services.AddTabBlazor(options => options.EnablePopper = true) .AddValidation(); ``` -------------------------------- ### Quick example: Card with button Source: https://github.com/tabblazor/tabblazor/blob/master/README.md Shows a Card component with a header, title, and a primary Save button that triggers the Save handler. ```razor Hello, TabBlazor ``` -------------------------------- ### Program.cs registration example Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/quicktable-ef.md Shows how to register TabBlazor and the EF adapter in Program.cs. Required to avoid InvalidOperationException when using EF Core queries with QuickTable. ```csharp // Program.cs builder.Services.AddTabBlazor(); builder.Services.AddQuickTableEntityFrameworkAdapter(); ``` -------------------------------- ### Generate client from schema.graphql Source: https://github.com/tabblazor/tabblazor/blob/master/TabBlazor.Linq2GraphQL.Tests/README.md Generates the client from the server schema file. The namespace must not start with 'TabBlazor.' because the generated code refers to 'Linq2GraphQL.Client…' without 'global::', which would resolve to this adapter's namespace. ```bash Linq2GraphQL -sc=Server/schema.graphql -c=TestItemsClient -n=GraphQLTestClient -o=Generated -nu ``` -------------------------------- ### AddTabBlazor Options Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md Configuration options for the TabBlazor library, set in AddTabBlazor(options => …). ```APIDOC ## [C#] AddTabBlazor Options ### Description Configuration options for the TabBlazor library, set in AddTabBlazor(options => …). ### Method AddTabBlazor ### Endpoint AddTabBlazor(options => …) ### Parameters #### Parameters - **EnablePopper** (bool) - Optional - Load Popper (from PopperScriptUrl) for positioning. Also turned on by a non-default DefaultPositioning. - **DefaultPositioning** (Positioning) - Optional - Default for every component with a Positioning parameter. - **Tabs** (TabsOptions) - Optional - App-wide Preload, PreloadDelay, KeepAlive, UrlHistory for Tabs. - **DataViewText** (DataViewText) - Optional - App-wide DataView UI strings. - **DataViewTextResource** (Type) - Optional - A resource marker type to translate DataView strings through IStringLocalizerFactory (services.AddLocalization()); keys are the DataViewText property names. ### Request Example ```csharp AddTabBlazor(options => { options.EnablePopper = true; options.DefaultPositioning = …; options.Tabs = new TabsOptions { … }; options.DataViewText = new DataViewText { … }; options.DataViewTextResource = typeof(…); }); ``` ``` -------------------------------- ### OffcanvasService.ShowAsync Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md Shows an offcanvas panel asynchronously. Returns an OffcanvasResult that can be used to close the panel from inside. ```APIDOC ## [C#] OffcanvasService.ShowAsync ### Description Shows an offcanvas panel asynchronously. Returns an OffcanvasResult that can be used to close the panel from inside. ### Method ShowAsync ### Endpoint OffcanvasService.ShowAsync ### Parameters #### Parameters - **title** (string) - Required - The title of the offcanvas. - **content** (RenderComponent) - Required - The component to render inside the offcanvas. ### Request Example ```csharp var result = await OffcanvasService.ShowAsync("Title", new RenderComponent().Set(…)); ``` ### Response #### Success Response - **OffcanvasResult** - Result object used to close the offcanvas. #### Response Example ```csharp // Inside the offcanvas component IOffcanvasService.Close(…); ``` ``` -------------------------------- ### QuickTable Razor example with PropertyColumn and TemplateColumn Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/quicktable.md Razor markup for a QuickTable bound to an IQueryable with sortable PropertyColumns and a TemplateColumn displaying the Total formatted as currency. Uses the 'table-vcenter' CSS class and the 'default' theme. ```razor ... @($"{(context as Order)!.Total:N2}") ``` -------------------------------- ### Show modal with IModalService.ShowAsync Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md Injects IModalService and shows a modal component with parameters. The result contains data passed via ModalService.Close(ModalResult.Ok(data)) unless cancelled. ```csharp @inject IModalService ModalService var result = await ModalService.ShowAsync("Edit order", new RenderComponent().Set(c => c.OrderId, id)); if (!result.Cancelled) { var data = result.Data; // from ModalService.Close(ModalResult.Ok(data)) } ``` -------------------------------- ### RenderComponent usage example Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/utilities.md Shows how to build a RenderComponent with Set calls for an Order parameter and an EventCallback, then pass it to ModalService.ShowAsync. ```csharp var component = new RenderComponent() .Set(e => e.Order, order) .Set(e => e.OnSaved, EventCallback.Factory.Create(this, o => { ... })); var result = await ModalService.ShowAsync("Edit order", component); ``` -------------------------------- ### Manual popper usage example Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/popper-overlay.md Shows manual creation and disposal of a Popper instance in a Blazor component. Injects IPopperService, creates a popper with BottomStart placement and offset 4, shows it on first render, and disposes it asynchronously. ```csharp @inject IPopperService PopperService private IPopperInstance _popper; private ElementReference _anchor; private ElementReference _panel; protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender && PopperService != null) { _popper = await PopperService.CreateAsync(_anchor, _panel, new PopperOptions { Placement = Placement.BottomStart, Offset = 4 }); await _popper.ShowAsync(); } } public async ValueTask DisposeAsync() { if (_popper != null) await _popper.DisposeAsync(); } ``` -------------------------------- ### Add toast with ToastService.AddToastAsync Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md Adds a toast notification with title, message, and options. Delay of 0 keeps the toast visible until closed. ```csharp await ToastService.AddToastAsync(new ToastModel { Title = "Saved", Message = "The order was saved.", Options = new ToastOptions { Delay = 0 } // 0 = stays until closed }); ``` -------------------------------- ### IModalService.ShowAsync Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md Shows a modal dialog asynchronously. Returns a ModalResult that indicates whether the modal was cancelled and contains data passed when closing. ```APIDOC ## [C#] IModalService.ShowAsync ### Description Shows a modal dialog asynchronously. Returns a ModalResult that indicates whether the modal was cancelled and contains data passed when closing. ### Method ShowAsync ### Endpoint IModalService.ShowAsync ### Parameters #### Parameters - **title** (string) - Required - The title of the modal. - **content** (RenderComponent) - Required - The component to render inside the modal. ### Request Example ```csharp var result = await ModalService.ShowAsync("Edit order", new RenderComponent().Set(c => c.OrderId, id)); ``` ### Response #### Success Response - **Cancelled** (bool) - Indicates whether the modal was cancelled. - **Data** (object) - Data passed to ModalService.Close(ModalResult.Ok(data)). #### Response Example ```csharp if (!result.Cancelled) { var data = result.Data; } ``` ``` -------------------------------- ### IModalService.ShowDialogAsync Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md Shows a confirmation dialog asynchronously. Returns a boolean indicating whether the user confirmed. ```APIDOC ## [C#] IModalService.ShowDialogAsync ### Description Shows a confirmation dialog asynchronously. Returns a boolean indicating whether the user confirmed. ### Method ShowDialogAsync ### Endpoint IModalService.ShowDialogAsync ### Parameters #### Parameters - **options** (DialogOptions) - Required - Configuration options for the dialog. ### Response #### Success Response - **bool** - True if confirmed, false otherwise. #### Response Example ```csharp bool confirmed = await ModalService.ShowDialogAsync(new DialogOptions { … }); ``` ``` -------------------------------- ### DataView with selection, details, and views Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md Configure a DataView with multiple selection, delete, details drawer, and table/list views. Includes row and bulk actions, details and list item templates. SelectedItems is an IReadOnlyList that survives paging and search; bulk handlers receive a DataSelection. ```razor @context.Item.Notes @context.OrderNo ``` -------------------------------- ### ShowDialogAsync with DialogOptions Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/modal-service.md Shows a built-in confirmation dialog using DialogOptions. Returns true if the user confirms (OK) and false otherwise. The example sets MainText, SubText, OkText, and StatusColor. ```csharp // Simple confirm via the built-in dialog private async Task ConfirmDeleteAsync() { var ok = await ModalService.ShowDialogAsync(new DialogOptions { MainText = "Delete this order?", SubText = "This cannot be undone.", OkText = "Delete", StatusColor = TablerColor.Danger }); return ok; } ``` -------------------------------- ### Configure TabBlazor with TablerOptions in Program.cs Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/configuration.md Use this example to configure the global TablerOptions object when registering TabBlazor services with AddTabBlazor. It sets EnablePopper, DefaultPositioning, PopperScriptUrl, Tabs options, DataViewText, DataViewTextResource, and AssemblyScanFilter. Note that setting DefaultPositioning to anything but Default implies EnablePopper = true. ```csharp builder.Services.AddTabBlazor(options => { options.EnablePopper = true; options.DefaultPositioning = Positioning.Absolute; options.PopperScriptUrl = "/js/my-popper.js"; options.Tabs = new TabsOptions { KeepAlive = true, Preload = TabPreload.Hover, PreloadDelay = 150 }; options.DataViewText = new DataViewText { Search = "Sök…", NoResults = "Inga träffar" }; options.DataViewTextResource = typeof(DataViewTextResources); // optional resource-based translation options.AssemblyScanFilter = () => new List { typeof(MyFlags).Assembly }; }); ``` -------------------------------- ### OverlayLayerService usage example Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/popper-overlay.md Demonstrates keeping one overlay above another using the OverlayLayerService. Register returns z-index values (1200, 1210), IsTopMost checks if a z-index is on top, and Unregister removes an overlay. ```csharp // OverlayLayerService: keep one overlay above another var modalZ = overlayLayers.Register(modalView1); // 1200 var drawerZ = overlayLayers.Register(offcanvasView); // 1210 bool contentAbove = overlayLayers.IsTopMost(modalZ); // false overlayLayers.Unregister(offcanvasView); ``` -------------------------------- ### Cursor paging with Linq2GraphQLSource.Cursor and DataView Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/linq2graphql.md Creates a cursor-paged data source for a generated GraphQL client, including the Customer navigation property, and binds it to a DataView with virtualized, sortable, searchable, and filterable columns. The source is the file's own example. ```csharp // Cursor paging over a generated client (from the source file's own example) var orders = Linq2GraphQLSource.Cursor( (first, after, where, order) => client.Query .Orders(first: first, after: after, where: where, order: order) .Include(c => c.Nodes.Select(o => o.Customer))); ``` -------------------------------- ### Define custom icon with TablerIcon Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md Create a static class with an IIconType property using TablerIcon and an SVG path from tabler.io/icons. The package ships no icon catalog; define your own icons. ```csharp public static class AppIcons { public static IIconType Heart => new TablerIcon( ""); } ``` -------------------------------- ### Custom IDataViewSource implementation Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/dataview-contract.md Example of a custom data source for the DataView component, using HTTP POST to fetch a page of orders. Implements IDataViewSource with PagingMode.Offset. ```csharp public class OrderApiSource : IDataViewSource { public PagingMode PagingMode => PagingMode.Offset; public async Task> GetPageAsync(DataRequest request, CancellationToken ct) { using var response = await _http.PostAsJsonAsync("api/orders", request, ct); response.EnsureSuccessStatusCode(); return await response.Content.ReadFromJsonAsync>(ct); } } ``` -------------------------------- ### AddToastAsync with ToastModel example Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/toast-service.md Injects ToastService and shows adding a toast with custom options: Delay=5 and Position=BottomEnd. Uses a Blazor component with @inject directive. ```csharp @inject ToastService ToastService async Task NotifySavedAsync() { await ToastService.AddToastAsync(new ToastModel("Saved", "The order was stored", "Order #1234") { Options = new ToastOptions { Delay = 5, Position = ToastPosition.BottomEnd } }); } ``` -------------------------------- ### DataView Component Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md A Blazor component for displaying tables and lists with paging, sorting, search, filtering, editing, selection, and more. Configure data source via Items, ItemsProvider, or Source. ```APIDOC ## DataView Component ### Description A Blazor component for displaying tables and lists with paging, sorting, search, filtering, editing, selection, and more. Configure data source via Items, ItemsProvider, or Source. ### Parameters - **Items** (`IEnumerable`) - Optional - In-memory data source; paging, sorting, search, and filters run in memory. - **ItemsProvider** (`Func>>`) - Optional - Delegate for server/database data source; translate the request and pass the cancellation token. - **Source** (`IDataViewSource`) - Optional - Custom data source implementation; `InMemorySource` is built-in. - **KeySelector** (`Expression>`) - Required - Expression to select the unique key for each item; used for selection, editing, and stable paging. - **Title** (`string`) - Optional - Title of the DataView. - **PageSize** (`int`) - Optional - Number of items per page. - **EditMode** (`DataEditMode`) - Optional - Editing mode: `Inline`, `Popup`, `Drawer`, or `Custom`. - **SaveItem** (`Func, Task>>`) - Optional - Callback for saving an item; return `EditResult.Saved` on success. - **DeleteItem** (`Func>`) - Optional - Callback for deleting an item; return `EditResult.Deleted` on success. - **NewItem** (`Func`) - Optional - Factory for creating a new item for editing. - **OnCustomEdit** - Optional - Handler for custom edit mode. ### DataRequest - **Page** - Offset or cursor for paging. - **Sorts** - List of sort specifications. - **Search** - Search text. - **Filters** - List of filter specifications. - **Columns** - List of column definitions. ### DataPage - Constructor: `new DataPage(items, totalCount)` or `(items, null, nextCursor)` with `PagingMode.Cursor`. ### Example ```razor ``` ``` -------------------------------- ### Build and test the solution Source: https://github.com/tabblazor/tabblazor/blob/master/README.md Builds the solution in Release configuration and runs all tests. ```bash dotnet build TabBlazor.slnx -c Release dotnet test ``` -------------------------------- ### DataView with ItemsProvider for server/database data Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md Use this Razor markup to load data asynchronously from a server or database via an ItemsProvider delegate. The LoadAsync method receives a DataRequest and CancellationToken; translate the request and pass the token to your API call. Requires setting KeySelector. ```razor ... @code { private async Task> LoadAsync(DataRequest request, CancellationToken cancellationToken) { // EF Core: create one DbContext per call from IDbContextFactory, apply request.Sorts, // request.Search and request.Filters, then Skip/Take from request.Page. return await api.GetOrdersAsync(request, cancellationToken); } } ``` -------------------------------- ### Install @tabler/icons-sprite with pnpm Source: https://github.com/tabblazor/tabblazor/blob/master/Icons/IconGenerator/Tabler/sprites/readme.md Install the Tabler Icons sprite package using the pnpm package manager. ```bash pnpm install @tabler/icons-sprite ``` -------------------------------- ### Install @tabler/icons-sprite with npm Source: https://github.com/tabblazor/tabblazor/blob/master/Icons/IconGenerator/Tabler/sprites/readme.md Install the Tabler Icons sprite package using the npm package manager. ```bash npm install @tabler/icons-sprite ``` -------------------------------- ### DataView with in-memory Items and DataColumn definitions Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md Use this Razor markup to render a DataView bound to an in-memory collection. Configure columns with sorting, searching, filtering, formatting, and default sort order. Requires setting KeySelector for selection, editing, and stable paging. ```razor ``` -------------------------------- ### Install @tabler/icons-sprite with yarn Source: https://github.com/tabblazor/tabblazor/blob/master/Icons/IconGenerator/Tabler/sprites/readme.md Install the Tabler Icons sprite package using the yarn package manager. ```bash yarn add @tabler/icons-sprite ``` -------------------------------- ### Server-side provider with EF Core adapter and LoadOrders method Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/quicktable.md Shows server-side data loading with EF Core via the adapter package. Registers the adapter, uses ItemsProvider with Pagination and Virtualize, and defines a LoadOrders method that applies sorting (throws NotSupportedException for non-ISortBuilderColumn sorts), counts, and pages the query. ```csharp // Server-side provider with EF Core via the adapter package builder.Services.AddQuickTableEntityFrameworkAdapter(); ... @code { PaginationState _pagination = new() { ItemsPerPage = 25 }; async ValueTask> LoadOrders(GridItemsProviderRequest request) { var query = _db.Orders; // IQueryable query = request.ApplySorting(query); // throws NotSupportedException for non-ISortBuilderColumn sorts var count = await query.CountAsync(); var items = await query.Skip(request.StartIndex).Take(request.Count ?? 50).ToArrayAsync(); return GridItemsProviderResult.From(items, count); } } ``` -------------------------------- ### IOffcanvasService.Close Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md Closes the current offcanvas from inside the offcanvas component. ```APIDOC ## [C#] IOffcanvasService.Close ### Description Closes the current offcanvas from inside the offcanvas component. ### Method Close ### Endpoint IOffcanvasService.Close ### Parameters #### Parameters - **result** (OffcanvasResult) - Required - The result to return when closing. ### Request Example ```csharp IOffcanvasService.Close(…); ``` ``` -------------------------------- ### QuickTable Component Usage Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/quicktable.md Demonstrates how to use the QuickTable component with Items or ItemsProvider, including sorting, pagination, and virtualization. ```razor ... @($"{(context as Order)!.Total:N2}") ``` ```csharp // Server-side provider with EF Core via the adapter package builder.Services.AddQuickTableEntityFrameworkAdapter(); ... @code { PaginationState _pagination = new() { ItemsPerPage = 25 }; async ValueTask> LoadOrders(GridItemsProviderRequest request) { var query = _db.Orders; // IQueryable query = request.ApplySorting(query); // throws NotSupportedException for non-ISortBuilderColumn sorts var count = await query.CountAsync(); var items = await query.Skip(request.StartIndex).Take(request.Count ?? 50).ToArrayAsync(); return GridItemsProviderResult.From(items, count); } } ``` ```csharp // Error handling: both Items and ItemsProvider try { // throws in OnParametersSetAsync: // InvalidOperationException: "QuickTables requires one of Items or ItemsProvider, but both were specified." } ``` -------------------------------- ### FieldPaths.Get Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/linq2graphql.md Gets a GraphQLColumn by its ID. Throws InvalidOperationException for unknown IDs. ```APIDOC ## FieldPaths.Get ### Description Gets a GraphQLColumn by its ID. Throws InvalidOperationException for unknown IDs. ### Method Get ### Signature GraphQLColumn Get(string id) ### Parameters - **id** (string) - Required - The column ID. ### Returns GraphQLColumn - The column with the given ID. ### Exceptions - **InvalidOperationException** - Thrown when the ID is unknown. ``` -------------------------------- ### FlagService.AllFlags Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/flags.md Gets every discovered flag (name + IFlagType) from the assembly scan. ```APIDOC ## FlagService.AllFlags ### Description Gets every discovered flag (name + IFlagType) from the assembly scan. ### Method Property ### Endpoint FlagService.AllFlags ### Response #### Success Response - **List** - List of all discovered flags. ``` -------------------------------- ### StopConfettiAsync Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/tabler-service.md Stops a previously started confetti animation using the identifier returned by ConfettiAsync. ```APIDOC ## StopConfettiAsync ### Description Stops a previously started confetti animation using the identifier returned by ConfettiAsync. ### Method Not specified (client-side service method) ### Parameters - **id** (type not specified) - Required - The identifier returned by ConfettiAsync. ### Example ```csharp await TablerService.StopConfettiAsync(id); ``` ``` -------------------------------- ### ToastService.AddToastAsync Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md Adds a toast notification asynchronously. The toast can be configured with title, message, and options. ```APIDOC ## [C#] ToastService.AddToastAsync ### Description Adds a toast notification asynchronously. The toast can be configured with title, message, and options. ### Method AddToastAsync ### Endpoint ToastService.AddToastAsync ### Parameters #### Parameters - **toast** (ToastModel) - Required - The toast model containing Title, Message, and Options. ### Request Example ```csharp await ToastService.AddToastAsync(new ToastModel { Title = "Saved", Message = "The order was saved.", Options = new ToastOptions { Delay = 0 } // 0 = stays until closed }); ``` ``` -------------------------------- ### Custom validator registration and implementation Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/validation.md Shows how to plug in a custom validator at startup using AddValidation() and provides a sample FluentFormValidator implementing IFormValidator. ```csharp // Custom validator plugged in at startup builder.Services.AddTabBlazor() .AddValidation(); public class FluentFormValidator : IFormValidator { public Type Component => typeof(FluentValidationValidator); // e.g. FluentValidation's validator component public Task ValidateAsync(object validatorInstance, EditContext editContext) => Task.FromResult(editContext.Validate()); public bool Validate(object validatorInstance, EditContext editContext) => editContext.Validate(); } ``` -------------------------------- ### IModalService.Close Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md Closes the current modal from inside the modal component. Can pass a ModalResult with data or cancel. ```APIDOC ## [C#] IModalService.Close ### Description Closes the current modal from inside the modal component. Can pass a ModalResult with data or cancel. ### Method Close ### Endpoint IModalService.Close ### Parameters #### Parameters - **result** (ModalResult) - Required - The result to return; use ModalResult.Ok(data) to pass data, or Close() to cancel. ### Request Example ```csharp ModalService.Close(ModalResult.Ok(data)); // or ModalService.Close(); ``` ``` -------------------------------- ### ShowColumnOptions Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/quicktable.md Opens the display-options popup for the specified column. ```APIDOC ## ShowColumnOptions ### Description Opens the display-options popup for the specified column. ### Method void ### Signature `public void ShowColumnOptions(ColumnBase column)` ### Parameters - **column** (ColumnBase) - Required - The column for which to show display options. ``` -------------------------------- ### Rendering Validation Messages Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/validation.md Example of using TabValidationMessage within a TablerForm to display validation messages with Tabler styling. ```razor ``` -------------------------------- ### Rendering validation messages with TablerForm Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/validation.md Example of using TablerForm with TabValidationMessage to display validation messages with Tabler styling. ```razor ``` -------------------------------- ### AddQuickTableEntityFrameworkAdapter Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/quicktable-ef.md Registers the Entity Framework Core async query executor as a singleton in the dependency injection container. Call this during application startup to enable efficient async querying for QuickTable with EF Core. ```APIDOC ## AddQuickTableEntityFrameworkAdapter ### Description Registers `IAsyncQueryExecutor` → `EntityFrameworkAsyncQueryExecutor` as a singleton in the provided `IServiceCollection`. This enables QuickTable to use EF Core's async query provider for efficient paging, virtualization, and sorting. ### Method N/A (Service registration method) ### Parameters - **services** (`IServiceCollection`) - Required - The dependency injection collection to add the singleton to. ### Request Example ```csharp builder.Services.AddQuickTableEntityFrameworkAdapter(); ``` ### Response No return value. ``` -------------------------------- ### PopperOptions and IPopperInstance types Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/popper-overlay.md PopperOptions configures placement, strategy, and offset. IPopperInstance provides update, show, hide, and set placement methods. Placement values map to Popper strings via ToPopperString(). ```csharp public class PopperOptions { public Placement Placement { get; set; } = Placement.Top; public Positioning Strategy { get; set; } = Positioning.Absolute; public int Offset { get; set; } = 0; } public interface IPopperInstance : IAsyncDisposable { Task UpdateAsync(); Task ShowAsync(); Task HideAsync(); Task SetPlacementAsync(Placement placement); } ``` -------------------------------- ### EditAction Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/dataview-interaction.md Starts editing the row. Visible when the view can edit. ```APIDOC ## EditAction ### Description Starts editing the row. Visible when the view can edit. ### Usage ```razor ``` ``` -------------------------------- ### Linq2GraphQLSource.PagingMode Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/linq2graphql.md Gets the paging mode (Cursor or Offset) set by the factory method. ```APIDOC ## [PROPERTY] Linq2GraphQLSource.PagingMode ### Description Gets the paging mode (Cursor or Offset) set by the factory method. ### Property Signature `public PagingMode PagingMode { get; }` ### Returns - **PagingMode** - The paging mode (Cursor or Offset). ``` -------------------------------- ### OpenContentWindow Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/tabler-service.md Opens a new browser window with the provided content as a blob. Returns the name of the opened window. ```APIDOC ## OpenContentWindow ### Description Opens a new browser window with the provided content as a blob. Returns the name of the opened window. ### Method Task ### Parameters - **contentType** (string) - Required - The MIME type of the content. - **content** (byte[]) - Required - The binary content to display. - **urlSuffix** (string) - Optional - A suffix to append to the URL. - **name** (string) - Optional - The name of the window. - **features** (string) - Optional - Comma-separated window features. ### Response Task - The name of the opened window. ``` -------------------------------- ### GridItemsProviderResult.From Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/quicktable.md Creates a GridItemsProviderResult from the specified items and total count. ```APIDOC ## GridItemsProviderResult.From ### Description Creates a GridItemsProviderResult from the specified items and total count. ### Signature `public static GridItemsProviderResult From(ICollection items, int totalItemCount)` ### Parameters - **items** (ICollection) - Required - The collection of items. - **totalItemCount** (int) - Required - The total number of items available. ### Returns GridItemsProviderResult ``` -------------------------------- ### IPopperInstance Methods Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/popper-overlay.md Methods to control a Popper instance after creation, including updating, showing, hiding, and changing placement. These methods are part of the IPopperInstance interface. ```APIDOC ## [C#] IPopperInstance Methods ### Description Methods to control a Popper instance after creation. ### Methods - **UpdateAsync()** - Task - Updates the Popper instance's position. - **ShowAsync()** - Task - Shows the popper element. - **HideAsync()** - Task - Hides the popper element. - **SetPlacementAsync(Placement placement)** - Task - Changes the placement of the popper element. ### Parameters - **placement** (Placement) - Required - The new placement for the popper element. ### Response Each method returns a Task representing the asynchronous operation. ``` -------------------------------- ### EditResult Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md Result type returned by SaveItem and DeleteItem callbacks. Use static methods to indicate success or failure. ```APIDOC ## EditResult ### Description Result type returned by SaveItem and DeleteItem callbacks. Use static methods to indicate success or failure. ### Static Methods - **Saved(TItem item)** - Returns a successful result with the saved item. - **Invalid((string field, string message) error)** - Returns an invalid result with a field error. - **Deleted()** - Returns a successful deletion result. - **Failed(string message)** - Returns a failure result with a message. ### Example ```csharp private async Task> SaveAsync(DataEditContext ctx) { if (await api.OrderNoTakenAsync(ctx.Draft)) return EditResult.Invalid(("orderNo", "Order number already exists")); return EditResult.Saved(await api.SaveAsync(ctx.Draft)); } ``` ``` -------------------------------- ### TabBlazorBuilder Constructor Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/startup.md Initializes a new instance of the TabBlazorBuilder class with the provided IServiceCollection. ```APIDOC ## TabBlazorBuilder Constructor ### Description Initializes a new instance of the TabBlazorBuilder class with the provided IServiceCollection. ### Method Constructor ### Parameters - **services** (IServiceCollection) - Required - The collection returned by AddTabler/AddTabBlazor. ``` -------------------------------- ### DataViewText.Default Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/configuration.md Gets the default English UI strings for the DataView component. This static property provides a ready-to-use instance with all default texts. ```csharp public static DataViewText Default { get; } ``` -------------------------------- ### AddAsync() Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/dataview-interaction.md Starts adding a new item. Asks first when another edit has unsaved changes. ```APIDOC ## AddAsync() ### Description Starts adding a new item. Asks first when another edit has unsaved changes. ### Method AddAsync ### Signature `public async Task AddAsync()` ### Returns `Task` ``` -------------------------------- ### IPopperService.CreateAsync Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/popper-overlay.md Creates a Popper instance that dynamically positions a popper element relative to a reference element. This method is part of the IPopperService interface and is used to initialize a Popper instance with the given options. ```APIDOC ## [C#] IPopperService.CreateAsync ### Description Creates a Popper instance that dynamically positions a popper element relative to a reference element. ### Method CreateAsync ### Signature Task CreateAsync(ElementReference reference, ElementReference popper, PopperOptions options) ### Parameters - **reference** (ElementReference) - Required - The reference element to position the popper relative to. - **popper** (ElementReference) - Required - The popper element to be positioned. - **options** (PopperOptions) - Required - Configuration options for the Popper instance. ### Request Example ```csharp var popper = await PopperService.CreateAsync(_anchor, _panel, new PopperOptions { Placement = Placement.BottomStart, Offset = 4 }); ``` ### Response Returns an IPopperInstance that can be used to control the Popper instance. ``` -------------------------------- ### DataRequest.GetColumn(string id) Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/dataview-contract.md Gets a column by its stable ID within the DataRequest. Throws an InvalidOperationException if the column is not present. ```APIDOC ## DataRequest.GetColumn(string id) ### Description Gets a column by its stable ID within the DataRequest. Throws an InvalidOperationException if the column is not present. ### Method GetColumn ### Signature `public DataColumnInfo GetColumn(string id)` ### Parameters - **id** (string) - Required - The stable column ID to search for. ### Returns - **DataColumnInfo** - The matching column. ### Exceptions - **InvalidOperationException** - Thrown when the column is not found in `DataRequest.Columns`. ``` -------------------------------- ### GridItemsProvider delegate Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/quicktable.md Defines a provider for grid items that returns a result asynchronously. ```APIDOC ## GridItemsProvider delegate ### Description Defines a provider for grid items that returns a result asynchronously. ### Signature `public delegate ValueTask> GridItemsProvider(GridItemsProviderRequest request);` ### Parameters - **request** (GridItemsProviderRequest) - Required - The request containing pagination, sorting, and cancellation information. ``` -------------------------------- ### EditAsync(TItem item) Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/dataview-interaction.md Starts editing a row. Asks first when another edit has unsaved changes. ```APIDOC ## EditAsync(TItem item) ### Description Starts editing a row. Asks first when another edit has unsaved changes. ### Method EditAsync ### Signature `public async Task EditAsync(TItem item)` ### Parameters - **item** (TItem) - Required - The row to edit. ### Returns `Task` ``` -------------------------------- ### GridItemsProviderRequest Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/api-reference/quicktable.md Represents a request for grid items, including pagination, sorting, and cancellation. ```APIDOC ## GridItemsProviderRequest ### Description Represents a request for grid items, including pagination, sorting, and cancellation. ### Properties - **StartIndex** (int) - The starting index for the requested items. - **Count** (int?) - The number of items requested, or null for all. - **SortByColumn** (ColumnBase) - The column to sort by. - **SortByAscending** (bool) - Whether the sort is ascending. - **CancellationToken** (CancellationToken) - A token to cancel the operation. ### Methods - **ApplySorting** (IQueryable source) - Applies sorting to the source query. Requires the sort column to implement ISortBuilderColumn; otherwise throws NotSupportedException with ColumnNotSortableMessage. - **GetSortByProperties** () - Returns a collection of (PropertyName, SortDirection) tuples for building dynamic queries. ``` -------------------------------- ### Use custom icon in Icon component Source: https://github.com/tabblazor/tabblazor/blob/master/src/TabBlazor/AGENTS.md Render an icon using the custom AppIcons.Heart with size and color. The Icon component accepts an IIconType. ```razor ``` -------------------------------- ### DataViewText.FromLocalizer Source: https://github.com/tabblazor/tabblazor/blob/master/_autodocs/configuration.md Creates a DataViewText instance from an IStringLocalizer, allowing localization of UI strings. Throws ArgumentNullException if the localizer is null. ```csharp public static DataViewText FromLocalizer(IStringLocalizer localizer, DataViewText? fallback = null) ```