Data Display

Table

A full-featured data table with sorting, filtering, pagination, row selection, expandable rows, column pinning, resizing, and custom cell rendering. All state is bindable.

Playground

Experiment with different props.

Name Email Role Status
Alice Johnsonalice@example.comAdminActive
Bob Smithbob@example.comEditorActive
Carol Leecarol@example.comViewerInactive
Dave Kimdave@example.comEditorActive

Basic Usage

Pass data - columns auto-generate from object keys.

Name Email Role Status
Alice Johnsonalice@example.comAdminActive
Bob Smithbob@example.comEditorActive
Carol Leecarol@example.comViewerInactive
Dave Kimdave@example.comEditorActive
<script lang="ts">
  import { Table } from 'sv5ui';

  const data = [
    { name: 'Alice', email: 'alice@example.com', role: 'Admin', status: 'Active' },
    { name: 'Bob', email: 'bob@example.com', role: 'Editor', status: 'Active' },
    { name: 'Carol', email: 'carol@example.com', role: 'Viewer', status: 'Inactive' }
  ];
</script>

<Table {data} />

Custom Columns

Define columns with custom labels and alignment.

Name Email Address Role Status
Alice Johnsonalice@example.comAdminActive
Bob Smithbob@example.comEditorActive
Carol Leecarol@example.comViewerInactive
Dave Kimdave@example.comEditorActive
<Table {data} columns={[
  { key: 'name', label: 'Name' },
  { key: 'email', label: 'Email Address' },
  { key: 'role', label: 'Role', align: 'center' },
  { key: 'status', label: 'Status', align: 'right' }
]} />

Sorting

Enable with sortable: true on columns. Click headers to sort.

Alice Johnsonalice@example.comAdmin32
Bob Smithbob@example.comEditor28
Carol Leecarol@example.comViewer35
Dave Kimdave@example.comEditor41
Eve Cheneve@example.comAdmin29
Frank Wufrank@example.comViewer38
Grace Liugrace@example.comEditor26
Henry Parkhenry@example.comViewer33
<script lang="ts">
  import { Table } from 'sv5ui';
  import type { SortState } from 'sv5ui';

  let sorting = $state<SortState>([]);

  const columns = [
    { key: 'name', label: 'Name', sortable: true },
    { key: 'email', label: 'Email', sortable: true },
    { key: 'role', label: 'Role', sortable: true },
    { key: 'age', label: 'Age', sortable: true, align: 'right' }
  ];
</script>

<Table {data} {columns} bind:sorting />

Global Filter

Search across all columns with useDebounce to avoid filtering on every keystroke.

Name Email Role Status
Alice Johnsonalice@example.comAdminActive
Bob Smithbob@example.comEditorActive
Carol Leecarol@example.comViewerInactive
Dave Kimdave@example.comEditorActive
<script lang="ts">
  import { Table, Input, FormField, Badge } from 'sv5ui';
  import { useDebounce } from 'sv5ui';

  let globalFilter = $state('');
  let filterInput = $state('');
  const debounce = useDebounce({ delay: 300 });
</script>

<div class="mb-3 flex items-center gap-3">
  <FormField label="Search" size="sm" class="max-w-xs">
    <Input
      bind:value={filterInput}
      placeholder="Search all columns..."
      icon="lucide:search" size="sm"
      oninput={() => debounce.run(() => globalFilter = filterInput)}
    />
  </FormField>
  {#if debounce.pending}
    <Badge label="Filtering..." variant="soft" color="warning" size="xs" />
  {/if}
</div>

<Table {data} bind:globalFilter />

Column Filters

Provide bind:columnFilters with debounced filter inputs.

Name Email Role Status
Alice Johnsonalice@example.comAdminActive
Bob Smithbob@example.comEditorActive
Carol Leecarol@example.comViewerInactive
Dave Kimdave@example.comEditorActive
<script lang="ts">
  import { Table, Input, FormField, Badge } from 'sv5ui';
  import { useDebounce } from 'sv5ui';

  let columnFilters = $state({});
  let nameInput = $state('');
  let roleInput = $state('');
  const debounce = useDebounce({ delay: 300 });
</script>

<div class="mb-3 flex flex-wrap items-end gap-3">
  <FormField label="Name" size="sm">
    <Input bind:value={nameInput} placeholder="Filter name..." size="sm" class="w-36"
      oninput={() => debounce.run(() => columnFilters = { ...columnFilters, name: nameInput })} />
  </FormField>
  <FormField label="Role" size="sm">
    <Input bind:value={roleInput} placeholder="Filter role..." size="sm" class="w-36"
      oninput={() => debounce.run(() => columnFilters = { ...columnFilters, role: roleInput })} />
  </FormField>
  {#if debounce.pending}
    <Badge label="Filtering..." variant="soft" color="warning" size="xs" />
  {/if}
</div>

<Table {data} bind:columnFilters />

Pagination

Client-side pagination with bind:page and pageSize.

Name Email Role Status
Alice Johnsonalice@example.comAdminActive
Bob Smithbob@example.comEditorActive
Carol Leecarol@example.comViewerInactive
<script lang="ts">
  import { Table, Pagination } from 'sv5ui';

  let tablePage = $state(0);
  let paginationPage = $state(1);
  const pageSize = 3;
</script>

<Table {data} bind:page={tablePage} {pageSize} />

<div class="mt-3 flex justify-end">
  <Pagination
    total={data.length}
    itemsPerPage={pageSize}
    bind:page={paginationPage}
    onPageChange={(p) => tablePage = p - 1}
  />
</div>

Infinite Scroll

useInfiniteScroll measures the element it is attached to, and the action prop hands it the root, which is overflow-hidden and never scrolls. Wrap the action so it resolves the scroll area viewport underneath first. manualPagination bypasses client-side paging.

Name Email Role Status
Bob 1user1@example.comEditorInactive
Carol 2user2@example.comViewerActive
Dave 3user3@example.comAdminInactive
Eve 4user4@example.comEditorActive
Frank 5user5@example.comViewerInactive
Grace 6user6@example.comAdminActive
Henry 7user7@example.comEditorInactive
Ivy 8user8@example.comViewerActive
Jack 9user9@example.comAdminInactive
Kate 10user10@example.comEditorActive

Loaded: 10 rows

<script lang="ts">
  import { Table, Badge } from 'sv5ui';
  import { useInfiniteScroll } from 'sv5ui';

  let data = $state(generateRows(1, 10));

  async function loadMore() {
    await new Promise((r) => setTimeout(r, 600));
    data = [...data, ...generateRows(data.length + 1, 10)];
  }

  const { action: infiniteAction, loading } = useInfiniteScroll({ onLoad: loadMore });

  // As of v2.6.0 the table scrolls inside a ScrollArea, so the root that
  // the action prop receives is overflow-hidden and never fires a scroll
  // event. Resolve the viewport underneath it and attach there.
  const scrollAction = (node: HTMLElement) => {
    const viewport = node.querySelector<HTMLElement>('[data-scroll-area-viewport]');
    infiniteAction(viewport ?? node);
  };
</script>

<!-- max-h bounds the root; the ScrollArea inside it does the scrolling -->
<Table
  {data}
  action={scrollAction}
  manualPagination
  sticky="header"
  {loading}
  class="max-h-72"
/>

<p>Loaded: {data.length} rows
  {#if loading}<Badge label="Loading..." variant="soft" color="primary" size="xs" />{/if}
</p>

Row Selection

Single or multiple selection with bind:selectedRows.

Single Selection

Id Name Email Role
1Alice Johnsonalice@example.comAdmin
2Bob Smithbob@example.comEditor
3Carol Leecarol@example.comViewer
4Dave Kimdave@example.comEditor
5Eve Cheneve@example.comAdmin

Selected: none

Multiple Selection

Id Name Email Role
1Alice Johnsonalice@example.comAdmin
2Bob Smithbob@example.comEditor
3Carol Leecarol@example.comViewer
4Dave Kimdave@example.comEditor
5Eve Cheneve@example.comAdmin

Selected: 0 row(s)

<script lang="ts">
  import { Table } from 'sv5ui';

  let selectedSingle = $state([]);
  let selectedMultiple = $state([]);

  const data = [
    { id: 1, name: 'Alice', email: 'alice@example.com', role: 'Admin' },
    { id: 2, name: 'Bob', email: 'bob@example.com', role: 'Editor' },
    { id: 3, name: 'Carol', email: 'carol@example.com', role: 'Viewer' }
  ];
</script>

<!-- Single selection -->
<Table {data} selection="single" rowKey="id" bind:selectedRows={selectedSingle} />
<p>Selected: {selectedSingle[0]?.name ?? 'none'}</p>

<!-- Multiple selection with checkboxes -->
<Table {data} selection="multiple" rowKey="id" bind:selectedRows={selectedMultiple} />
<p>Selected: {selectedMultiple.length} row(s)</p>

Striped

Name Email Role Status
Alice Johnsonalice@example.comAdminActive
Bob Smithbob@example.comEditorActive
Carol Leecarol@example.comViewerInactive
Dave Kimdave@example.comEditorActive
<Table {data} striped />

Loading

Name Email Role Status
Alice Johnsonalice@example.comAdminActive
Bob Smithbob@example.comEditorActive
Carol Leecarol@example.comViewerInactive
Dave Kimdave@example.comEditorActive
Name Email Role Status
Alice Johnsonalice@example.comAdminActive
Bob Smithbob@example.comEditorActive
Carol Leecarol@example.comViewerInactive
Dave Kimdave@example.comEditorActive
<Table {data} loading />
<Table {data} loading loadingColor="success" loadingAnimation="swing" />

Sticky Header

Keep the header visible while scrolling. It sticks to the top of the scroll area viewport, so bounding the table's height is all it needs.

Name Email Role Status
Alice Johnsonalice@example.comAdminActive
Bob Smithbob@example.comEditorActive
Carol Leecarol@example.comViewerInactive
Dave Kimdave@example.comEditorActive
Eve Cheneve@example.comAdminActive
Frank Wufrank@example.comViewerInactive
Grace Liugrace@example.comEditorActive
Henry Parkhenry@example.comViewerActive
<!-- Bound the table's height and the header sticks to the top of
     the scroll area viewport as the body scrolls under it. -->
<Table {data} sticky="header" class="max-h-64" />

<!-- sticky also takes 'footer', or true for both -->
<Table {data} sticky class="max-h-64" />

Scrolling

The table sits inside a ScrollArea on both axes. scrollArea forwards behavior into it, while styling stays on the table's own scroll slot.

Name Email Role Status
Alice Johnsonalice@example.comAdminActive
Bob Smithbob@example.comEditorActive
Carol Leecarol@example.comViewerInactive
Dave Kimdave@example.comEditorActive
Eve Cheneve@example.comAdminActive
Frank Wufrank@example.comViewerInactive
Grace Liugrace@example.comEditorActive
Henry Parkhenry@example.comViewerActive
<!-- The table scrolls on both axes inside a ScrollArea. Give the
     root a bounded height and the vertical axis comes alive; a table
     wider than its container scrolls horizontally on its own. -->
<Table {data} {columns} class="max-h-80" />

<!-- scrollArea forwards behavior into that wrapper -->
<Table {data} {columns} scrollArea={{ type: 'always', size: 'md' }} />
<Table {data} {columns} scrollArea={{ color: 'primary', track: true }} />

<!-- Styling stays on the table's own ui slots -->
<Table {data} {columns} ui={{ scroll: 'max-h-96' }} />

<!-- The root is overflow-hidden, so anything that needs to read or
     drive the scroll offset wants the viewport underneath it -->
<script lang="ts">
  let root = $state<HTMLElement | null>(null);

  function toTop() {
    root
      ?.querySelector('[data-scroll-area-viewport]')
      ?.scrollTo({ top: 0, behavior: 'smooth' });
  }
</script>

<Table bind:ref={root} {data} {columns} class="max-h-80" />

Empty State

Name Email
No users found.
<Table data={[]} columns={[
  { key: 'name', label: 'Name' },
  { key: 'email', label: 'Email' }
]} empty="No users found." />

Custom Cell Rendering

Use the global cellSlot snippet or per-column cell for rich content.

User Status Role
AJ

Alice Johnson

alice@example.com

Active Admin
BS

Bob Smith

bob@example.com

Active Editor
CL

Carol Lee

carol@example.com

Inactive Viewer
DK

Dave Kim

dave@example.com

Active Editor
EC

Eve Chen

eve@example.com

Active Admin
<script lang="ts">
  import { Table, Badge, Avatar } from 'sv5ui';
</script>

<Table {data} columns={[
  { key: 'name', label: 'User' },
  { key: 'status', label: 'Status' },
  { key: 'role', label: 'Role' }
]}>
  {#snippet cellSlot({ row, column, value })}
    {#if column.key === 'name'}
      <div class="flex items-center gap-3">
        <Avatar src={row.avatar} alt={row.name} size="sm" />
        <div>
          <p class="font-medium">{row.name}</p>
          <p class="text-on-surface/50 text-xs">{row.email}</p>
        </div>
      </div>
    {:else if column.key === 'status'}
      <Badge label={String(value)} color={value === 'Active' ? 'success' : 'surface'} variant="soft" size="xs" />
    {:else}
      {value}
    {/if}
  {/snippet}
</Table>

Expandable Rows

Manage expandedRows yourself - toggle row keys via a button in cellSlot.

Name Role Status
Alice JohnsonAdminActive
Bob SmithEditorActive
Carol LeeViewerInactive
Dave KimEditorActive
<script lang="ts">
  import { Table, Button } from 'sv5ui';

  let expandedRows = $state([]);
</script>

<Table
  {data}
  columns={[
    { key: 'id', label: '' },
    { key: 'name', label: 'Name' },
    { key: 'role', label: 'Role' },
    { key: 'status', label: 'Status' }
  ]}
  bind:expandedRows
  rowKey="id"
>
  {#snippet cellSlot({ column, value })}
    {#if column.key === 'id'}
      <Button
        icon={expandedRows.includes(Number(value)) ? 'lucide:chevron-up' : 'lucide:chevron-down'}
        aria-label="Details for row {value}"
        aria-expanded={expandedRows.includes(Number(value))}
        variant="ghost" size="xs"
        onclick={() => {
          const id = Number(value);
          if (expandedRows.includes(id)) {
            expandedRows = expandedRows.filter((k) => k !== id);
          } else {
            expandedRows = [...expandedRows, id];
          }
        }}
      />
    {:else}
      {value}
    {/if}
  {/snippet}

  {#snippet expandedSlot({ row })}
    <div class="space-y-1 text-sm">
      <p><strong>Email:</strong> {row.email}</p>
      <p><strong>Department:</strong> {row.department}</p>
      <p><strong>Joined:</strong> {row.joined}</p>
    </div>
  {/snippet}
</Table>

Nested Table

Render a child Table inside expandedSlot for master-detail views.

Department Lead Members
EngineeringAlice Johnson3
DesignCarol Lee2
MarketingBob Smith1
<script lang="ts">
  import { Table, Button } from 'sv5ui';

  let expandedRows = $state([]);

  const departments = [
    { id: 'eng', name: 'Engineering', lead: 'Alice', headcount: 3,
      members: [
        { name: 'Dave', role: 'Senior Engineer', email: 'dave@example.com' },
        { name: 'Henry', role: 'Engineer', email: 'henry@example.com' }
      ]},
    { id: 'design', name: 'Design', lead: 'Carol', headcount: 2,
      members: [
        { name: 'Eve', role: 'Lead Designer', email: 'eve@example.com' },
        { name: 'Frank', role: 'UI Designer', email: 'frank@example.com' }
      ]}
  ];
</script>

<Table
  data={departments}
  columns={[
    { key: 'id', label: '' },
    { key: 'name', label: 'Department' },
    { key: 'lead', label: 'Lead' },
    { key: 'headcount', label: 'Members', align: 'right' }
  ]}
  bind:expandedRows
  rowKey="id"
>
  {#snippet cellSlot({ column, value })}
    {#if column.key === 'id'}
      <Button
        icon={expandedRows.includes(String(value)) ? 'lucide:chevron-up' : 'lucide:chevron-down'}
        aria-label="Orders for row {value}"
        aria-expanded={expandedRows.includes(String(value))}
        variant="ghost" size="xs"
        onclick={() => {
          const id = String(value);
          if (expandedRows.includes(id)) {
            expandedRows = expandedRows.filter((k) => k !== id);
          } else {
            expandedRows = [...expandedRows, id];
          }
        }}
      />
    {:else}
      {value}
    {/if}
  {/snippet}

  {#snippet expandedSlot({ row })}
    <!-- Nested child table -->
    <Table
      data={row.members}
      columns={[
        { key: 'name', label: 'Name' },
        { key: 'role', label: 'Role' },
        { key: 'email', label: 'Email' }
      ]}
      ui={{ root: 'border-0 rounded-none shadow-none', thead: 'bg-surface-container/30' }}
    />
  {/snippet}
</Table>

Column Visibility

Toggle columns on/off via a dropdown.

Name Email Role Status
Alice Johnsonalice@example.comAdminActive
Bob Smithbob@example.comEditorActive
Carol Leecarol@example.comViewerInactive
Dave Kimdave@example.comEditorActive
<script lang="ts">
  import { Table, Button, DropdownMenu } from 'sv5ui';

  let columnVisibility = $state({ email: true, role: true, status: true });
</script>

<div class="mb-3">
  <DropdownMenu items={[
    { type: 'label', label: 'Toggle Columns' },
    { type: 'separator' },
    { type: 'checkbox', label: 'Email', checked: columnVisibility.email, closeOnSelect: false,
      onCheckedChange: (v) => columnVisibility = { ...columnVisibility, email: v } },
    { type: 'checkbox', label: 'Role', checked: columnVisibility.role, closeOnSelect: false,
      onCheckedChange: (v) => columnVisibility = { ...columnVisibility, role: v } },
    { type: 'checkbox', label: 'Status', checked: columnVisibility.status, closeOnSelect: false,
      onCheckedChange: (v) => columnVisibility = { ...columnVisibility, status: v } }
  ]}>
    {#snippet children({ props })}
      <Button variant="outline" size="sm" leadingIcon="lucide:columns-3"
        label="Columns" trailingIcon="lucide:chevron-down" {...props} />
    {/snippet}
  </DropdownMenu>
</div>

<Table {data} bind:columnVisibility />

Column Pinning

Pin columns to left or right edge.

Name Email Role Department Status
Alice Johnsonalice@example.comAdminEngineeringActive
Bob Smithbob@example.comEditorMarketingActive
Carol Leecarol@example.comViewerDesignInactive
<Table
  {data}
  columns={[
    { key: 'name', label: 'Name', width: 150 },
    { key: 'email', label: 'Email', width: 200 },
    { key: 'role', label: 'Role', width: 120 },
    { key: 'department', label: 'Department', width: 150 },
    { key: 'status', label: 'Status', width: 120 }
  ]}
  columnPinning={{ left: ['name'], right: ['status'] }}
/>

Row Pinning

Pin rows to the top with bind:pinnedRows. Click the pin icon to toggle.

Name Email Role
Alice Johnsonalice@example.comAdmin
Bob Smithbob@example.comEditor
Carol Leecarol@example.comViewer
Dave Kimdave@example.comEditor
Eve Cheneve@example.comAdmin
Frank Wufrank@example.comViewer
<script lang="ts">
  import { Table, Button } from 'sv5ui';

  let pinnedRows = $state([]);
</script>

<Table
  {data}
  columns={[
    { key: 'id', label: '' },
    { key: 'name', label: 'Name' },
    { key: 'email', label: 'Email' },
    { key: 'role', label: 'Role' }
  ]}
  rowKey="id"
  bind:pinnedRows
>
  {#snippet cellSlot({ column, value })}
    {#if column.key === 'id'}
      <Button
        icon={pinnedRows.includes(Number(value)) ? 'lucide:pin-off' : 'lucide:pin'}
        aria-label="Pin row {value}"
        aria-pressed={pinnedRows.includes(Number(value))}
        variant="ghost" size="xs" square
        color={pinnedRows.includes(Number(value)) ? 'primary' : 'surface'}
        onclick={() => {
          const id = Number(value);
          if (pinnedRows.includes(id)) {
            pinnedRows = pinnedRows.filter((k) => k !== id);
          } else {
            pinnedRows = [...pinnedRows, id];
          }
        }}
      />
    {:else}
      {value}
    {/if}
  {/snippet}
</Table>

Resizable Columns

Drag a column border, or focus it and use the keyboard. Each border is a separator in the tab order that reports its width through aria-valuenow, so a column can be resized without a pointer. Dragging goes through the shared pointer hook, which means touch and pen work as well as a mouse.

Resize keys

With a column border focused.

KeysAction
TabReach the border. Every resizable column has one, right of its header
Left, RightNarrow or widen by 16px
Shift + Left, RightBy 64px
HomeSnap to the column's minWidth, 50px unless you set one
EndSnap to maxWidth. Does nothing when the column has no maximum
Name Email Role
Alice Johnsonalice@example.comAdmin
Bob Smithbob@example.comEditor
Carol Leecarol@example.comViewer
<Table {data} columns={[
  { key: 'name', label: 'Name', resizable: true, width: 200 },
  { key: 'email', label: 'Email', resizable: true, width: 250 },
  { key: 'role', label: 'Role', resizable: true, width: 120 }
]} />

Row Callbacks

Click and right-click handlers.

Name Email Role Status
Alice Johnsonalice@example.comAdminActive
Bob Smithbob@example.comEditorActive
Carol Leecarol@example.comViewerInactive
Dave Kimdave@example.comEditorActive
<script lang="ts">
  import { Table } from 'sv5ui';
  import { toast } from 'sv5ui';
</script>

<Table
  {data}
  onRowClick={(row) => toast(`Clicked: ${row.name}`)}
  onRowContextmenu={(row) => toast(`Right-clicked: ${row.name}`)}
/>

UI Slots

Use the ui prop to override classes.

SlotDescription
rootOuter wrapper. Clips its content and carries the border
scrollScrollArea wrapping the table on both axes
baseTable element
captionTable caption (sr-only)
theadTable header
tbodyTable body
tfootTable footer
trTable row
thHeader cell
tdData cell
separatorPinned rows separator
emptyEmpty state cell
loadingLoading state
Name Email Role Status
Alice Johnsonalice@example.comAdminActive
Bob Smithbob@example.comEditorActive
Carol Leecarol@example.comViewerInactive
<!-- Card-style with gradient header -->
<Table {data} striped ui={{
  root: 'rounded-2xl shadow-xl border-0 overflow-hidden',
  thead: 'bg-gradient-to-r from-primary/10 to-tertiary/10',
  th: 'text-primary font-bold tracking-wider',
  tbody: 'divide-y-0',
  td: 'py-4'
}} />

Snippets

SnippetDescription
headerSlotGlobal header cell override (receives column, sortDirection, toggleSort)
cellSlotGlobal data cell override (receives row, column, value)
expandedSlotExpanded row content (receives row, rowIndex)
emptySlotCustom empty state
loadingSlotCustom loading state
captionSlotCustom caption
bodyTopSlotContent before data rows
bodyBottomSlotContent after data rows

Custom header with sort indicator

Role
Alice Johnsonalice@example.comAdmin
Bob Smithbob@example.comEditor
Carol Leecarol@example.comViewer
<!-- Custom header with Button sort indicator -->
<Table {data} columns={columns}>
  {#snippet headerSlot({ column, sortDirection, toggleSort })}
    {#if column.sortable}
      <Button
        variant="ghost" size="xs"
        label={column.label}
        trailingIcon={sortDirection === 'asc' ? 'lucide:arrow-up'
          : sortDirection === 'desc' ? 'lucide:arrow-down'
          : 'lucide:arrows-up-down'}
        color={sortDirection ? 'primary' : 'surface'}
        onclick={toggleSort}
        ui={{ base: 'uppercase tracking-wider font-semibold' }}
      />
    {:else}
      <span class="font-semibold uppercase">{column.label}</span>
    {/if}
  {/snippet}
</Table>

Custom empty state

Name Email

No results found

Try adjusting your search or filters.

<!-- Custom empty state with Empty component -->
<Table data={[]} {columns}>
  {#snippet emptySlot()}
    <Empty
      icon="lucide:search-x"
      title="No results found"
      description="Try adjusting your search or filters."
      variant="soft"
      size="sm"
      actions={[{ label: 'Clear Filters', variant: 'outline', color: 'surface', size: 'xs' }]}
    />
  {/snippet}
</Table>

Props

PropTypeDefault
dataT[][]
columnsTableColumn<T>[]auto
rowKeykeyof T-
captionstring-
sortingSortState[]
multiSortbooleanfalse
globalFilterstring-
columnFiltersRecord<string, string>-
pagenumber0
pageSizenumber10
selection'single' | 'multiple'-
selectedRowsT[][]
expandedRows(string|number)[][]
columnVisibilityRecord<string, boolean>-
columnPinning{ left?, right? }-
pinnedRows(string|number)[]-
columnSizingRecord<string, number>-
loadingbooleanfalse
loadingColorColorType'primary'
stripedbooleanfalse
hoverablebooleantrue
stickyboolean | 'header' | 'footer'false
actionAction<HTMLElement>-
scrollAreaScrollAreaOptions-
emptystring'No data.'
onRowClick(row, index, event) => void-
classstring-
uiRecord<Slot, Class>-

Column Props

Each column in the columns array accepts these properties.

PropTypeDefault
keykeyof T-
labelstringauto
sortablebooleanfalse
sortFn(a, b) => number-
filterablebooleanfalse
filterFn(row, value) => boolean-
pinned'left' | 'right'-
resizablebooleanfalse
widthnumber-
minWidthnumber50
maxWidthnumber-
align'left' | 'center' | 'right''left'
visiblebooleantrue
headerSnippet-
cellSnippet-
footerSnippet-

When You Need More

Table is markup: a real HTML table you hand rows and columns, with sorting and selection for the cases where a page needs them. Once the data outgrows that, @sv5ui/datagrid is the separate package built for it.

Stay with Table

  • A page of rows you already have in hand
  • Custom markup per cell, expanded rows, your own footer
  • Sorting and selection over a handful of records

Reach for DataGrid

  • Thousands of rows in a scroll viewport
  • Column filters, resize, reorder, pin and hide
  • Inline editing with validation, undo and paste
  • Filter, sort and paging driven by a server