Sortable & Filterable Material Data Table Web Component – Table Bro

Category: Javascript , Table | November 24, 2026
Authortable-bro
Last UpdateNovember 24, 2026
LicenseMIT
Views0 views
Sortable & Filterable Material Data Table Web Component – Table Bro

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

FieldDescription
pageOne-based page number.
pageSizeNumber of requested rows.
filterOptional copy of active filters, including search.
sortOptional 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 conditionDescription
eqEquals the value, including equivalent numeric strings.
inEquals any value in the array.
gteInclusive lower bound.
lteInclusive upper bound.
containsCase-insensitive substring match.
startsWithCase-insensitive prefix match.

Configuration and API

Configuration Options

Pass these settings in conf.

  • skin (string): Registered skin name, such as nv, bs, mat, mui, suid, m3-svelte, or vuetify.
  • toolbar (boolean, default true): Set to false to hide the toolbar.
  • toolbarTitle (string, default ''): Toolbar heading.
  • header (boolean, default true): Set to false to hide the column headings; column widths and sorting remain available.
  • rowCounter (boolean, default true): Shows the row number column.
  • pageSize (number, default 5): 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, default true): Automatically measures column widths. Set to false to control widths with CSS.
  • shortColumnTitle (function, default first word of the title): (col) => string supplies the short header text used when a column shrinks.
  • server (boolean, default false): Delegates data operations to the application when enabled.
  • searchDebounce (number, default 100 locally and 400 in server mode): Search delay in milliseconds.
  • filtersTransform (function): (rows, filters) => rows applies 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, default false): Enables asynchronous detail loading.
  • rowDetailsIsland (boolean, default false): 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’s theme property or attribute takes precedence.
  • shadowsEnabled (boolean, default true): 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, default false): Logs updates, actions, and warnings.
  • debugAnimation (boolean, default false): Slows animations to one-sixth speed and records timing information.

Column Options

PropertyDescription
titleRequired string displayed in the column header.
nameString identifying the row field to display.
dataType'string', 'number', or 'boolean'. Numeric strings sort numerically in number columns.
sortKeyRow 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.
tooltipHeader tooltip text.
classNameCSS class for header and body cells.
colSpanNumber of columns spanned by the body cell.
componentCustom element tag or an object with selector, attrs, and event.
htmlBoolean. Inserts the cell value as HTML. Sanitize untrusted values before using this flag or bro-table-html-cell.

Custom Cell Configuration

FieldDescription
selectorCustom element tag name.
attrsAttribute 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.valueFunction returning the displayed value; otherwise skin elements use the row field.
eventCell event name to forward as a table action.

API Methods and Properties

MemberDescription
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.
themeReflects 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

MemberDescription
skin attributeSkin name for the container.
mode property/attribute'side' (default) or 'over'. Side mode overlays the table when the available width is insufficient.
opened property/attributeBoolean open state.
toggle()Opens or closes the drawer.
textsDeprecated 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.

FunctionDescription
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);
});
EventPayload 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-changeComputed theme, 'light' or 'dark'.
bro-filters-openDrawer opened; detail is null.
bro-filters-closeDrawer closed; detail is null.

Listen for actions through bro-action. The following constants belong to TableBro.events (or the events module export).

ConstantName and data
actionEventbro-action: action envelope.
toolbarEventbro-toolbar: toolbar event name.
toolbarSearchOpenEventbro-toolbar-search-open: no data.
toolbarSearchCloseEventbro-toolbar-search-close: no data.
toolbarMoreExportEventbro-toolbar-more-export: export menu action, no data. Implement the export operation in your application.
filtersFilterEventbro-filters-filter: filters object.
filtersToggleEventbro-filters-toggle: no data.
filtersOpenEventbro-filters-open: drawer notification.
filtersCloseEventbro-filters-close: drawer notification.
filtersSortEventbro-filters-sort: column sort information (sortKey, dataType, sortDirection).
filtersServerLoadedEventbro-filters-server-loaded: BroQuery requesting data.
columnsWidthEventbro-columns-width: known new width in pixels.
detailsToggleEventbro-details-toggle: column and row for a custom cell, or no data for the built-in details button.
detailsServerLoadedEventbro-details-server-loaded: numeric detail-loading progress, 1 at completion.
detailsServerFailedEventbro-details-server-failed: detail loading failed; no data.
paginatorPageEventbro-paginator-page: requested page (one-based) and page size.
themeChangeEventbro-theme-change: new theme.
errorEventbro-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 attributePurpose
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-cellHeader row and cells.
bro-row, bro-cellBody rows and cells.
bro-sort-headerSort control in the header.
data-row-numberOne-based number on a body row.
bro-dark-theme, bro-light-themeCurrent theme classes.
bro-col_text-rightRight-aligns column cells when assigned through className.

CSS Variables

VariableDescription
--bro-row-heightBody row height.
--bro-header-heightHeader height.
--bro-shadow-sizeShadow size and drawer clearance.
--bro-corner-radiusTable corner radius; 0 gives square corners.
--bro-island-space-sizeGap between the table and drawer.
--bro-table-min-widthMinimum table width before the drawer overlays it.
--bro-filter-drawer-widthDrawer width. Set on the drawer container when styling the outer drawer.
--bro-filter-drawer-corner-radiusDrawer corner radius.
--bro-filter-drawer-durationDrawer and column transition timing.
--bro-column-width-durationColumn width transition duration.
--bro-details-durationEased detail panel animation duration.
--bro-details-easingEased detail panel timing function.
--bro-kinetic-time-constantTime constant for kinetic scrolling.
--bro-state-icon-durationState icon animation duration.
--bro-state-message-durationState message animation duration.
--bro-refresh-overlay-opacityRefresh fade in light mode, from 0 to 1.
--bro-refresh-overlay-opacity-darkRefresh fade in dark mode, from 0 to 1.
--bro-table-body-container-z-indexStacking 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 variableDefault
$bro-skinFixed selector '.nv'
$bro-table-width100%
$bro-table-header-height, $bro-table-row-height40px each
$bro-row-horizontal-padding1.25rem
$bro-table-shadow-size48px
$bro-island-space-sizeHalf the shadow size (24px)
$bro-toolbar-height64px
$bro-paginator-height56px
$bro-table-min-width594px
$bro-corner-radius12px
$bro-filter-drawer-width320px
$bro-filter-drawer-corner-radius16px
$bro-scrim-colorrgba(#000, .32)
$bro-global-progress, $bro-details-progress10px, 6px
$bro-table-container-z-index, $bro-shadow-z-index2, -1
$bro-refresh-overlay-opacity, $bro-refresh-overlay-opacity-dark.5 each
$bro-column-width-duration500ms
$bro-details-duration350ms
$bro-details-easingcubic-bezier(.37, 0, .63, 1)
$bro-filter-drawer-duration400ms
$bro-kinetic-time-constant280ms
$bro-state-icon-duration500ms
$bro-state-message-duration750ms
$bro-state-icon-size28px
$bro-state-icon-margin-right16px
$bro-state-line-height33px
$bro-state-message-font-size28px
$bro-cell-number-width45px
$bro-header-paginator-z-indexBase container z-index + 1
$bro-filter-drawer-scrim-z-indexBase + 2
$bro-filter-drawer-card-z-indexBase + 3
$bro-filter-drawer-content-z-indexBase + 4
$bro-toolbar-z-indexBase + 5
$bro-modal-filter-drawer-scrim-z-indexBase + 6
$bro-modal-filter-drawer-card-z-indexBase + 7
$bro-modal-filter-drawer-content-z-indexBase + 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 settingFields and behavior
buttonselector, attrs, event, beforeRender(element, value), iconSelector; configures skin buttons.
dropdownselector, css.button.className; controls dropdown elements.
filterDrawerbeforeRender(closeButton); customizes the drawer close button.
fontIconhtml(iconName) returns icon markup.
paginatorselector, inputsAsProperties, recreateOnReplaceRows, css.ul.className, css.ul.li.className, css.ul.li.a.className; configures paginator rendering and updates.
progressBarselector; loading and detail progress element.
sortHeaderselector, contentSelector, titleAsContent, beforeRender(element, value), afterRender(element, value) (may return disconnect cleanup); custom sort headers.
statefontIcon, 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.
switchselector, css.div.className, css.div.input.className; native/Bootstrap-style switch.
textEllipsisselector, afterRender(element, value) (may return disconnect cleanup); truncated cell text.
toolbarselector, css.nav.className, css.nav.div.className; toolbar container.
toolbarMainselector, 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.
toolbarSearchbeforeRender(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 pathControls
shadow.classNameRegion shadows.
table.classNameTable elements.
table.thead.classNameHeader group.
table.thead.tr.classNameHeader row.
table.thead.tr.th.classNameHeader cell.
table.tbody.classNameBody group.
table.tbody.tr.classNameBody row.
table.tbody.tr.td.classNameBody cell.

Use conf.texts for localization. Unset labels retain their English defaults.

Text keyDefault or purpose
rowCounterTitleNo
rowCounterLabelRow number
rowDetailsLoadingMessageLoading details
filterDrawer.title, filterDrawer.closeFilters, Close
paginator.itemsPerPageLabelItems per page:
paginator.firstPageLabel, paginator.previousPageLabel, paginator.nextPageLabel, paginator.lastPageLabelFirst page, Previous page, Next page, Last page
paginator.firstText, paginator.previousText, paginator.nextText, paginator.lastTextFirst, Previous, Next, Last
paginator.getRangeLabel(page, pageSize, length) => string, zero-based page index; formats the visible range and total.
paginator.label, paginator.navigationLabelPagination, Table page navigation
progressBar.labelLoading progress
state.loading, state['no-data'], state['not-found'], state.failLoading, No data, No records found, Failed
toolbarMain.searchSearch
toolbarMain.searchRole(title) => string; default `for ${title
toolbarMain.buttonRole, toolbarMain.menuRole, toolbarMain.menuItemRolebutton, menu, menu item
toolbarSearch.field, toolbarSearch.back, toolbarSearch.clearSearch in table, Back, Clear

Native Cell Components

APIDescription
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.nativeSkinConfigNative skin configuration for custom skins.
TableBroNative.BroNativeTagsComponent, TableBroNative.BroSwitchComponentElement 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.

SkinPackages 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 inputPurpose
colsColumn definitions; a change rebuilds the table.
confTable configuration; a change rebuilds the table.
rowsReplaces rows; [] clears the table, and null or undefined keeps its current state.
loadingShows loading or refreshing.
failedShows the failure state when true.
totalServer result count, delivered with rows or rowsToAppend.
rowsToAppendAppends the next records for the last query.
filterApplies filters from external controls.
emptyStateSelects the empty response state.
tableIdID of the underlying custom element.
themelight, dark, or auto.
Angular outputPurpose
queryServer load intent as a BroQuery.
actionOther 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

You Might Be Interested In:


Leave a Reply