BOBDataGrid
Strongly-typed tabular data with sorting, filtering, pagination, selection, custom templates, and more — declaratively.
API reference ↗Basic usage
Bind Items and declare BOBDataColumn elements inside Columns.
5 rows.
| ID | Name | Age | |
|---|---|---|---|
| 1 | Alice Johnson | [email protected] | 29 |
| 2 | Marcus Chen | [email protected] | 34 |
| 3 | Priya Patel | [email protected] | 41 |
| 4 | Diego Martinez | [email protected] | 26 |
| 5 | Hana Nakamura | [email protected] | 38 |
RAZOR
<BOBDataGrid Items="_people">
<Columns>
<BOBDataColumn TItem="Person" Property="@(p => p.Id)" Header="ID" />
<BOBDataColumn TItem="Person" Property="@(p => p.Name)" Header="Name" />
<BOBDataColumn TItem="Person" Property="@(p => p.Email)" Header="Email" />
<BOBDataColumn TItem="Person" Property="@(p => p.Age)" Header="Age" />
</Columns>
</BOBDataGrid>Sortable
Enable Sortable on the grid and on the columns you want clickable.
5 rows.
| 1 | Alice Johnson | [email protected] | 29 |
| 2 | Marcus Chen | [email protected] | 34 |
| 3 | Priya Patel | [email protected] | 41 |
| 4 | Diego Martinez | [email protected] | 26 |
| 5 | Hana Nakamura | [email protected] | 38 |
RAZOR
<BOBDataGrid Items="_people" Sortable="true">
<Columns>
<BOBDataColumn TItem="Person" Property="@(p => p.Id)" Header="ID" Sortable="true" />
<BOBDataColumn TItem="Person" Property="@(p => p.Name)" Header="Name" Sortable="true" />
<BOBDataColumn TItem="Person" Property="@(p => p.Email)" Header="Email" />
<BOBDataColumn TItem="Person" Property="@(p => p.Age)" Header="Age" Sortable="true" />
</Columns>
</BOBDataGrid>Filter + pagination
35 rows. Page 1 of 4.
| ID | Name | Age | |
|---|---|---|---|
| 1 | Person 01 | [email protected] | 21 |
| 2 | Person 02 | [email protected] | 22 |
| 3 | Person 03 | [email protected] | 23 |
| 4 | Person 04 | [email protected] | 24 |
| 5 | Person 05 | [email protected] | 25 |
| 6 | Person 06 | [email protected] | 26 |
| 7 | Person 07 | [email protected] | 27 |
| 8 | Person 08 | [email protected] | 28 |
| 9 | Person 09 | [email protected] | 29 |
| 10 | Person 10 | [email protected] | 30 |
Showing 1 to 10 of 35
RAZOR
<BOBDataGrid Items="_big"
Filterable="true"
FilterPlaceholder="Search..."
PageSize="10"
ShowPageSizeSelector="true"
PageSizeOptions="@(new[] { 5, 10, 25 })">
<Columns>
<BOBDataColumn TItem="Person" Property="@(p => p.Id)" Header="ID" Filterable="true" />
<BOBDataColumn TItem="Person" Property="@(p => p.Name)" Header="Name" Filterable="true" />
<BOBDataColumn TItem="Person" Property="@(p => p.Email)" Header="Email" Filterable="true" />
<BOBDataColumn TItem="Person" Property="@(p => p.Age)" Header="Age" Filterable="true" />
</Columns>
</BOBDataGrid>Multiple selection
5 rows.
| Name | Age | ||
|---|---|---|---|
| Alice Johnson | [email protected] | 29 | |
| Marcus Chen | [email protected] | 34 | |
| Priya Patel | [email protected] | 41 | |
| Diego Martinez | [email protected] | 26 | |
| Hana Nakamura | [email protected] | 38 |
RAZOR
<BOBDataGrid TItem="Person"
Items="_people"
SelectionMode="SelectionMode.Multiple"
SelectedItems="_selected"
SelectedItemsChanged="@(s => { _selected = s; StateHasChanged(); })">
<Columns>
<BOBDataColumn TItem="Person" Property="@(p => p.Name)" Header="Name" />
<BOBDataColumn TItem="Person" Property="@(p => p.Email)" Header="Email" />
<BOBDataColumn TItem="Person" Property="@(p => p.Age)" Header="Age" />
</Columns>
</BOBDataGrid>Custom templates
Use Template with context to render any markup inside a cell.
5 rows.
| Person | Age |
|---|---|
| Alice Johnson | 29 |
| Marcus Chen | 34 |
| Priya Patel | 41 |
| Diego Martinez | 26 |
| Hana Nakamura | 38 |
RAZOR
<BOBDataGrid Items="_people">
<Columns>
<BOBDataColumn TItem="Person" Header="Person">
<Template>
<strong>@context.Name</strong>
<div style="font-size: 0.85em; opacity: 0.7;">@context.Email</div>
</Template>
</BOBDataColumn>
<BOBDataColumn TItem="Person" Property="@(p => p.Age)" Header="Age" Align="ColumnAlign.Right" />
</Columns>
</BOBDataGrid>Alignment & width
5 rows.
| Name (left) | Email (center) | Age (right) |
|---|---|---|
| Alice Johnson | [email protected] | 29 |
| Marcus Chen | [email protected] | 34 |
| Priya Patel | [email protected] | 41 |
| Diego Martinez | [email protected] | 26 |
| Hana Nakamura | [email protected] | 38 |
RAZOR
<BOBDataGrid Items="_people">
<Columns>
<BOBDataColumn TItem="Person" Property="@(p => p.Name)" Header="Name (left)" Align="ColumnAlign.Left" Width="200px" />
<BOBDataColumn TItem="Person" Property="@(p => p.Email)" Header="Email (center)" Align="ColumnAlign.Center" />
<BOBDataColumn TItem="Person" Property="@(p => p.Age)" Header="Age (right)" Align="ColumnAlign.Right" Width="80px" />
</Columns>
</BOBDataGrid>Shadow & Border
5 rows.
| Name | Age |
|---|---|
| Alice Johnson | 29 |
| Marcus Chen | 34 |
| Priya Patel | 41 |
| Diego Martinez | 26 |
| Hana Nakamura | 38 |
5 rows.
| Name | Age |
|---|---|
| Alice Johnson | 29 |
| Marcus Chen | 34 |
| Priya Patel | 41 |
| Diego Martinez | 26 |
| Hana Nakamura | 38 |
RAZOR
<BOBDataGrid Items="_people" Shadow="@BOBShadowPresets.Elevation(3)">
<Columns>
<BOBDataColumn TItem="Person" Property="@(p => p.Name)" Header="Name" />
<BOBDataColumn TItem="Person" Property="@(p => p.Age)" Header="Age" />
</Columns>
</BOBDataGrid>
<BOBDataGrid Items="_people" Border="@BOBBorderPresets.RoundedLarge">
<Columns>
<BOBDataColumn TItem="Person" Property="@(p => p.Name)" Header="Name" />
<BOBDataColumn TItem="Person" Property="@(p => p.Age)" Header="Age" />
</Columns>
</BOBDataGrid>Properties
37 rows.
| Property | Type | Default | Description |
|---|---|---|---|
FixedHeader | bool | | When , the header row stays fixed while scrolling. |
RowTemplate | RenderFragment<TItem>? | | Custom template for rendering each data row. |
FooterTemplate | RenderFragment? | | Custom template rendered inside the table footer. |
CellBorder | BorderStyle? | | Border style applied to individual cells. |
RowBorder | BorderStyle? | | Border style applied to rows. |
Columns | RenderFragment? | | Column definitions rendered inside the data collection. |
Items | IEnumerable<TItem>? | | Data items to display. |
Density | BOBDensity | BOBDensity.Standard | Vertical density (gap) of rows. |
Size | BOBSize | BOBSize.Medium | Visual size of the data collection. |
Hoverable | Boolean | true | When true (default), rows highlight on hover. |
Shadow | ShadowStyle? | | Shadow style applied to the container. |
SelectionMode | SelectionMode | SelectionMode.None | Row selection mode. |
SelectedItems | HashSet<TItem>? | | Currently selected items. Use with two-way binding. |
SelectedItemsChanged | EventCallback<HashSet<TItem>> | | Raised when the selection changes. |
Sortable | Boolean | | When true, column headers are clickable for sorting. |
DefaultSortColumn | String? | | Name of the column to sort by on initial render. |
DefaultSortDirection | SortDirection? | | Initial sort direction. Defaults to Ascending. |
Filterable | Boolean | | When true, a search box filters the displayed items. |
FilterPlaceholder | String | "Search..." | Placeholder text for the filter search box. |
CustomFilter | Func<TItem, String, Boolean>? | | Custom predicate used to filter items. Receives the item and the search text. |
PageSize | Int32? | | Number of items per page. When null, pagination is disabled. |
PageSizeOptions | Int32[] | [10, 20, 50, 100] | Available page sizes shown in the page-size selector. |
ShowPageSizeSelector | Boolean | | When true, a dropdown lets the user change the page size. |
EnableVirtualization | Boolean | | When true, only visible rows are rendered (improves performance for large lists). |
Height | String? | | Fixed height of the container. Required for virtualization and fixed header. |
EmptyContent | RenderFragment? | | Custom template rendered when there are no items to display. |
LoadingContent | RenderFragment? | | Custom template rendered while Loading is true. |
Loading | Boolean | | When true, the loading template is shown. |
Border | BorderStyle? | | Border style applied to the container. |
BackgroundColor | String? | | Background color of the container. Accepts any valid CSS color value. |
ItemPattern | RowStylePattern? | | Alternating row style pattern (e.g. zebra striping). |
OnRowClick | EventCallback<TItem> | | Raised when a row is clicked and SelectionMode is not active. |
OnSort | EventCallback<DataCollectionSortEventArgs> | | Raised when the sort column or direction changes. |
OnFilter | EventCallback<DataCollectionFilterEventArgs> | | Raised when the filter text changes. |
OnPageChange | EventCallback<DataCollectionPageChangeEventArgs> | | Raised when the current page changes. |
Variant | TVariant? | | |
AdditionalAttributes | IReadOnlyDictionary<String, Object>? | |