Table of Contents

Class MudTableBase

Namespace
MudBlazor
Assembly
MudBlazor.dll

A base class for designing table components.

public abstract class MudTableBase : MudComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged
Inheritance
MudTableBase
Implements
Derived
Inherited Members
Extension Methods

Constructors

MudTableBase()

protected MudTableBase()

Properties

AllowUnsorted

Allows a sort direction of None in addition to Ascending and Descending.

[Parameter]
[Category("Sorting")]
public bool AllowUnsorted { get; set; }

Property Value

bool

Remarks

Defaults to true. When false, the sort mode will only toggle between Ascending and Descending.

ApplyButtonPosition

The position of the button which commits inline edits.

[Parameter]
[Category("Editing")]
public TableApplyButtonPosition ApplyButtonPosition { get; set; }

Property Value

TableApplyButtonPosition

Remarks

Defaults to End. Requires Editable to be true and ReadOnly to be false.

Bordered

Shows left and right borders for each table cell.

[Parameter]
[Category("Appearance")]
public bool Bordered { get; set; }

Property Value

bool

Breakpoint

The screen width at which this table switches to small-device mode.

[Parameter]
[Category("Behavior")]
public Breakpoint Breakpoint { get; set; }

Property Value

Breakpoint

Remarks

Defaults to Xs. Allowed values are None, Xs, Sm, Md, Lg, and Xl.

CanCancelEdit

Shows the cancel button during inline editing.

[Parameter]
[Category("Editing")]
public bool CanCancelEdit { get; set; }

Property Value

bool

Remarks

Requires Editable to be true and ReadOnly to be false.

CancelEditIcon

The icon shown for the button which cancels inline edits.

[Parameter]
[Category("Editing")]
public string CancelEditIcon { get; set; }

Property Value

string

Remarks

Defaults to Cancel. Requires Editable to be true and ReadOnly to be false.

CancelEditTooltip

The tooltip shown next to the button which cancels inline edits.

[Parameter]
[Category("Editing")]
public string? CancelEditTooltip { get; set; }

Property Value

string

Remarks

Requires Editable to be true and ReadOnly to be false.

Classname

protected string Classname { get; }

Property Value

string

ColGroup

Specifies formatting information for this table's columns such as size and style.

[Parameter]
[Category("Behavior")]
public RenderFragment? ColGroup { get; set; }

Property Value

RenderFragment

Remarks

Defaults to null. Add a set of col elements to style each column. For example:

<ColGroup>
<col span="2" style="max-midth:120px; background-color:red">
<col style="background-color:yellow">
</ColGroup>

CommitEditIcon

The icon shown for the button which commits inline edits.

[Parameter]
[Category("Editing")]
public string CommitEditIcon { get; set; }

Property Value

string

Remarks

Defaults to Done. Requires Editable to be true and ReadOnly to be false.

CommitEditTooltip

The tooltip shown next to the button which commits inline edits.

[Parameter]
[Category("Editing")]
public string? CommitEditTooltip { get; set; }

Property Value

string

Remarks

Requires Editable to be true and ReadOnly to be false.

ContainerClass

The CSS classes applied to this table.

[Parameter]
[Category("Appearance")]
public string? ContainerClass { get; set; }

Property Value

string

Remarks

Defaults to null. Multiple classes must be separated by spaces.

ContainerStyle

The CSS styles applied to this table.

[Parameter]
[Category("Appearance")]
public string? ContainerStyle { get; set; }

Property Value

string

Remarks

Defaults to null.

CurrentPage

The index of the current page.

[Parameter]
[Category("Pagination")]
public int CurrentPage { get; set; }

Property Value

int

Remarks

Defaults to 0 (the first page). Requires a MudTablePager in the PagerContent.

CurrentPageChanged

Occurs when CurrentPage has changed.

[Parameter]
public EventCallback<int> CurrentPageChanged { get; set; }

Property Value

EventCallback<int>

CustomFooter

Enables customized footers beyond basic footer columns.

[Parameter]
[Category("Footer")]
public bool CustomFooter { get; set; }

Property Value

bool

Remarks

Defaults to false. When true, custom footers such as multiple-row footers can be used.

CustomHeader

Enables customized headers beyond basic header columns.

[Parameter]
[Category("Header")]
public bool CustomHeader { get; set; }

Property Value

bool

Remarks

Defaults to false. When true, custom headers such as multiple-row headers can be used.

Dense

Uses compact padding for all rows.

[Parameter]
[Category("Appearance")]
public bool Dense { get; set; }

Property Value

bool

Remarks

Defaults to false.

EditButtonContent

The content of the Edit button which starts inline editing.

[Parameter]
[Category("Editing")]
public RenderFragment<EditButtonContext>? EditButtonContent { get; set; }

Property Value

RenderFragment<EditButtonContext>

Remarks

Requires Editable to be true and ReadOnly to be false.

EditButtonPosition

The position of the button which begins inline editing.

[Parameter]
[Category("Editing")]
public TableEditButtonPosition EditButtonPosition { get; set; }

Property Value

TableEditButtonPosition

Remarks

Defaults to End. Requires Editable to be true and ReadOnly to be false.

EditTrigger

The behavior which begins inline editing.

[Parameter]
[Category("Editing")]
public TableEditTrigger EditTrigger { get; set; }

Property Value

TableEditTrigger

Remarks

Defaults to RowClick. Requires Editable to be true and ReadOnly to be false.

Elevation

The size of the drop shadow.

[Parameter]
[Category("Appearance")]
public int Elevation { get; set; }

Property Value

int

Remarks

Defaults to 1. A higher number creates a heavier drop shadow. Use a value of 0 for no shadow.

FixedFooter

Fixes the table footer in place while the table is scrolled.

[Parameter]
[Category("Footer")]
public bool FixedFooter { get; set; }

Property Value

bool

Remarks

Defaults to false. When set, Height must also be set.

FixedHeader

Fixes the table header in place while the table is scrolled.

[Parameter]
[Category("Header")]
public bool FixedHeader { get; set; }

Property Value

bool

Remarks

Defaults to false. When set, Height must also be set.

FootClassname

protected string FootClassname { get; }

Property Value

string

FooterClass

Add a class to the tfoot tag

[Parameter]
[Category("Footer")]
public string? FooterClass { get; set; }

Property Value

string

FooterContent

The content of this table's footer.

[Parameter]
[Category("Footer")]
public RenderFragment? FooterContent { get; set; }

Property Value

RenderFragment

Remarks

For basic footers, add MudTd components here to describe each column. For more customized footers (such as multi-row footers), set CustomFooter to true and use MudTFootRow components here instead.

HeadClassname

protected string HeadClassname { get; }

Property Value

string

HeaderClass

The CSS classes applied to the header.

[Parameter]
[Category("Header")]
public string? HeaderClass { get; set; }

Property Value

string

Remarks

Multiple classes must be separated by spaces.

HeaderContent

The content of this table's header.

[Parameter]
[Category("Header")]
public RenderFragment? HeaderContent { get; set; }

Property Value

RenderFragment

Remarks

For basic headers, add MudTh components here to describe each column. For more customized headers (such as multi-row headers), set CustomHeader to true and use MudTHeadRow components here instead.

Height

The fixed height of this table, as a CSS Value.

[Parameter]
[Category("Appearance")]
public string? Height { get; set; }

Property Value

string

Remarks

Defaults to null. Accepts values such as 50% or 500px. When null, the table will try to grow to fit its content. When set, FixedHeader and FixedFooter can be enabled.

Hover

Highlights rows when hovering over them.

[Parameter]
[Category("Appearance")]
public bool Hover { get; set; }

Property Value

bool

Remarks

Defaults to false.

IsEditRowSwitchingBlocked

Forces a row being edited to be saved or canceled before a new row can be selected.

[Parameter]
[Category("Editing")]
public bool IsEditRowSwitchingBlocked { get; set; }

Property Value

bool

Remarks

Defaults to false. When false, a new row can be edited even if the previous one has not been saved or canceled.

ItemSize

The height of each row, in pixels, when Virtualize is true.

[Parameter]
[Category("Behavior")]
public float ItemSize { get; set; }

Property Value

float

Remarks

Defaults to 50.

Loading

Displays a loading animation while ServerData executes.

[Parameter]
[Category("Data")]
public bool Loading { get; set; }

Property Value

bool

Remarks

Defaults to false. Becomes true before ServerData is called, then becomes false. When true, either a MudProgressLinear is displayed or custom content if LoadingContent is set.

LoadingProgressColor

The color of the MudProgressLinear while Loading is true.

[Parameter]
[Category("Data")]
public Color LoadingProgressColor { get; set; }

Property Value

Color

Remarks

Defaults to Info. Has no effect if LoadingContent is set.

MultiSelection

Allows multiple rows to be selected with checkboxes.

[Parameter]
[Category("Selecting")]
public bool MultiSelection { get; set; }

Property Value

bool

Remarks

Defaults to false.

NumPages

protected abstract int NumPages { get; }

Property Value

int

OnCancelEditClick

Occurs when changes to a row being edited are canceled.

[Parameter]
public EventCallback<MouseEventArgs> OnCancelEditClick { get; set; }

Property Value

EventCallback<MouseEventArgs>

Remarks

Requires Editable to be true and ReadOnly to be false.

OnCommitEditClick

Occurs when changes to a row being edited are committed.

[Parameter]
public EventCallback<MouseEventArgs> OnCommitEditClick { get; set; }

Property Value

EventCallback<MouseEventArgs>

Remarks

Requires Editable to be true and ReadOnly to be false.

OnPreviewEditClick

Occurs before inline editing is enabled for a row.

[Parameter]
public EventCallback<object?> OnPreviewEditClick { get; set; }

Property Value

EventCallback<object>

Remarks

Requires Editable to be true and ReadOnly to be false.

Outlined

Shows borders around the table.

[Parameter]
[Category("Appearance")]
public bool Outlined { get; set; }

Property Value

bool

Remarks

Defaults to true.

OverscanCount

The number of additional items to render outside of view when Virtualize is true.

[Parameter]
[Category("Behavior")]
public int OverscanCount { get; set; }

Property Value

int

Remarks

Defaults to 3. Can reduce the frequency of rendering during scrolling, but higher values can reduce performance.

PagerContent

The custom pagination content for this table.

[Parameter]
[Category("Pagination")]
public RenderFragment? PagerContent { get; set; }

Property Value

RenderFragment

Remarks

Add a MudTablePager here to navigate multiple pages of data.

ReadOnly

Prevents rows from being edited inline.

[Parameter]
[Category("Editing")]
public bool ReadOnly { get; set; }

Property Value

bool

Remarks

Defaults to false.

RowClass

The CSS classes applied to each row.

[Parameter]
[Category("Rows")]
public string? RowClass { get; set; }

Property Value

string

Remarks

Multiple classes must be separated by spaces. Some CSS classes will be overridden by MudTd.

RowEditCancel

Occurs when changed are canceled for a row being edited.

[Parameter]
[Category("Editing")]
public Action<object?>? RowEditCancel { get; set; }

Property Value

Action<object>

RowEditCommit

Occurs when changes are committed for an row being edited.

[Parameter]
[Category("Editing")]
public Action<object?>? RowEditCommit { get; set; }

Property Value

Action<object>

RowEditPreview

Occurs before inline editing begins for a row.

[Parameter]
[Category("Editing")]
public Action<object?>? RowEditPreview { get; set; }

Property Value

Action<object>

RowStyle

The CSS styles applied to each row.

[Parameter]
[Category("Rows")]
public string? RowStyle { get; set; }

Property Value

string

Remarks

Some CSS styles will be overridden by MudTd.

RowsPerPage

The maximum rows to display per page.

[Parameter]
[Category("Pagination")]
public int RowsPerPage { get; set; }

Property Value

int

Remarks

Defaults to null. When set, rows beyond this number will overflow into separate pages. Requires a MudTablePager in the PagerContent.

RowsPerPageChanged

Occurs when RowsPerPage has changed.

[Parameter]
public EventCallback<int> RowsPerPageChanged { get; set; }

Property Value

EventCallback<int>

SelectOnRowClick

Toggles the checkbox when a row is clicked.

[Parameter]
[Category("Rows")]
public bool SelectOnRowClick { get; set; }

Property Value

bool

Remarks

Defaults to true. Requires MultiSelection to be true, SelectionChangeable to be true and Editable to be false.

SelectionChangeable

Disables the selection of rows but keep showing the selected rows.

[Parameter]
[Category("Selecting")]
public bool SelectionChangeable { get; set; }

Property Value

bool

Remarks

Defaults to true. Requires MultiSelection to be true and Editable to be false.

SortLabel

The sort label shown when this table is in small-device mode and is sorting by a column.

[Parameter]
[Category("Sorting")]
public string? SortLabel { get; set; }

Property Value

string

Remarks

Defaults to null.

Square

Uses square corners for the table.

[Parameter]
[Category("Appearance")]
public bool Square { get; set; }

Property Value

bool

Remarks

Defaults to false. Can be overridden by Rounded.

Striped

Uses alternating colors for table rows.

[Parameter]
[Category("Appearance")]
public bool Striped { get; set; }

Property Value

bool

Remarks

Defaults to false.

TableContainerClass

protected string TableContainerClass { get; }

Property Value

string

TableContainerStyle

protected string TableContainerStyle { get; }

Property Value

string

TableContext

The current state of this table.

public abstract TableContext TableContext { get; }

Property Value

TableContext

Remarks

Typically used to interact with other components such as MudTablePager.

ToolBarContent

The custom content for the toolbar.

[Parameter]
[Category("Behavior")]
public RenderFragment? ToolBarContent { get; set; }

Property Value

RenderFragment

TotalItems

The total number of rows (excluding pages) when using ServerData for data.

[Parameter]
[Category("Data")]
public int TotalItems { get; set; }

Property Value

int

Validator

The validator for this table.

public IForm Validator { get; set; }

Property Value

IForm

Remarks

Defaults to a new TableRowValidator.

Virtualize

Uses virtualization to display large amounts of items efficiently.

[Parameter]
[Category("Behavior")]
public bool Virtualize { get; set; }

Property Value

bool

Remarks

Defaults to false. Typically used for more than 1000 items.

Methods

ContainsItem(object?)

Gets whether the specified item exists.

public abstract bool ContainsItem(object? item)

Parameters

item object

The item to find.

Returns

bool

GetFilteredItemsCount()

Gets the number of items after applying filters.

public abstract int GetFilteredItemsCount()

Returns

int

The number of filtered items.

NavigateTo(Page)

Changes the current page.

public void NavigateTo(Page page)

Parameters

page Page

The Next, Previous, First, or Last page to navigate to.

NavigateTo(int)

Navigates to the specified page.

public void NavigateTo(int pageIndex)

Parameters

pageIndex int

The index of the page to navigate to.

OnAfterRenderAsync(bool)

protected override Task OnAfterRenderAsync(bool firstRender)

Parameters

firstRender bool

Returns

Task

SetEditingItem(object?)

Changes the item being edited.

public abstract void SetEditingItem(object? item)

Parameters

item object

The new item to edit.

SetRowsPerPage(int)

Changes the rows per page to the specified value.

public void SetRowsPerPage(int size)

Parameters

size int

The number of rows per page.

SetSelectedItem(object?)

Changes the currently selected item.

public abstract void SetSelectedItem(object? item)

Parameters

item object

The new item to select.

UpdateSelection()

Refreshes the table's current selection.

public abstract void UpdateSelection()