Data
TwTable
TwTable is a Blazor table component with striped, hoverable, bordered and borderless styles, plus manual pagination.
Last updated
Basic table
A simple table component with customizable styling.
| Product name | Color | Category | Price |
|---|---|---|---|
| Apple MacBook Pro 17" | Silver | Laptop | £2999 |
| Microsoft Surface Pro | White | Laptop PC | £1999 |
| Magic Mouse 2 | Black | Accessories | £99 |
Striped table
Table with alternating row colors for better readability.
| Name | Department | Role |
|---|---|---|
| John Doe | Engineering | Developer |
| Jane Smith | Product | Designer |
| Bob Johnson | Operations | Manager |
Hoverable table
Table with hover effects on rows.
| Task | Status | Priority |
|---|---|---|
| Design homepage | In Progress | High |
| Write documentation | Completed | Medium |
| Fix bugs | Pending | High |
Bordered table
Table with a hairline divider between rows, for extra structure without a busy grid look.
| Country | Capital | Population |
|---|---|---|
| United States | Washington, D.C. | 331 million |
| United Kingdom | London | 67 million |
| Germany | Berlin | 83 million |
Table without border
Table with no outer border.
| Country | Capital | Population |
|---|---|---|
| United States | Washington, D.C. | 331 million |
| United Kingdom | London | 67 million |
| Germany | Berlin | 83 million |
Column widths
Add a
ColumnGroup of TwTableColumn elements to size the columns. A column with a Width never goes narrower than it, so a long description in one column cannot squeeze a short name or a code value in another. Columns without a width share the space that is left. Width takes any CSS length and needs no Tailwind class, and Span lets one definition cover several columns.
| Command | What it does |
|---|---|
dotnet add package twblazor |
Adds the component library to your project, along with the default theme and the scripts the interactive components need. |
dotnet build |
Builds the project and runs the Tailwind build, so every class the theme uses is compiled into your stylesheet. |
Fixed layout
By default the browser sizes each column from its content. Set
FixedLayout and the widths come from the column group and the header row instead, so the columns stay put however long the content in a row is. This suits tables whose rows change as you page or filter them. Long content wraps inside its column.
| Owner | Due | Notes |
|---|---|---|
| Jane Smith | 14/11/2026 | Write the onboarding guide for new starters, covering accounts, equipment and the first week. |
| Bob Johnson | 21/11/2026 | Review supplier contracts. |
Scrolling with a sticky header
Set
MaxHeight to any CSS length and the rows scroll inside the table once it is that tall. Add StickyHeader to keep the column headings in view while they scroll. The scroll area is a Tab stop, so the rows can be scrolled with the arrow keys too.
| Month | Orders | Revenue |
|---|---|---|
| January | 412 | £18,240 |
| February | 389 | £17,115 |
| March | 455 | £20,380 |
| April | 431 | £19,020 |
| May | 478 | £21,660 |
| June | 502 | £23,010 |
| July | 466 | £20,940 |
| August | 441 | £19,580 |
| September | 497 | £22,430 |
| October | 523 | £24,105 |
| November | 610 | £28,870 |
| December | 688 | £33,215 |
Row groups
Use
RowGroups in place of TableBody to split the rows into groups, each in its own <tbody>. The context is the body's classes, so put it on every <tbody> and the groups keep the striped, hoverable and bordered styles. Start each group with a header cell that has scope="rowgroup", and screen readers announce the group's name with every row in it.
| Name | Role |
|---|---|
| Engineering | |
| John Doe | Developer |
| Alice Williams | Developer |
| Product | |
| Jane Smith | Designer |
Typed rows
Put a
TwTableRows in TableBody, give it your rows with Items, and write one row in it. The context is the row's item, so the row is typed. On its own it renders every row, and it is what lets the table page or virtualize them, below.
| Product name | Category | Price |
|---|---|---|
| Apple MacBook Pro 17" | Laptop | £2,999 |
| Microsoft Surface Pro | Laptop | £1,999 |
| Magic Mouse 2 | Accessories | £99 |
| Apple Watch Series 9 | Wearables | £499 |
Pagination
Set
EnablePagination and the table splits its TwTableRows into pages, with a pagination below it. Pagination is off by default. PageSize sets the rows on a page and PageSizeOptions the sizes people can pick; bind @bind-CurrentPage to follow or set the page. If the rows shrink under the current page, as after a search, the table moves back to the last page and raises CurrentPageChanged.
| Product name | Category | Price |
|---|---|---|
| Apple MacBook Pro 17" | Laptop | £2,999 |
| Microsoft Surface Pro | Laptop | £1,999 |
| Magic Mouse 2 | Accessories | £99 |
Page 1
Virtualization
Set
EnableVirtualization and only the rows scrolled into view are rendered, so the table stays fast with tens of thousands of rows. It is off by default. The rows scroll inside the table, which is 32rem tall unless you set MaxHeight, and the header stays in view. Keep each row to one line, about ItemSize pixels tall. Write the row in RowTemplate and put its AriaRowIndex on the <tr>: the table then tells screen readers how many rows there are and where each one sits, so they still read "row 5000 of 10000".
| Reading | Sensor | Temperature |
|---|
Loading rows from a server
For data too big to load at once, give
TwTableRows an ItemsProvider in place of Items. With pagination it is asked for one page at a time, with virtualization for the rows scrolling into view, and otherwise for every row. It returns the rows and the total count, and receives a cancellation token that is cancelled when a newer request replaces it. While rows load the table is marked busy and shows LoadingContent. Call RefreshDataAsync on the rows after the data changes elsewhere.
| Reading | Sensor | Temperature |
|---|---|---|
| Loading readings… | ||
Resizable columns
Set
ResizableColumns and define the columns with TwTableColumn. Each column then has a separator on the border at the end of its header: drag it, or focus it with Tab and press Arrow Left or Arrow Right, holding Shift for bigger steps. Screen readers hear each separator as "Resize Name" with the column's width. Give each column a Label to name its separator, MinWidth and MaxWidth to limit it, and Resizable="false" to keep it at its width. Resizing turns on FixedLayout, gives every column its current width in pixels so the others stay put, and raises ColumnsResized and each column's WidthChanged.
| Product name | Category | Price |
|---|---|---|
| Apple MacBook Pro 17" | Laptop | £2,999 |
| Microsoft Surface Pro | Laptop | £1,999 |
| Magic Mouse 2 | Accessories | £99 |
| Apple Watch Series 9 | Wearables | £499 |
Resize a column to see its new width.
Theme configuration
Styling is controlled by
TwBlazorTheme.Components (a TwTableTheme), configured via the
AddTwBlazor() options callback described on the Get Started page.
Every property is a set of Tailwind classes, so changes are picked up by your own Tailwind build.
Inherited from TwTable - this component reuses that theme rather than defining its own.
| Property | Type | Controls |
|---|---|---|
Wrapper |
string | |
ContainerClip |
string | |
Base |
string | |
Bordered |
string | |
FixedLayout |
string | |
Header |
string | |
StickyHeader |
string | |
Body |
string | |
BodyStriped |
string | |
BodyHoverable |
string | |
RowDivider |
string | |
Footer |
string | |
SearchColumn |
string | |
SortIcon |
string | |
HeaderCellPadding |
string | |
BodyCellPadding |
string | |
EmptyState |
string | |
ResizeHandle |
string | |
GroupByColumn |
string | |
GroupRow |
string | |
GroupToggle |
string | |
GroupCount |
string | |
LoadingCell |
string | |
ActionsCell |
string | |
EditingRow |
string | |
FilterPanel |
string | |
FilterHeading |
string |
Full reference: TwTableTheme on the API docs.