Examples
PropertyColumn binds a member by expression, is sortable by default and takes an optional Format string. Click a header to sort.
| Northwind Traders | Enterprise | 240 | 4,890.00 € |
| Contoso | Pro | 58 | 1,131.00 € |
| Fabrikam | Pro | 32 | 624.00 € |
| Globex | Enterprise | 410 | 7,995.00 € |
| Initech | Free | 5 | 0.00 € |
TemplateColumn renders any markup per row through context.Item; pass SortBy to make it sortable.
| Task | ||
|---|---|---|
AS Add SSO to the login page
Ana Silva | 19.0 | Done |
TB Fix invoice PDF totals
Tom Becker | 7.0 | Done |
PN Migrate staging to .NET 10
Priya Nair | 13.0 | Review |
LM Export reports to CSV
Lucas Martin | 0.0 | Todo |
Put a DataGridPager in PagerContent and set RowsPerPage; RowClick hands you the clicked item.
| #ORD-1021 | Contoso | 10 |
| #ORD-1022 | Fabrikam | 15 |
| #ORD-1023 | Globex | 20 |
| #ORD-1024 | Initech | 25 |
Selected: click a row
Dense, Striped, Bordered and Hover map to daisyUI table modifiers; Loading swaps the body for skeleton rows.
| Free | 48,200 | 41 % |
| Pro | 39,900 | 34 % |
| Team | 21,100 | 18 % |
| Enterprise | 8,300 | 7 % |
ServerDataFunc receives the page and sort state and returns only that page plus the total count.
No records found | ||
API
<DataGrid<T>>
DaisyBlazor.DatadaisyUI replacement for MudDataGrid<T>. Renders a .table with a sortable header and a paged body. Supports client-side paging/sort over Items or server-side data via ServerData / ServerDataFunc.
Parameters
- Bordered bool= false
Render outer/inner borders.
- Dense bool= false
Compact row styling.
- Elevation int= 0
Elevation (accepted for MudBlazor parity; mapped to a shadow class).
- EmptyText string= "No records found"
Text shown in the built-in empty state when there are no rows and no NoRecordsContent.
- Hover bool= false
Highlight rows on hover.
- Items IEnumerable<
T> = nullLocal item source. Mutually exclusive with the server-data callbacks.
- Loading bool= false
Loading state (shows LoadingContent when set, else skeleton rows).
- PageSize int?= null
Alias for RowsPerPage.
- PageSizeOptions int[]= [10, 25, 50]
Page-size options offered by the pager.
- ReadOnly bool= false
Read-only flag (accepted for MudBlazor parity; no effect on rendering).
- RowStyle string= null
Inline style applied to each body row (e.g. "cursor: pointer;").
- RowsPerPage int= 10
Rows per page. PageSize is an alias.
- ServerData Func<
GridState< T>, CancellationToken, Task< GridData< T>>> = nullServer-data loader (with cancellation). Mirrors the wrapper's signature.
- ServerDataFunc Func<
GridState< T>, Task< GridData< T>>> = nullServer-data loader (no cancellation token).
- SkeletonRows int= 5
Number of skeleton rows rendered while loading without a LoadingContent.
- Striped bool= false
Zebra striping.
- Class string= null
CSS class applied to the table wrapper.
- Style string= null
Inline style applied to the table wrapper.
Events
- RowClick EventCallback<
DataGridRowClickEventArgs< T>> Raised when a row is clicked.
- RowsPerPageChanged EventCallback<
int> Raised when the pager changes the page size (enables @bind-RowsPerPage).
Content
- ChildContent RenderFragment
Alternative slot for column declarations.
- Columns RenderFragment
Column declarations.
- LoadingContent RenderFragment
Content shown while Loading is true.
- NoRecordsContent RenderFragment
Content shown when there are no rows.
- PagerContent RenderFragment
Pager content (typically a DataGridPager<T>).
<PropertyColumn<T, TProperty>>
DaisyBlazor.DataA column bound to a member of the row type via an expression. Mirrors MudBlazor's PropertyColumn<T, TProperty>. Renders the (optionally formatted) member value.
Parameters
- CellClass string= null
Optional CSS class applied to every body cell in this column.
- Format string= null
Standard/custom format string applied to the value (e.g. "dd/MM/yyyy").
- HeaderClass string= null
Optional CSS class applied to the header cell.
- Property Expression<
Func< T, TProperty>> = requiredExpression selecting the member to display/sort.
- SortBy Func<
T, object> = nullOptional explicit sort selector (overrides Property for sorting).
- Sortable bool= true
Whether the column is sortable.
- Title string= null
Column header text.
<TemplateColumn<T>>
DaisyBlazor.DataA column whose cell content is supplied by an arbitrary template. Mirrors MudBlazor's TemplateColumn<T>. Not sortable by default; supply SortBy to enable sorting.
Parameters
- CellClass string= null
Optional CSS class applied to every body cell in this column.
- HeaderClass string= null
Optional CSS class applied to the header cell.
- SortBy Func<
T, object> = nullOptional sort selector. When set (and Sortable), the column becomes sortable.
- Sortable bool= false
Whether the column is sortable.
- Title string= null
Column header text.
Content
- CellTemplate RenderFragment<
CellContext< T>> Cell template receiving a CellContext<T> (access the row via context.Item).
- ChildContent RenderFragment<
CellContext< T>> Alias for CellTemplate when content is provided as the column's body.
<DataGridPager<T>>
DaisyBlazor.DataParameters
- InfoSeparatorText string= null
Separator word in the range text (e.g. "of"). Null uses the app-wide Strings.
- NextPageText string= null
Accessible label for the next-page navigation button. Null uses the app-wide Strings.
- PageSizeOptions int[]= null
Page-size options. When set, mirrored onto the grid.
- PreviousPageText string= null
Accessible label for the previous-page navigation button. Null uses the app-wide Strings.
- RowsPerPageText string= null
Label shown before the page-size select. Null uses the app-wide Strings.
- Class string= null
Extra CSS classes added to the pager bar.
- Style string= null
Inline CSS style applied to the pager bar.