StellarUI

<stellar-datatable>

Backend-controlled data table with semantic authored markup, Datastar request events, and non-optimistic pagination, sorting, filtering, and selection.

Properties

Component
Example

Preview

Launch roster Backend-controlled preview
36 matches 0 selected
NameEmailRoleTeam
Ana Reyes u_1
ana.reyes@stellar.testadminFlight
Aria Long u_28
aria.long@stellar.testviewerPayload
Ava Turner u_14
ava.turner@stellar.testeditorGuidance
Cole Hughes u_24
cole.hughes@stellar.testviewerFinance
Drew Simmons u_34
drew.simmons@stellar.testeditorPayload
Eli Watson u_15
eli.watson@stellar.testsupportMission Control
Emma Bell u_25
emma.bell@stellar.testadminFlight
Ezra Kim u_8
ezra.kim@stellar.testviewerGuidance
Finn Cox u_31
finn.cox@stellar.testsupportFlight
Iris Rivera u_30
iris.rivera@stellar.testeditorFinance

Showing 1 to 10 of 36 rows. 0 visible selections confirmed.

Markup

Copy
<div
  id="datatable-demo"
  data-signals:datatable-loading="false"
  data-indicator:datatable-loading
  data-on:datatable-request="@post('/components/stellar-datatable/demo/request', { payload: evt.detail.next })"
>
  <stellar-datatable
    data-attr:label="$label || 'Launch roster'"
    page="1"
    page-size="10"
    total-rows="36"
    sort='[{"id":"email","desc":false}]'
    filters='{}'
    selected-ids='[]'
    data-attr:selection="$selection || 'multiple'"
    data-attr:filter-debounce="$filterDebounce || 250"
    data-attr:sticky-header="$stickyHeader ? true : null"
    data-attr:loading="$datatableLoading ? true : null"
  >
    <stellar-toolbar slot="toolbar">...</stellar-toolbar>
    <stellar-table zebra hover data-attr:pin-rows="$stickyHeader ? true : null">
      <table>...</table>
    </stellar-table>
    <stellar-pagination data-datatable-pagination></stellar-pagination>
  </stellar-datatable>
</div>

API

Complete props, events, slots, and implementation notes for the shipped backend-controlled datatable.

Props

PropTypeDefaultNotes
labelstringData tableAccessible region label for the enhanced table surface.
pagenumber1Current backend-confirmed page.
page-sizenumber25Rows per page. Changes emit datatable-request with reason="page-size".
total-rowsnumber0Total backend-confirmed row count used to sync the nested pagination control.
sortArray<{ id, desc }>[]Controlled sort model. Header clicks cycle asc → desc → none; Shift+click appends multi-sort entries.
filtersobject{}Controlled filter payload keyed by data-datatable-filter.
selected-idsstring[][]Controlled selected row ids. The component computes proposals but does not commit them locally.
loadingbooleanfalseTruthful pending state. Use Datastar data-indicator to bind this prop during requests.
selectionnone | single | multiplemultipleSelection mode for row and visible-page controls.
filter-debouncenumber300Debounce duration in milliseconds for input-driven filters.
sticky-headerbooleantrueMakes the table header sticky inside the internal overflow viewport.

Events

EventSourceNotes
datatable-requeststellar-datatablePrimary backend request event. Detail includes reason, current, next, and meta.
before-page-changestellar-paginationThe datatable intercepts the nested pagination control's cancelable event to keep page changes non-optimistic.
input / changedescendant controlsObserved on sort, filter, selection, and page-size controls. The table derives a proposed next state from these interactions.

Slots

SlotNotes
defaultAuthor the semantic table markup, nested pagination, and any surrounding helper content directly in light DOM.
slot="toolbar"Optional authored toolbar content that sits above the viewport. Existing StellarUI filter and action controls belong here.

Backend Flow

  1. The browser owns only transient interaction. A sort click, filter edit, page change, or row selection makes stellar-datatable emit datatable-request with detail.current, detail.next, detail.reason, and detail.meta.
  2. The docs demo listens on the wrapper with data-on:datatable-request and posts to /components/stellar-datatable/demo/request. The request body is just evt.detail.next.
  3. Datastar sets datatable-loading from data-indicator while that request is in flight. The table binds that signal into its loading prop, so pending UI is backend-honest instead of optimistic.
  4. The Go handler at POST /components/stellar-datatable/demo/request decodes the posted state into datatableDemoState, normalizes it, applies role or query filters, sorts the full row set, clamps paging, and computes the visible selection count.
  5. The handler then renders DatatableDemoFragment(viewModel) and patches only #datatable-demo back over SSE. That one patch updates rows, counts, pagination, and the authoritative datatable props together.
  6. Because the backend re-renders the confirmed state, checkbox state, sort indicators, and the current page do not visually commit until the server response lands.

Notes

  • stellar-datatable is controlled like TanStack's server-side patterns, not a client-owned grid model. The backend confirms page, sort, filters, and selection by patching props and rows back together.
  • The preview follows Datastar's data-indicator pattern so loading is visible and honest. Interactions emit datatable-request, but the component does not optimistically commit row selection or pagination.
  • AG Grid's broader feature set was used as a capability reference only. v1 intentionally stops at server-controlled paging, sorting, filters, visible-page selection, and semantic table markup.
  • Use existing StellarUI controls around the table: stellar-toolbar, stellar-text-field, stellar-select, stellar-checkbox, and stellar-pagination.