
Table Bro is a JavaScript data table Web Component for building sortable, searchable tables with animated pagination and expandable rows.
It supports local and server-side data and includes skins for native HTML, Bootstrap, Angular Material, React MUI, Solid SUID, Svelte M3, and Vue Vuetify.
Features
- Automatic column sizing with CSS width overrides.
- Single-line cells with ellipsis truncation and full-text tooltips.
- Animated transitions when changing page size.
- Custom cell content through Web Components.
- A configurable toolbar and side filter drawer.
- Asynchronous loading of row details.
- Animated loading, refreshing, empty, and error states.
- Automatic, light, and dark themes.
- Customizable UI text and keyboard-accessible controls.
- Server-side prerendering of the loading state.
How To Use It
Installation
Load the core and native skin assets in order.
Choose one vanilla skin per page. The native and Bootstrap skins share custom element names.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@table-bro/core/dist/table-bro.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@table-bro/native/dist/table-bro.native.min.css"> <script src="https://cdn.jsdelivr.net/npm/@table-bro/core/dist/table-bro.umd.js"></script> <script src="https://cdn.jsdelivr.net/npm/@table-bro/native/dist/table-bro.native.umd.js"></script>
For a project with a bundler, install both packages:
npm install @table-bro/core @table-bro/native
import '@table-bro/core/dist/table-bro.min.css'; import '@table-bro/native/dist/table-bro.native.min.css'; import '@table-bro/core'; import '@table-bro/native';
Basic Usage
Add <table-bro> to your page. Set name to the row field you want to display and sortKey to the field you want to sort by.
<table-bro id="inventory"></table-bro>
const table = document.querySelector('#inventory');
const cols = [
{ title: 'Product', name: 'product', sortKey: 'product' },
{ title: 'Stock', name: 'stock', sortKey: 'stock', dataType: 'number', className: 'bro-col_text-right' },
{ title: 'Category', name: 'category', sortKey: 'category' }
];
const rows = [
{ product: 'Desk lamp', stock: 24, category: 'Lighting' },
{ product: 'Monitor arm', stock: 8, category: 'Accessories' },
{ product: 'Task chair', stock: 12, category: 'Furniture' },
{ product: 'USB hub', stock: 40, category: 'Accessories' },
{ product: 'Floor lamp', stock: 5, category: 'Lighting' },
{ product: 'Standing desk', stock: 3, category: 'Furniture' }
];
const conf = { skin: 'nv', toolbarTitle: 'Inventory', pageSize: 5 };
table.configure({ cols, rows, conf });
Add Custom Cells
The examples below reuse the variables from Basic Usage and run independently. They use the CDN globals. For npm projects, import the corresponding functions from @table-bro/core or @table-bro/native.
Register the native tag and switch components before configuring the table. Custom cells receive col and row; component.event forwards their actions.
TableBroNative.withTags();
TableBroNative.withSwitch();
const productCols = [
{ title: 'Product', name: 'product' },
{ title: 'Tags', name: 'tags', component: 'bro-nv-tags' },
{
title: 'Available', name: 'available', dataType: 'boolean',
component: {
selector: 'bro-switch',
attrs: { name: 'availability', checked: (col, row) => row.available },
event: 'action'
}
}
];
table.configure({
cols: productCols,
rows: [{ product: 'Desk lamp', tags: ['LED', 'USB'], available: true }],
conf
});
table.addEventListener('bro-action', ({ detail }) => {
if (detail.action === 'availability') {
console.log(detail.data.row.product);
}
});
Expand Rows to Show Details
Create a custom element for the expanded content. The table assigns its row property when the panel opens.
class InventoryDetails extends HTMLElement {
connectedCallback() {
const row = this.row;
if (row) this.textContent = `${row.product}: ${row.stock} units in ${row.category}.`;
}
set row(value) {
this.record = value;
if (this.isConnected) this.connectedCallback();
}
get row() { return this.record; }
}
customElements.define('bro-cell-inventory-details', InventoryDetails);
table.configure({
cols: [...cols, {
title: '',
component: {
selector: 'bro-details-button',
attrs: { title: 'Details', name: TableBro.events.detailsToggleEvent },
event: 'action'
}
}],
rows,
conf: { ...conf, rowDetailsComponent: 'bro-cell-inventory-details' }
});
For remote content, set rowDetailsServer: true. The detail component receives server="true". Dispatch a CustomEvent('bro-details-server-loaded', { detail: 1 }) from that component after rendering the fetched content.
Filter Rows With Custom Controls
Use filtersTransform to filter the rows remaining after the toolbar search. This example adds a minimum stock field. Clear a filter with undefined, null, or an empty string. Zero and false are valid values.
<label for="min-stock">Minimum stock</label> <input id="min-stock" type="number" min="0" placeholder="Any">
const { dispatchAction, events, matchesFilterCondition } = TableBro;
table.configure({
cols, rows,
conf: {
...conf,
filtersTransform: (items, filters) => items.filter(item =>
matchesFilterCondition(item.stock, { gte: filters.minStock })
)
}
});
document.querySelector('#min-stock').addEventListener('input', (event) => {
const value = event.target.value;
dispatchAction(table, events.filtersFilterEvent, {
minStock: value === '' ? undefined : Number(value)
});
});
Add a Filter Drawer
Place your filter controls in the drawer container’s filters slot. Add a toolbar button that sends filtersToggleEvent to open or close the drawer.
<table-bro-filter-drawer-container id="inventory-drawer" skin="nv">
<table-bro id="inventory-filtered"></table-bro>
<div slot="filters">
<label for="category-filter">Category</label>
<select id="category-filter">
<option value="">All categories</option>
<option value="Lighting">Lighting</option>
<option value="Accessories">Accessories</option>
<option value="Furniture">Furniture</option>
</select>
</div>
</table-bro-filter-drawer-container>
TableBro.defineTableBroFilterDrawerContainer();
const filtered = document.querySelector('#inventory-filtered');
filtered.configure({
cols, rows,
conf: {
...conf,
components: {
toolbarMain: {
buttons: [{ buttonTitle: 'Filters', eventType: TableBro.events.filtersToggleEvent }]
}
},
filtersTransform: (items, filters) => items.filter(item =>
!filters.category || item.category === filters.category
)
}
});
document.querySelector('#category-filter').addEventListener('change', (event) => {
TableBro.dispatchAction(filtered, TableBro.events.filtersFilterEvent, {
category: event.target.value || undefined
});
});
Load Data From a Server
Set server: true to delegate search, filtering, and sorting to your backend. Load the first page yourself, then handle bro-filters-server-loaded to fetch more records.
Implement /api/inventory/query as a POST endpoint. Accept page, pageSize, filter, and sort; return { rows, total }.
For this example, return records from the start of the sorted result through the requested page, with total equal to the full matching count. Keep the order stable and validate sort fields and filter values on the server.
The example fixes the page size at 10. It replaces rows when the filter or sort changes and appends missing records when you request an unloaded page, including skipped pages.
const pageSize = 10;
table.configure({
cols,
conf: { ...conf, server: true, pageSize, pageSizeOptions: [pageSize] }
});
let activeRequest;
let loadedKey = null;
let loadedCount = 0;
async function loadPage(query) {
activeRequest?.abort();
const request = new AbortController();
activeRequest = request;
const key = JSON.stringify([query.filter, query.sort]);
try {
const response = await fetch('/api/inventory/query', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(query),
signal: request.signal
});
if (!response.ok) throw new Error('Request failed');
const result = await response.json();
if (activeRequest !== request) return;
if (key !== loadedKey || query.page === 1 || loadedCount === 0) {
table.replaceRows(result.rows, {
total: result.total,
emptyState: Object.values(query.filter ?? {}).some(
value => value !== undefined && value !== null && value !== ''
) ? 'not-found' : 'no-data'
});
loadedKey = key;
} else {
table.appendRows(result.rows.slice(loadedCount), { total: result.total });
}
loadedCount = result.rows.length;
} catch (error) {
if (activeRequest === request && error.name !== 'AbortError') {
loadedKey = null;
loadedCount = 0;
table.setState('fail');
}
}
}
table.addEventListener('bro-action', ({ detail }) => {
if (detail.action === TableBro.events.filtersServerLoadedEvent) {
loadPage(detail.data);
}
});
loadPage({ page: 1, pageSize });
Query and Filter Reference
| Field | Description |
|---|---|
page | One-based page number. |
pageSize | Number of requested rows. |
filter | Optional copy of active filters, including search. |
sort | Optional sort object with keys (field names mapped to { direction: 'asc' or 'desc' }) and optional order (sort priority). |
A filter field accepts a scalar, an array of matching values, or a condition object. search is a string or null. The optional advancedFilters array contains groups with joiner: 'AND' or 'OR' and conditions for row fields or search.
| Filter condition | Description |
|---|---|
eq | Equals the value, including equivalent numeric strings. |
in | Equals any value in the array. |
gte | Inclusive lower bound. |
lte | Inclusive upper bound. |
contains | Case-insensitive substring match. |
startsWith | Case-insensitive prefix match. |
Configuration and API
Configuration Options
Pass these settings in conf.
skin(string): Registered skin name, such asnv,bs,mat,mui,suid,m3-svelte, orvuetify.toolbar(boolean, defaulttrue): Set tofalseto hide the toolbar.toolbarTitle(string, default''): Toolbar heading.header(boolean, defaulttrue): Set tofalseto hide the column headings; column widths and sorting remain available.rowCounter(boolean, defaulttrue): Shows the row number column.pageSize(number, default5): Rows per page.pageSizeOptions(number[], default[5, 10, 15, 20, 25, 50, 100]): Page sizes offered by the paginator, subject to the row count and current page size.autoColumnWidth(boolean, defaulttrue): Automatically measures column widths. Set tofalseto control widths with CSS.shortColumnTitle(function, default first word of the title):(col) => stringsupplies the short header text used when a column shrinks.server(boolean, defaultfalse): Delegates data operations to the application when enabled.searchDebounce(number, default100locally and400in server mode): Search delay in milliseconds.filtersTransform(function):(rows, filters) => rowsapplies custom filters in local mode.rowDetailsComponent(string): Custom element tag for expandable row details. Omit it for a table with no expandable rows.rowDetailsServer(boolean, defaultfalse): Enables asynchronous detail loading.rowDetailsIsland(boolean, defaultfalse): Enables the paid Island Details layout.rowDetailsMotion('kinetic'or'eased', default'kinetic'): Detail panel animation. The eased mode uses--bro-details-duration.rowDetailsProgressMode('indeterminate'or'determinate'): Progress indicator mode for remote details.theme('auto','light', or'dark', default'auto'): Color scheme. The element’sthemeproperty or attribute takes precedence.shadowsEnabled(boolean, defaulttrue): Enables shadows around table regions.stateAnimationEffect('alt'): Uses an alternate state icon animation with a smaller rotation.components(object): Overrides the skin’s components and their settings.css(object): Overrides the skin’s CSS classes.texts(object): Overrides UI labels and messages.styleNonce(string): CSP nonce for style elements generated for column widths.debug(boolean, defaultfalse): Logs updates, actions, and warnings.debugAnimation(boolean, defaultfalse): Slows animations to one-sixth speed and records timing information.
Column Options
| Property | Description |
|---|---|
title | Required string displayed in the column header. |
name | String identifying the row field to display. |
dataType | 'string', 'number', or 'boolean'. Numeric strings sort numerically in number columns. |
sortKey | Row field used for sorting. Text sorting is case-insensitive and numeric-aware; empty values sort last. |
sortDirection | 'asc' or 'desc' in reported sort information; setting it on a column does not establish an initial sort. |
tooltip | Header tooltip text. |
className | CSS class for header and body cells. |
colSpan | Number of columns spanned by the body cell. |
component | Custom element tag or an object with selector, attrs, and event. |
html | Boolean. Inserts the cell value as HTML. Sanitize untrusted values before using this flag or bro-table-html-cell. |
Custom Cell Configuration
| Field | Description |
|---|---|
selector | Custom element tag name. |
attrs | Attribute names mapped to strings or functions (col, row) => string, number, or boolean; undefined omits the setting. Validate untrusted URLs before assigning them to attributes such as href. |
attrs.value | Function returning the displayed value; otherwise skin elements use the row field. |
event | Cell event name to forward as a table action. |
API Methods and Properties
| Member | Description |
|---|---|
configure({ cols, rows, conf }) | Creates or rebuilds the table. cols is the column array, rows is an optional array of records, and conf specifies the skin and settings. Omitting rows starts in the loading state. |
replaceRows(rows, options?) | Replaces the data. An empty array displays an empty state. Server options: total (matching record count) and emptyState ('no-data' or 'not-found'). |
appendRows(rows, { total }) | Adds the next server page or adds rows to the local dataset. In local mode, active filters and sorting still apply. |
setState(state) | 'loading' clears rows and shows loading; 'refreshing' retains rows during loading; 'fail' clears rows and shows an error; 'idle' ends a refresh. |
theme | Reflects the theme attribute. Set to 'light', 'dark', 'auto', or null to fall back to conf.theme. |
// Refresh the table with new local records.
table.replaceRows([{ product: 'Notebook', stock: 60, category: 'Stationery' }]);
// Change the theme at runtime.
table.theme = 'dark';
Filter Drawer API
| Member | Description |
|---|---|
skin attribute | Skin name for the container. |
mode property/attribute | 'side' (default) or 'over'. Side mode overlays the table when the available width is insufficient. |
opened property/attribute | Boolean open state. |
toggle() | Opens or closes the drawer. |
texts | Deprecated override for drawer labels; use conf.texts.filterDrawer. |
Core Functions
Import these functions from @table-bro/core or access them through TableBro in the browser.
| Function | Description |
|---|---|
dispatchAction(target, action, data?) | Sends a bubbling bro-action event. |
matchesFilterCondition(value, condition) | Tests a value against a filter condition. |
registerSkin(name, config) | Registers a custom skin. |
getSkin(name) | Returns the registered skin config or undefined. |
defineTableBroFilterDrawerContainer() | Registers the generic filter drawer element. |
registerFilterDrawerProperties() | Registers the animated drawer custom properties for custom drawer implementations. |
resolveTexts(texts?) | Resolves text overrides with the English defaults. |
prerenderTableBro(element, { cols, conf }) | Renders the loading state in a server DOM. |
isPrerendered(element) | Checks whether the element contains prerendered table content. |
fitCellItems(row, signal) | Fits custom cell items on one line, hides overflow items with an ellipsis, and restores their tab order when visible. Aborting the signal ends observation. |
useIslandDetails(impl) | Registers the Island Details layout implementation. The extension package calls this during import. |
Events
table.addEventListener('bro-action', ({ detail }) => {
console.log(detail.action, detail.selector, detail.data);
});
table.addEventListener('bro-error', ({ detail }) => {
console.error(detail.code, detail.message);
});
table.addEventListener('bro-theme-change', ({ detail }) => {
console.log(detail);
});
| Event | Payload and behavior |
|---|---|
bro-action | { action, selector, data }; table controls and custom cell actions. |
bro-error | { code, message }; bubbling error with code render-failed or island-details-missing. |
bro-theme-change | Computed theme, 'light' or 'dark'. |
bro-filters-open | Drawer opened; detail is null. |
bro-filters-close | Drawer closed; detail is null. |
Listen for actions through bro-action. The following constants belong to TableBro.events (or the events module export).
| Constant | Name and data |
|---|---|
actionEvent | bro-action: action envelope. |
toolbarEvent | bro-toolbar: toolbar event name. |
toolbarSearchOpenEvent | bro-toolbar-search-open: no data. |
toolbarSearchCloseEvent | bro-toolbar-search-close: no data. |
toolbarMoreExportEvent | bro-toolbar-more-export: export menu action, no data. Implement the export operation in your application. |
filtersFilterEvent | bro-filters-filter: filters object. |
filtersToggleEvent | bro-filters-toggle: no data. |
filtersOpenEvent | bro-filters-open: drawer notification. |
filtersCloseEvent | bro-filters-close: drawer notification. |
filtersSortEvent | bro-filters-sort: column sort information (sortKey, dataType, sortDirection). |
filtersServerLoadedEvent | bro-filters-server-loaded: BroQuery requesting data. |
columnsWidthEvent | bro-columns-width: known new width in pixels. |
detailsToggleEvent | bro-details-toggle: column and row for a custom cell, or no data for the built-in details button. |
detailsServerLoadedEvent | bro-details-server-loaded: numeric detail-loading progress, 1 at completion. |
detailsServerFailedEvent | bro-details-server-failed: detail loading failed; no data. |
paginatorPageEvent | bro-paginator-page: requested page (one-based) and page size. |
themeChangeEvent | bro-theme-change: new theme. |
errorEvent | bro-error: error code and message. |
Styling and Customization
Style the table with regular CSS selectors in the light DOM. Set sizing variables before calling configure(). For fixed column widths, set autoColumnWidth: false and assign widths through column classes. Set isolation: isolate on a parent with a background if it covers the table shadow.
#inventory {
--bro-row-height: 48px;
--bro-header-height: 48px;
--bro-corner-radius: 8px;
}
#inventory .bro-col--stock {
font-variant-numeric: tabular-nums;
}
| Class or attribute | Purpose |
|---|---|
bro-col--<key> | Header and body cells of a column. Uses name, then sortKey, then one-based position. Whitespace becomes hyphens; duplicate keys get numeric suffixes. |
bro-header-row, bro-header-cell | Header row and cells. |
bro-row, bro-cell | Body rows and cells. |
bro-sort-header | Sort control in the header. |
data-row-number | One-based number on a body row. |
bro-dark-theme, bro-light-theme | Current theme classes. |
bro-col_text-right | Right-aligns column cells when assigned through className. |
CSS Variables
| Variable | Description |
|---|---|
--bro-row-height | Body row height. |
--bro-header-height | Header height. |
--bro-shadow-size | Shadow size and drawer clearance. |
--bro-corner-radius | Table corner radius; 0 gives square corners. |
--bro-island-space-size | Gap between the table and drawer. |
--bro-table-min-width | Minimum table width before the drawer overlays it. |
--bro-filter-drawer-width | Drawer width. Set on the drawer container when styling the outer drawer. |
--bro-filter-drawer-corner-radius | Drawer corner radius. |
--bro-filter-drawer-duration | Drawer and column transition timing. |
--bro-column-width-duration | Column width transition duration. |
--bro-details-duration | Eased detail panel animation duration. |
--bro-details-easing | Eased detail panel timing function. |
--bro-kinetic-time-constant | Time constant for kinetic scrolling. |
--bro-state-icon-duration | State icon animation duration. |
--bro-state-message-duration | State message animation duration. |
--bro-refresh-overlay-opacity | Refresh fade in light mode, from 0 to 1. |
--bro-refresh-overlay-opacity-dark | Refresh fade in dark mode, from 0 to 1. |
--bro-table-body-container-z-index | Stacking level of the table body. |
Sass Customization
Compile the native skin from its Sass source to change its defaults. Add node_modules/@table-bro/native/styles and node_modules/@table-bro/core/styles/mappings/production to the Sass load paths. Use table-bro.native to generate its CSS or table-bro.native.api to access the variables and mixins. The core mixin bro-text-ellipsis-width($column-classname, $width) sets the width of a column’s component content.
@use 'table-bro.native' as native with (
$bro-table-row-height: 48px,
$bro-table-header-height: 48px
);
@include native.bro-text-ellipsis-width('.bro-col--product', 240px);
| Native skin Sass variable | Default |
|---|---|
$bro-skin | Fixed selector '.nv' |
$bro-table-width | 100% |
$bro-table-header-height, $bro-table-row-height | 40px each |
$bro-row-horizontal-padding | 1.25rem |
$bro-table-shadow-size | 48px |
$bro-island-space-size | Half the shadow size (24px) |
$bro-toolbar-height | 64px |
$bro-paginator-height | 56px |
$bro-table-min-width | 594px |
$bro-corner-radius | 12px |
$bro-filter-drawer-width | 320px |
$bro-filter-drawer-corner-radius | 16px |
$bro-scrim-color | rgba(#000, .32) |
$bro-global-progress, $bro-details-progress | 10px, 6px |
$bro-table-container-z-index, $bro-shadow-z-index | 2, -1 |
$bro-refresh-overlay-opacity, $bro-refresh-overlay-opacity-dark | .5 each |
$bro-column-width-duration | 500ms |
$bro-details-duration | 350ms |
$bro-details-easing | cubic-bezier(.37, 0, .63, 1) |
$bro-filter-drawer-duration | 400ms |
$bro-kinetic-time-constant | 280ms |
$bro-state-icon-duration | 500ms |
$bro-state-message-duration | 750ms |
$bro-state-icon-size | 28px |
$bro-state-icon-margin-right | 16px |
$bro-state-line-height | 33px |
$bro-state-message-font-size | 28px |
$bro-cell-number-width | 45px |
$bro-header-paginator-z-index | Base container z-index + 1 |
$bro-filter-drawer-scrim-z-index | Base + 2 |
$bro-filter-drawer-card-z-index | Base + 3 |
$bro-filter-drawer-content-z-index | Base + 4 |
$bro-toolbar-z-index | Base + 5 |
$bro-modal-filter-drawer-scrim-z-index | Base + 6 |
$bro-modal-filter-drawer-card-z-index | Base + 7 |
$bro-modal-filter-drawer-content-z-index | Base + 8 |
Customize Toolbar, Components, and Text
Override the skin settings in conf.components and conf.css. Nested objects are merged; arrays and functions replace the skin’s values.
const customConf = {
...conf,
components: {
toolbarMain: {
buttons: [{ buttonTitle: 'Refresh', eventType: 'inventory-refresh' }]
},
state: {
states: {
loading: ['⌛', 'Loading inventory'],
'no-data': ['📦', 'No inventory'],
'not-found': ['🔎', 'No matching products'],
fail: ['⚠', 'Unable to load inventory']
}
}
},
texts: { toolbarMain: { search: 'Find products' } }
};
table.configure({ cols, rows, conf: customConf });
| Component setting | Fields and behavior |
|---|---|
button | selector, attrs, event, beforeRender(element, value), iconSelector; configures skin buttons. |
dropdown | selector, css.button.className; controls dropdown elements. |
filterDrawer | beforeRender(closeButton); customizes the drawer close button. |
fontIcon | html(iconName) returns icon markup. |
paginator | selector, inputsAsProperties, recreateOnReplaceRows, css.ul.className, css.ul.li.className, css.ul.li.a.className; configures paginator rendering and updates. |
progressBar | selector; loading and detail progress element. |
sortHeader | selector, contentSelector, titleAsContent, beforeRender(element, value), afterRender(element, value) (may return disconnect cleanup); custom sort headers. |
state | fontIcon, lottie, lottieHTML(iconSrc), states, statesDark; state icons and messages. Each state is an icon/message pair; keys are loading, no-data, not-found, and fail. |
switch | selector, css.div.className, css.div.input.className; native/Bootstrap-style switch. |
textEllipsis | selector, afterRender(element, value) (may return disconnect cleanup); truncated cell text. |
toolbar | selector, css.nav.className, css.nav.div.className; toolbar container. |
toolbarMain | selector, beforeRender(searchButton, value), buttons, css.navbarCollapse.className, css.navbarCollapse.ul.className, css.navbarCollapse.ul.li.className, css.navbarCollapse.ul.li.a.className, css.toolbarTitle.className; toolbar controls. |
toolbarSearch | beforeRender(backButton, clearButton); search line controls. |
To use Lottie state animations, load a player and set components.state.lottie: true with lottieHTML and animation URLs in states or statesDark. Set fontIcon: false for skins that use font icons. The core package includes Material and Bootstrap animation files under dist/lottie/mat and dist/lottie/bs.
Toolbar buttons accept buttonTitle (required), eventType (required), buttonTooltip, buttonClassName, iconHTML, label, and mode ('button' or 'link'). Dropdowns accept buttonTitle, buttonTooltip, buttonClassName, iconHTML, label, mode ('select', 'dropdown', or 'navbar-dropdown'), and options. Each dropdown option accepts title, value, iconHTML, divider: true, or header.
| CSS configuration path | Controls |
|---|---|
shadow.className | Region shadows. |
table.className | Table elements. |
table.thead.className | Header group. |
table.thead.tr.className | Header row. |
table.thead.tr.th.className | Header cell. |
table.tbody.className | Body group. |
table.tbody.tr.className | Body row. |
table.tbody.tr.td.className | Body cell. |
Use conf.texts for localization. Unset labels retain their English defaults.
| Text key | Default or purpose |
|---|---|
rowCounterTitle | No |
rowCounterLabel | Row number |
rowDetailsLoadingMessage | Loading details |
filterDrawer.title, filterDrawer.close | Filters, Close |
paginator.itemsPerPageLabel | Items per page: |
paginator.firstPageLabel, paginator.previousPageLabel, paginator.nextPageLabel, paginator.lastPageLabel | First page, Previous page, Next page, Last page |
paginator.firstText, paginator.previousText, paginator.nextText, paginator.lastText | First, Previous, Next, Last |
paginator.getRangeLabel | (page, pageSize, length) => string, zero-based page index; formats the visible range and total. |
paginator.label, paginator.navigationLabel | Pagination, Table page navigation |
progressBar.label | Loading progress |
state.loading, state['no-data'], state['not-found'], state.fail | Loading, No data, No records found, Failed |
toolbarMain.search | Search |
toolbarMain.searchRole | (title) => string; default `for ${title |
toolbarMain.buttonRole, toolbarMain.menuRole, toolbarMain.menuItemRole | button, menu, menu item |
toolbarSearch.field, toolbarSearch.back, toolbarSearch.clear | Search in table, Back, Clear |
Native Cell Components
| API | Description |
|---|---|
TableBroNative.withTags(options?) | Registers bro-nv-tags; takes an array of strings from the column field. options.texts.empty customizes its empty label (default No data). |
TableBroNative.withSwitch() | Registers bro-switch; uses the checked attribute and emits an action named by name. |
TableBroNative.setTagsTexts({ empty }) | Updates the empty label on existing tag cells. |
TableBroNative.nativeSkinConfig | Native skin configuration for custom skins. |
TableBroNative.BroNativeTagsComponent, TableBroNative.BroSwitchComponent | Element classes for manual registration as bro-nv-tags and bro-switch. |
Frameworks and Skins
Install the core and the skin matching your application. The Angular packages support Angular >=20 <23. Framework skins use their UI library’s theme and build setup.
| Skin | Packages in addition to @table-bro/core |
|---|---|
Native HTML (nv) | @table-bro/native |
Bootstrap (bs) | @table-bro/bootstrap, bootstrap, @types/bootstrap |
Angular Material (mat) | @table-bro/angular, @table-bro/angular-material, @angular/elements |
React/Preact MUI (mui) | @table-bro/react-mui, @mui/material, @emotion/react, @emotion/styled |
Solid SUID (suid) | @table-bro/solid-suid, @suid/material |
Svelte M3 (m3-svelte) | @table-bro/svelte-m3, m3-svelte, vite-plugin-functions-mixins |
Vue Vuetify (vuetify) | @table-bro/vue-vuetify, vuetify |
Bootstrap Setup
For Bootstrap, use the following imports in place of the native skin imports, and set skin: 'bs'.
import 'bootstrap/dist/css/bootstrap.min.css';
import '@table-bro/core/dist/table-bro.min.css';
import '@table-bro/bootstrap/dist/table-bro.bootstrap.min.css';
import '@table-bro/core';
import { useBootstrap } from '@table-bro/bootstrap';
import { Dropdown, Tooltip } from 'bootstrap';
useBootstrap({ Dropdown, Tooltip });
Framework Integration
React, Preact, Solid, Svelte, and Vue can configure the custom element through a DOM ref. Angular provides TableBroNg from @table-bro/angular for the <table-bro-ng> component. Register the Material skin with provideTableBroMatSkin() when using Angular Material.
| Angular input | Purpose |
|---|---|
cols | Column definitions; a change rebuilds the table. |
conf | Table configuration; a change rebuilds the table. |
rows | Replaces rows; [] clears the table, and null or undefined keeps its current state. |
loading | Shows loading or refreshing. |
failed | Shows the failure state when true. |
total | Server result count, delivered with rows or rowsToAppend. |
rowsToAppend | Appends the next records for the last query. |
filter | Applies filters from external controls. |
emptyState | Selects the empty response state. |
tableId | ID of the underlying custom element. |
theme | light, dark, or auto. |
| Angular output | Purpose |
|---|---|
query | Server load intent as a BroQuery. |
action | Other table actions. |
Create a Custom Skin
To create a custom skin, call registerSkin(name, config) with a BroSkinConfig containing components, css, optional themeAttribute, optional elements (tag names mapped to registration function names), and optional defineElements(registry). Start with nativeSkinConfig for a plain HTML design. The other skins export bootstrapSkinConfig, matSkinConfig, muiSkinConfig, suidSkinConfig, m3SvelteSkinConfig, and vuetifySkinConfig.
Server-side Rendering
prerenderTableBro(element, { cols, conf }) renders the toolbar, header, loading row, and paginator in a server DOM. Configure the same element in the browser to display the data rows. The Angular wrapper handles prerendering automatically. Next.js, Astro with Preact, SolidStart, SvelteKit, and Nuxt integrations use the corresponding framework skin’s /server entry.
Generate Tables With an AI Coding Agent
The optional MCP server provides API lookup, table specification checks, and code scaffolding. For Claude Code, run this command in your project directory:
claude mcp add --scope project table-bro -- npx -y @table-bro/mcp
Alternatives
- Sortable, Editable, Filterable Data Grid Web Component – data-grid.js
- Interactive And Customizable Data Table/Grid Web Component – Active Table
- Full-featured Interactive Data Table JavaScript Library – simple-datatables







