Table

Table

HkTable is the library's one data grid, and it is the base the rest of this group stands on. You describe the table with a column list and hand it an array of rows; it renders a div.hk-table-host → div.hk-table-wrapper → table.hk-table shell whose column header is drawn exactly once at the top, and whose body is either one flat <tbody> or one <tbody> per group (the sections mode). Everything else — a checkbox column, a drag-grip column, a trailing ⋯ column, click-to-sort, inline cells, an empty state — is an opt-in layer on top of that pair.

  • A grid whose cells are editable is HkEditableTable: it is this component plus editors, a remove column and per-row validation, pushed through the cell slots documented below.
  • A vertical list of records that reads better as rows than as columns is HkCardList; the scrolling pill that counts a long list is HkScrollProgressDock.
  • The filter chips above a roster are HkFilterBar, and paging is HkPagination — this component has neither a filter row nor a pager in its markup.

Import

tsx
1
import { HkTable, type HkTableRow, type HkTableSection, type HkRowManageGate } from "@celestia-island/hikari";
rust
1
2
use hikari_components::*;          // Table, TableColumn, TableRow, TableSize, TableManageMode, SortDirection, SortConfig
use hikari_components::prelude::*; // TableProps, EventHandler, rsx!, VNode

The Rust form is a plain function, Table(TableProps { … }), and it is the same component in its controlled shape: the three pieces of state Vue keeps in closure refs (sortKey / sortDirection / selectedRowKeys) are props there (sort_column / sort_direction / selected_keys), and every transition leaves through a callback. Inside rsx! every prop may be omitted except columns. SortDirection, SortConfig and ColumnAlign are published by the crate root only — they are not in the prelude, so a host that names them imports them from the crate root (see the import block above).

Columns and rows

A Vue column is { key, title } plus seven optional fields (the table below), and the row side is the plainest shape in the library: rows is any array of objects (HkTableRow = object, so an interface works — indexing it stays the component's business; only the out-direction payloads (update:selectedRows, manage) hand you Record<string, unknown>). A cell is read as row[column.key], and the value is rendered as-is: a string or number prints, anything else follows Vue's normal child rules (a false / null / undefined cell prints nothing). To render something structured — a badge, a chip, buttons — take over that column with a cell-<key> slot; its payload is { row, value, index } where index is the display index inside the current body (section-local in grouped mode).

FieldWhat it does
keythe row field the cell reads; also the slot name (cell-<key>) and the sort key
titlethe header's visible label
headerLabelan aria-label on the header cell, alongside whatever visible title it has (or none) — its documented job is naming the glyph / ⋯ style column while the visible header stays empty; it never renders text and never joins sorting
widthwritten verbatim into the header cell's style="width: …"
sortablearms click-to-sort for this column even when the table-level sortable is off
alignleft / center / right; emits the sheet's hk-text-* helper on both header and cells
copyablefalse opts this column out of the click-to-copy layer (controls-only columns, editable previews)
singleLineidentity/label columns render ONE line — past width the cell clips to an ellipsis instead of wrapping — the hover title always carries the full value (harmless when nothing clips); pair it with width, which bounds the clip. The Rust mirror also accepts a column width written as a full declaration ("width:12rem" — the legacy passthrough spelling) and normalizes it to the bare value.
minWidthfloor for a singleLine column (min-width on its header and cells) so short values keep the column legible

The mirror's rows are positional string cells, not objects: TableRow::new(vec!["Ada", "36"]) pairs index-wise with the column list, and a short row simply leaves its trailing cells empty. Two builders exist for the fields Vue carries on the row: .key("…") is Vue's rowKey value and .manage(TableManageMode::Disabled) is the per-row verdict the later row-actions section switches to.

ServiceOwnerp95 (ms)State
edge-proxyada42healthy
billinggrace128degraded
searchlinus87healthy

The state column is a text cell on both sides — the Rust face has no per-cell slot in this wave, so the mirror prints healthy / degraded where the TSX card paints a badge. That is the single largest difference between the two forms, and it is structural rather than a styling gap: the only structured content the mirror renders is the glyphs it draws itself (the checkbox check, the sort chevron, the drag grip and the ⋯ trigger).

Selection

selectable adds a 40px leading checkbox column. The header checkbox selects or clears every displayed row at once; a row checkbox toggles one key. Vue keeps that state in a local Set and reports it with update:selectedRows (the rows, not the keys), so a host that wants to drive it keeps its own array and passes the result back. Row identity is rowKey's field value when that field is non-null, and the display index otherwise — an unkeyed table therefore re-identifies its rows whenever the order changes, which matters the moment a sort is active.

v-model:selectedRows is the binding to use: HkTable emits update:selectedRows and declares no selectedRows prop of its own, so the v-model form is what types — passing a bare selectedRows / onUpdate:selectedRows pair to the component is a TS2322.

BucketRegion
assetseu-west-1
backupseu-central-1
logsus-east-1

0 of 3 selected

The mirror ships keys, not rows (on_selected_change: Option<EventHandler<Vec<String>>>), and it renders one state Vue never paints: when only some displayed rows are ticked the header input carries aria-checked="mixed", where Vue paints a binary checkbox. A stale key held in selected_keys cannot invert the header toggle either — the mirror asks the three-way state, not "is the set the same size as the row count".

Sorting

Click-to-sort is tri-state, and the third click is the point of it: ascending → descending → unsorted, which restores the order the host handed in. A new column always starts ascending, and only one column sorts at a time. A column takes clicks when the table-level sortable is on or that column's own sortable is true; the sorted header carries the ChevronUp glyph, rotated a half turn in the descending state.

The sort is derived — Vue never reorders your array. The comparator reads the raw cell values: numbers compare numerically, strings lexicographically, and unlike values are compared through JavaScript's own < / > coercion, so a number column that holds numbers sorts as numbers and the same column holding numeric strings sorts as text. A missing cell (null / undefined) sinks to the bottom in both directions, because the null arms run before the direction multiplier.

PackageDownloadsUpdated
tairitsu-vdom12042026-11-30
hikari-components962026-12-01
hikari-palette3112026-11-14
PackageDownloadsUpdated
tairitsu-vdom12042026-11-30
hikari-components962026-12-01
hikari-palette3112026-11-14

The mirror's sort_column + sort_direction are controlled, and the click handler calls on_sort_change with the next SortConfig — the value the tri-state cycle would produce (table_next_sort), not a state the component stores. One documented divergence sits under it: Rust rows are strings, so the mirror's comparator parses both cells as numbers first and only falls back to text order. In the sample above that makes the descending order 1204, 311, 96 in the mirror — while the Vue form, whose cells are real numbers, sorts the same three rows the same way; the two forms part company only when a column holds numeric-looking strings, where Vue compares them as text and the mirror compares them as numbers.

Grouped bodies (sections)

sections replaces rows with a list of { key, label, rows } groups, and the body becomes one <tbody> per section, each led by a band row (<th scope="rowgroup">, colspan across every column). The column header is still drawn once at the top. Sorting runs within each section and never reorders the sections themselves; selection spans the whole table (the header checkbox reaches every section); drag-to-reorder is clamped to the pressed row's own section. An empty section keeps its band — that is the point of the mode — and when every section is empty the trailing "no data" row still renders under the bands.

Section keys must be unique: they are the Vue keys of the section bodies and how the drag engine resolves a clamped strip.

TargetLatency
edge-proxy42
search87

sections is Vue-only. The mirror leaves it out, and the reason is recorded in the source header: the band render is not carried this wave, and only the section-clamped pointer strip would have needed per-section DOM state — the keyboard half already emits flat indices. A Rust page that needs bands renders several Tables (or host markup) instead; the flat sample above is the honest mirror of the rows, without the two bands.

Row actions, drag grips and copy cells

manageable adds a 36px trailing column holding one ⋯ trigger per row (an HkRowActions in its trigger mode), and a press emits manage(row, opener) — the opener element is there so a host's menu can restore focus on close. The prop also takes a gate: as a function it returns true (trigger renders), false (empty cell — the roster convention: a row without actions gets no ⋯, not a dead button) or "disabled" (the affordance stays visible but refuses the press, for read-only rows).

draggable adds a leading grip column whose handle is a span[role="button"] — deliberately not a <button>, because a press on a button is an activation and the reorder engine must read it as a drag. The keyboard path is first-class: the focused handle takes ArrowUp / ArrowDown and emits reorder(from, to) with indices into your rows (the tag-input moveTo semantics: the entry takes the target's place and everything between shifts one slot). Reordering is inert while a column sort is active — the handles render dimmed, refuse presses and drop their keyboard twin — because two indices cannot describe a move inside a derived arrangement; the third click on the sorted header (back to unsorted) is how a host gets dragging back.

copyCells (default on) is the 2026-10-18 "cells are not prose" contract: a click on a cell's plain text copies it through the library's clipboard-with-toast path, and drag mass-selection over the table is dead (data-copy-cells scopes the no-select style). It only copies text leaves — a click on a layout wrapper around chips does nothing rather than sweeping every descendant's text — and interactive descendants (buttons, links, inputs, [data-no-copy]) keep their own clicks.

The mirror carries the column flags (copyable, align, width, sortable, singleLine, minWidth) and the data-copy-cell / title markers faithfully, but its copy_cells switch defaults to false because no clipboard runtime is wired into the Rust side this wave: True gives a host Vue's affordance (the no-select cells and the title hint), and the actual copy behaviour is then the host's. cell-<key> slots have no counterpart either; only the empty slot was mirrored.

The ⋯ trigger in the mirror is the mirrored IconButton (ghost, size 28, DotsHorizontal) — the same button HkRowActions renders — and on_manage hands the host the resolved row key rather than the row object plus opener. The pointer drag engine (the lifted ghost clone, the FLIP shift of the neighbours, live strip measurement) is not mirrored: it relies on per-instance refs and layout measurement the framework cannot express here, so the Rust grip column is the keyboard half only. Vue's gate — a per-row function — cannot be a props field either, hence the verdict moved onto the row.

Empty and caption

The empty state is one row spanning every column (colspan = columns + the optional selection / drag / manage columns) and it is the only row the body renders when there are no display rows — a sorted-to-nothing or filtered-to-nothing table still shows its header. The empty slot overrides the text; emptyText defaults to "", and an empty string falls through to the localized "No data" string, so the default is never a blank cell.

caption renders a screen-reader-only <caption> — the right place for the table's name in a host that has no nearby heading; it is not a visible title.

Buckets in the tenant
BucketRegion
No data
BucketRegion

No bucket yet — create one to start uploading.

Sizes, density and the host's scroll

size picks the density step (sm / md / lg, default md) and is the only metric knob: it writes hk-table-{size} on the table.hk-table root, and the sheet owns the row height, the cell padding and the font step for each one. bordered draws the grid lines and the outer box, striped tints alternate rows, and hover adds the row wash — the three are independent booleans, and the bundled HkTable.scss is the sheet both faces compile, so a Vue table and a Rust table with the same flags look the same.

The horizontal scroller belongs to the component, not the host: the root is div.hk-table-host and the only element with overflow-x: auto is div.hk-table-wrapper inside it, which is why a wide table scrolls at its own edge instead of stretching the page. There is no sticky header, no fixed column and no pagination in the markup — a pinned header is a host stylesheet decision, and paging is a separate component.

ColumnState
A value that is wider than the frame the host gave the tableok
Shortok
ColumnState
A value that is wider than the frame the host gave the tableok
Shortok

The two cards differ only in the density flags, and the long first cell is what makes the wrapper's own scroll visible in both — the 420px frame never widens. total on the second table is a Vue-only integration: it only means anything under an enclosing scroll-progress dock (see below).

API

Vue

Props

NameTypeDefaultRequired
columnsArray as PropType<Column[]>—✓
rowsArray as PropType<readonly HkTableRow[]>() => []—
sectionsArray as PropType<HkTableSection[]>undefined—
rowKeyStringundefined—
captionStringundefined—
size<code>String as PropType<"sm" | "md" | "lg"></code>"md"—
borderedBooleanfalse—
stripedBooleanfalse—
hoverBooleanfalse—
sortableBooleanfalse—
selectableBooleanfalse—
draggableBooleanfalse—
copyCellsBooleantrue—
manageable[Boolean, Function] as PropType<HkRowManageGate>false—
emptyTextString""—
totalNumberundefined—

Emits

EventPayload
update:selectedRowsRecord<string, unknown>[]
reordernumber, number
manageRecord<string, unknown>, HTMLElement

Rust

Props — Table

PropTypeDefaultDescription
columnsVec<TableColumn>[]Column definitions (Vue: required columns).
rowsVec<TableRow>[]Row data (Vue: rows defaults to [] and is unused when sections is set; this mirror has no sections — see the header delta).
captionOption<String>NoneAccessible caption, rendered as caption.hk-table-sr-only.
sizeTableSizeTableSize::MediumSize step (hk-table-{size}).
borderedboolfalse—
stripedboolfalse—
hoverboolfalseVue's hover (the legacy prop was named hoverable).
sortableboolfalseEvery column is click-to-sort (a column's own sortable also arms it).
selectableboolfalseRender the leading checkbox column.
draggableboolfalseRender the leading drag grip column (keyboard reorder only — see the header delta).
copy_cellsboolfalseVue's copy layer switch; FALSE here because no clipboard runtime is wired (see the header delta).
manageableboolfalseRender the trailing row-actions column (the per-row verdict rides TableRow::manage).
empty_textString""Empty-state text; "" falls back to hikari::table.noData ("No data"), exactly Vue's <code>emptyText || t(…)</code>.
emptyOption<Element>NoneThe empty SLOT: wins over empty_text (Vue: slots.empty).
sort_columnString""Controlled sort key (Vue: local sortKey); "" is "unsorted".
sort_directionSortDirectionSortDirection::NoneControlled sort direction (Vue: local sortDirection).
selected_keysVec<String>[]Controlled selected row keys (Vue: local selectedRowKeys).
on_sort_changeOption<EventHandler<SortConfig>>NoneFires with the next sort state; the host owns sort_column / sort_direction.
on_selected_changeOption<EventHandler<Vec<String>>>NoneFires with the next selected key set (Vue: update:selectedRows).
on_reorderOption<EventHandler<TableReorder>>NoneFires with Vue's reorder(from, to) payload.
on_manageOption<EventHandler<String>>NoneFires with the resolved row key when a ⋯ trigger is pressed (Vue: manage(row, opener)).
classString""Appended to div.hk-table-host (Vue merges a consumer class onto the component root).

Three things the generated tables above cannot show, because they are not prop declarations:

  • Slots. cell-<key> (payload { row, value, index }), section (payload { section, index }) and empty are this component's Vue slots: pass them as the children object ({{ "cell-state": … , empty: () => … }}), never as props — none of them appears in the props table.
  • Column fields. The Column interface (key, title, headerLabel, width, sortable, align, copyable, singleLine, minWidth) is the element type of columns; the table lists the prop, not its element shape — the shape is the Columns and rows section above.
  • No selectedRows prop. The component declares only update:selectedRows in emits, so the supported binding is v-model:selectedRows; a literal selectedRows / onUpdate:selectedRows pair fails type-checking with TS2322 (probed against this page's own example).

Accessibility

  • The table is a real <table> with <thead> / <tbody>, so column headers are announced per column. caption becomes a <caption> (screen-reader-only styling) and is the intended name for a table whose host page has no heading of its own.
  • A sortable header is a clickable <th> with no aria-sort in either form: the current direction is carried by the glyph (ChevronUp, rotated when descending) and by the hk-table-header-sorted class. Nothing about the change is announced — the header is not a button and has no pressed state — so a table sorted server-side should report its order in text (a caption line, a status row) rather than relying on the chevron.
  • The selection checkboxes are native inputs inside <label>s, so the header checkbox and the row checkboxes are reached and toggled like any other checkbox. The mirror adds aria-checked="mixed" for the partial state; Vue's header checkbox is binary, so a partial selection reads as unchecked there.
  • A glyph-only column gets its accessible name from headerLabel (Vue only — the mirror's TableColumn has no such field, so a blank title is a genuinely unnamed header there). The ⋯ column's header is a sr-only "Row actions" span on both sides, and the drag column's header is aria-hidden.
  • The drag handle is focusable (tabindex="0", role="button"), named "Reorder …" from the row's first cell, and advertises aria-keyshortcuts="ArrowUp ArrowDown". While a sort is active it is aria-disabled and refuses both the pointer and the keys, so the inert state is announced rather than silent.
  • Click-to-copy is an enhancement on both faces, and it needs the flag that enables it: Vue turns copyCells on by default and marks a copying cell with a pointer cursor plus a localized title hint; the mirror's copy_cells defaults to off (no clipboard runtime is wired), so a Rust table copies nothing at all until the host sets it — data-copy-cells, the cell marker and the title hint then all appear with the same predicate Vue uses. Interactive descendants keep their own activation on both faces, so a button inside a copied cell is still a button.
  • The wrapper is an overflow-x: auto box: it is not a focusable scroll region of its own, so keyboard scrolling reaches it through a focused cell rather than as a Tab stop. The Vue form's overlay scrollbar is pointer-drag chrome on top of that.

Related components

  • HkEditableTable — this component plus editors, a remove column and validation lines.
  • HkCardList — the same records as list rows rather than columns, with icon chips and a trailing lane.
  • HkScrollProgressDock — the viewport pill this table registers with, and its total denominator.
  • HkFilterBar — the chip row that narrows a roster before it reaches the table.
  • HkPagination — paging, which lives outside this component by design.
  • HkRowActions — the ⋯ trigger the manage column renders, in its trigger and menu modes.