GhostDataGrid reference
Package: @ghostvue/vue. Status: experimental (stability policy).
Editable APG data grid over consumer-owned rows: a native table with role="grid", one Tab stop, two-dimensional arrow, Home/End, Ctrl+Home/End, and Page Up/Down focus movement, and a labeled single-line text editor per editable cell. Proposes changed drafts through editRequest and never writes data; the app accepts by updating data or rejects through cellErrors.
Generated from the component manifest. Edit the manifest or Vue source, then rebuild the docs.
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
cellErrors | readonly DataGridCellError[] | "[]" | No | App-controlled messages shown on cells; the grid never adds or clears entries. |
columns | readonly DataGridColumnDef<TData>[] | — | Yes | Column definitions in reading order. Column IDs must be unique. |
data | readonly TData[] | — | Yes | Consumer-owned rows in display order. Never sorted, cloned, or mutated. |
getRowId | DataTableGetRowId<TData> | — | Yes | Stable row ID, as in DataTable. Focus and open drafts follow it across reorders. Row IDs must be unique. |
Emits
| Name | Payload | Description |
|---|---|---|
editRequest | DataGridEditRequest | Proposes a changed draft once, after Enter (the editor has closed and focus is back on the cell) or during Tab/Shift+Tab. Not emitted for unchanged drafts, Escape, focus loss, removal, or invalidation. |
Models
None declared.
Slots
| Name | Description |
|---|---|
empty | Accessible empty-state content shown inside the empty grid. |
Slot props: empty
None declared.
Exposed members
| Name | Type | Description |
|---|---|---|
focusCell | (cell: import('./ghost-data-grid').DataGridCellKey) => boolean | Moves real DOM focus to the cell with these IDs in navigation mode and makes it the `Tab` stop. Discards an open draft without emitting and never opens the editor. Returns `false` when the cell does not exist. |
Parts and data attributes
| Attribute | Value | Description |
|---|---|---|
data-part | grid | The <table role="grid">. Consumer class, style, and other attributes land here. |
data-part | row | Header and body rows. |
data-part | columnheader | Column header cells. They hold no focusable controls. |
data-part | cell | Body cells, including the row header column (role rowheader). |
data-part | editor | The labeled text input rendered inside a cell while it is edited. |
data-part | cell-error | Visible cellErrors message inside the cell, referenced by aria-describedby. |
data-part | empty | The cell holding the empty slot when there are no rows or columns. |
data-part | status | Visually hidden polite status element after the grid that announces new cell errors. |
data-active | true | On the remembered active cell (the Tab stop). |
data-editing | true | On the cell whose editor is open. |
data-readonly | true | On read-only cells, together with aria-readonly="true". |
data-invalid | true | On cells with a cellErrors entry. |
CSS variables
None declared.
Accessibility
Role: grid. APG pattern: https://www.w3.org/WAI/ARIA/apg/patterns/grid/.
Required ARIA attributes: aria-label, aria-readonly.
Keyboard
Verification
Each category is reviewed separately. Automated keyboard and axe results do not attest manual or assistive-technology review.
| Category | Status | Evidence |
|---|---|---|
| Automated keyboard | Passed | Every declared key maps to a Chromium browser test that CI runs and requires to pass on every commit. |
| Manual interaction | Not reviewed | No review recorded. |
| Assistive technology | Not reviewed | No review recorded. |
Examples
data-grid/basic
A named grid with one Tab stop and arrow-key, Home/End, and Ctrl+Home/End navigation over read-only cells, with a row header column.
data-grid/estimate-editor
Change Build's estimate from 3 to 8: Enter proposes once, the application saves through a per-cell queue and re-sorts the rows, and focus follows Build's Estimate cell to its new row. Estimates over 20 days are rejected with a visible, announced message.
data-grid/locked-rows
editable as a per-row callback keeps done tasks reachable but read-only, and a cell render hook shows "3 days" while toDraftText opens the editor with the raw number.
data-grid/rejected-edit
The application leaves data unchanged and sets a cellErrors entry: the cell keeps its value, shows and announces the message, and reopens from the current value with aria-invalid.
data-grid/rtl
A grid that inherits dir="rtl": ArrowLeft and ArrowRight follow the physical neighbor, Home and End follow reading order, and the editor owns caret movement.