GhostTable reference
Package: @ghostvue/themes. Status: experimental (stability policy).
Themed wrapper for GhostTable. Loads default table CSS and scopes recipes under ghost-themed-scope.
Generated from the component manifest. Edit the manifest or Vue source, then rebuild the docs.
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
containHorizontal | boolean | false | No | Wraps the table in an explicit horizontal scroll container. |
scrollLabel | string | null | No | Accessible name for the scroll region when containHorizontal is set. Without it the region is labelled by GhostTableCaption. |
Emits
None declared.
Models
None declared.
Slots
| Name | Description |
|---|---|
default | Table sections and rows. |
Slot props: default
None declared.
Exposed members
| Name | Type | Description |
|---|---|---|
element | HTMLTableElement | null | The native table after mount. |
Parts and data attributes
None declared.
CSS variables
None declared.
Accessibility
Role: table. APG pattern: https://www.w3.org/WAI/ARIA/apg/patterns/table/.
Required ARIA attributes: none.
Keyboard
None declared.
Verification
Each category is reviewed separately. Automated keyboard and axe results do not attest manual or assistive-technology review.
| Category | Status | Evidence |
|---|---|---|
| Automated keyboard | Not reviewed | No declared key is mapped to a browser test yet. |
| Manual interaction | Not reviewed | No review recorded. |
| Assistive technology | Not reviewed | No review recorded. |
Examples
table/team-directory
Searchable team directory with status badges, row actions, loading and empty states, and a named horizontal-scroll region.
Team directory
5 members · 1 pending invite
| Member | Role | Status | Actions |
|---|---|---|---|
| ALAda Lovelaceada@orbit.example | Owner | Active | |
| GHGrace Hoppergrace@orbit.example | Admin | Active | |
| ATAlan Turingalan@orbit.example | Engineer | Active | |
| KJKatherine Johnsonkatherine@orbit.example | Analyst | Invited | |
| EDEdsger Dijkstraedsger@orbit.example | Engineer | Suspended |
Showing 5 of 5 members
<script setup lang="ts">
import { computed, onBeforeUnmount, ref } from 'vue'
import {
GhostAvatar,
GhostBadge,
GhostButton,
GhostCard,
GhostDropdownMenu,
GhostDropdownMenuContent,
GhostDropdownMenuItem,
GhostDropdownMenuSeparator,
GhostDropdownMenuTrigger,
GhostEmptyState,
GhostInput,
GhostSkeleton,
GhostTable,
type GhostInputExposed,
} from '@ghostvue/themes'
import {
GhostTableBody,
GhostTableCell,
GhostTableHead,
GhostTableHeaderCell,
GhostTableRow,
GhostVisuallyHidden,
} from '@ghostvue/vue'
type MemberStatus = 'active' | 'invited' | 'suspended'
interface Member {
id: string
name: string
email: string
role: string
status: MemberStatus
}
// Deterministic local data: no clock, network, or random ids.
const members = ref<Member[]>([
{
id: 'm-01',
name: 'Ada Lovelace',
email: 'ada@orbit.example',
role: 'Owner',
status: 'active',
},
{
id: 'm-02',
name: 'Grace Hopper',
email: 'grace@orbit.example',
role: 'Admin',
status: 'active',
},
{
id: 'm-03',
name: 'Alan Turing',
email: 'alan@orbit.example',
role: 'Engineer',
status: 'active',
},
{
id: 'm-04',
name: 'Katherine Johnson',
email: 'katherine@orbit.example',
role: 'Analyst',
status: 'invited',
},
{
id: 'm-05',
name: 'Edsger Dijkstra',
email: 'edsger@orbit.example',
role: 'Engineer',
status: 'suspended',
},
])
const statusLabel: Record<MemberStatus, string> = {
active: 'Active',
invited: 'Invited',
suspended: 'Suspended',
}
// Badge tone is a color intent, not a status vocabulary: map it here.
const statusTone: Record<MemberStatus, 'accent' | 'neutral' | 'danger'> = {
active: 'accent',
invited: 'neutral',
suspended: 'danger',
}
const query = ref('')
const loading = ref(false)
const announcement = ref('')
const searchInput = ref<GhostInputExposed | null>(null)
const visibleMembers = computed(() => {
const needle = query.value.trim().toLowerCase()
if (needle === '') return members.value
return members.value.filter((member) =>
[member.name, member.email, member.role].some((value) =>
value.toLowerCase().includes(needle),
),
)
})
const summary = computed(() => {
const invited = members.value.filter((m) => m.status === 'invited').length
const total = String(members.value.length)
const invites = invited === 1 ? 'invite' : 'invites'
return `${total} members · ${String(invited)} pending ${invites}`
})
/*
* One polite live region: an action result while it is fresh, otherwise the
* match count, so filtering announces how many members remain.
*/
const statusText = computed(() => {
if (announcement.value !== '') return announcement.value
const shown = String(visibleMembers.value.length)
return `Showing ${shown} of ${String(members.value.length)} members`
})
let refreshTimer: ReturnType<typeof setTimeout> | undefined
/*
* Simulated fetch. The rows are replaced by skeletons and the table is
* marked aria-busy; the polite status announces the result once, so screen
* readers are not flooded with every row change.
*/
function refresh(): void {
if (loading.value) return
loading.value = true
announcement.value = 'Refreshing team directory…'
refreshTimer = setTimeout(() => {
loading.value = false
const total = String(members.value.length)
announcement.value = `Directory up to date. ${total} members.`
}, 900)
}
onBeforeUnmount(() => {
clearTimeout(refreshTimer)
})
function clearSearch(): void {
query.value = ''
searchInput.value?.element?.focus()
}
function toggleAccess(member: Member): void {
member.status = member.status === 'suspended' ? 'active' : 'suspended'
announcement.value =
member.status === 'suspended'
? `${member.name} can no longer sign in.`
: `${member.name} can sign in again.`
}
function resendInvite(member: Member): void {
announcement.value = `Invite sent again to ${member.email}.`
}
</script>
<template>
<!--
The heading carries no id: the card and table are named with aria-label
so a demo heading never becomes a page anchor in a host's outline.
-->
<GhostCard as="section" class="directory" aria-label="Team directory">
<template #header>
<div class="directory__header">
<div class="directory__heading">
<h2 class="directory__title">Team directory</h2>
<p class="directory__lead">{{ summary }}</p>
</div>
<div class="directory__toolbar">
<GhostInput
ref="searchInput"
v-model="query"
class="directory__search"
type="search"
size="sm"
block
aria-label="Search members"
placeholder="Name, email, or role"
@update:model-value="announcement = ''"
/>
<GhostButton
size="sm"
variant="outline"
tone="neutral"
:loading="loading"
@click="refresh"
>
Refresh
</GhostButton>
</div>
</div>
</template>
<!--
The wide class only applies while there are rows to show: it sets a
minimum width so columns stay aligned and the named region scrolls on
phones. The empty state then fits the card instead of the scroll width.
-->
<GhostTable
contain-horizontal
scroll-label="Team members"
aria-label="Team members"
:aria-busy="loading ? 'true' : undefined"
:class="{ directory__table: loading || visibleMembers.length > 0 }"
>
<GhostTableHead>
<GhostTableRow>
<GhostTableHeaderCell scope="col">Member</GhostTableHeaderCell>
<GhostTableHeaderCell scope="col">Role</GhostTableHeaderCell>
<GhostTableHeaderCell scope="col">Status</GhostTableHeaderCell>
<GhostTableHeaderCell scope="col" class="directory__end">
<GhostVisuallyHidden>Actions</GhostVisuallyHidden>
</GhostTableHeaderCell>
</GhostTableRow>
</GhostTableHead>
<GhostTableBody v-if="loading">
<GhostTableRow v-for="row in 4" :key="row">
<GhostTableCell>
<span class="directory__member">
<GhostSkeleton
shape="circle"
class="directory__avatar-skeleton"
/>
<!-- Same text boxes as a loaded row, so rows keep their height. -->
<span class="directory__lines">
<span class="directory__name">
<GhostSkeleton class="directory__skeleton-name" />
</span>
<span class="directory__email">
<GhostSkeleton class="directory__skeleton-email" />
</span>
</span>
</span>
</GhostTableCell>
<GhostTableCell>
<GhostSkeleton class="directory__skeleton-short" />
</GhostTableCell>
<GhostTableCell>
<GhostSkeleton class="directory__skeleton-short" />
</GhostTableCell>
<GhostTableCell />
</GhostTableRow>
</GhostTableBody>
<GhostTableBody v-else-if="visibleMembers.length > 0">
<GhostTableRow v-for="member in visibleMembers" :key="member.id">
<GhostTableHeaderCell scope="row">
<span class="directory__member">
<GhostAvatar :name="member.name" size="sm" />
<span class="directory__lines">
<span class="directory__name">{{ member.name }}</span>
<span class="directory__email">{{ member.email }}</span>
</span>
</span>
</GhostTableHeaderCell>
<GhostTableCell>{{ member.role }}</GhostTableCell>
<GhostTableCell>
<GhostBadge :tone="statusTone[member.status]">
{{ statusLabel[member.status] }}
</GhostBadge>
</GhostTableCell>
<GhostTableCell class="directory__end">
<GhostDropdownMenu>
<GhostDropdownMenuTrigger
:as="GhostButton"
variant="ghost"
tone="neutral"
size="sm"
icon-only
:aria-label="`Actions for ${member.name}`"
>
<svg
data-part="icon"
aria-hidden="true"
viewBox="0 0 16 16"
width="16"
height="16"
>
<circle cx="3" cy="8" r="1.5" fill="currentColor" />
<circle cx="8" cy="8" r="1.5" fill="currentColor" />
<circle cx="13" cy="8" r="1.5" fill="currentColor" />
</svg>
</GhostDropdownMenuTrigger>
<GhostDropdownMenuContent :offset="4" placement="bottom-end">
<GhostDropdownMenuItem
:disabled="member.status !== 'invited'"
@select="resendInvite(member)"
>
Resend invite
</GhostDropdownMenuItem>
<GhostDropdownMenuSeparator decorative />
<GhostDropdownMenuItem
:disabled="member.role === 'Owner'"
@select="toggleAccess(member)"
>
{{
member.status === 'suspended'
? 'Restore access'
: 'Suspend access'
}}
</GhostDropdownMenuItem>
</GhostDropdownMenuContent>
</GhostDropdownMenu>
</GhostTableCell>
</GhostTableRow>
</GhostTableBody>
<GhostTableBody v-else>
<GhostTableRow>
<GhostTableCell colspan="4">
<GhostEmptyState :heading-level="3">
<template #title>No members match “{{ query }}”</template>
<template #description>
Check the spelling or search by email or role.
</template>
<template #actions>
<GhostButton size="sm" variant="outline" @click="clearSearch">
Clear search
</GhostButton>
</template>
</GhostEmptyState>
</GhostTableCell>
</GhostTableRow>
</GhostTableBody>
</GhostTable>
<template #footer>
<p class="directory__status" role="status">{{ statusText }}</p>
</template>
</GhostCard>
</template>
<style scoped>
.directory__header {
align-items: end;
display: flex;
flex-wrap: wrap;
gap: var(--ghost-space-stack-sm) var(--ghost-space-gap-lg);
justify-content: space-between;
padding-block-end: var(--ghost-space-stack-sm);
}
.directory__heading {
display: grid;
gap: var(--ghost-space-gap-xs);
}
.directory__title {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-lg);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-tight);
margin: 0;
}
.directory__lead,
.directory__status {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-snug);
margin: 0;
}
/* Search grows to fill the toolbar and wraps above Refresh on phones. */
.directory__toolbar {
align-items: center;
display: flex;
flex: 1 1 16rem;
min-inline-size: 0;
gap: var(--ghost-space-gap-sm);
justify-content: flex-end;
max-inline-size: 26rem;
}
.directory__search {
flex: 1 1 auto;
min-inline-size: 0;
}
/*
* Columns keep their measure below this width; the GhostTable scroll
* region (named "Team members") pans instead of squeezing the cells.
* `:deep()` because the class lands on the native table inside GhostTable.
*/
.directory :deep(.directory__table) {
min-inline-size: 30rem;
}
.directory__end {
text-align: end;
}
.directory__member {
align-items: center;
display: flex;
gap: var(--ghost-space-gap-sm);
}
.directory__lines {
display: grid;
min-inline-size: 0;
}
.directory__name {
color: var(--ghost-text-default);
font-weight: var(--ghost-type-weight-medium);
}
.directory__email {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
font-weight: var(--ghost-type-weight-regular);
}
.directory__avatar-skeleton {
flex: none;
inline-size: var(--ghost-control-size-sm-min);
block-size: var(--ghost-control-size-sm-min);
}
/* Bars sit inside the same text boxes as the loaded name and email. */
.directory__skeleton-name,
.directory__skeleton-email {
block-size: 0.8em;
}
.directory__skeleton-name {
inline-size: 8rem;
}
.directory__skeleton-email {
inline-size: 10rem;
}
.directory__skeleton-short {
inline-size: 4.5rem;
}
</style>
table/basic
Caption, header row, and explicit tbody semantics.
| Invoice | Status | Amount |
|---|---|---|
| INV-1042 | Paid | $420.00 |
| INV-1043 | Due | $128.50 |
<script setup lang="ts">
import {
GhostTable,
GhostTableBody,
GhostTableCaption,
GhostTableCell,
GhostTableHead,
GhostTableHeaderCell,
GhostTableRow,
} from '@ghostvue/vue'
</script>
<template>
<GhostTable>
<GhostTableCaption>Q3 2025 invoices</GhostTableCaption>
<GhostTableHead>
<GhostTableRow>
<GhostTableHeaderCell scope="col">Invoice</GhostTableHeaderCell>
<GhostTableHeaderCell scope="col">Status</GhostTableHeaderCell>
<GhostTableHeaderCell scope="col">Amount</GhostTableHeaderCell>
</GhostTableRow>
</GhostTableHead>
<GhostTableBody>
<GhostTableRow>
<GhostTableCell>INV-1042</GhostTableCell>
<GhostTableCell>Paid</GhostTableCell>
<GhostTableCell>$420.00</GhostTableCell>
</GhostTableRow>
<GhostTableRow>
<GhostTableCell>INV-1043</GhostTableCell>
<GhostTableCell>Due</GhostTableCell>
<GhostTableCell>$128.50</GhostTableCell>
</GhostTableRow>
</GhostTableBody>
</GhostTable>
</template>
table/contain-horizontal
Themed deployments table that scrolls inside a caption-named region instead of widening the page.
| Service | Route | Owner | Region | Updated |
|---|---|---|---|---|
| billing-api | POST /v2/invoices/{invoiceId}/finalize | Payments platform | eu-west-1 | 2026-11-18 |
| search-indexer | PUT /v1/indexes/{indexName}/documents | Discovery | us-east-2 | 2026-11-17 |
| webhook-relay | POST /v1/endpoints/{endpointId}/deliveries/retry | Integrations | ap-southeast-1 | 2026-11-16 |
<script setup lang="ts">
import { GhostTable } from '@ghostvue/themes'
import {
GhostTableBody,
GhostTableCaption,
GhostTableCell,
GhostTableHead,
GhostTableHeaderCell,
GhostTableRow,
} from '@ghostvue/vue'
// Deterministic local data with long values, so the table is wider than a phone.
const deployments = [
{
service: 'billing-api',
route: 'POST /v2/invoices/{invoiceId}/finalize',
owner: 'Payments platform',
region: 'eu-west-1',
updated: '2026-11-18',
},
{
service: 'search-indexer',
route: 'PUT /v1/indexes/{indexName}/documents',
owner: 'Discovery',
region: 'us-east-2',
updated: '2026-11-17',
},
{
service: 'webhook-relay',
route: 'POST /v1/endpoints/{endpointId}/deliveries/retry',
owner: 'Integrations',
region: 'ap-southeast-1',
updated: '2026-11-16',
},
] as const
</script>
<template>
<!--
Routes and regions read badly when they wrap, so the cells keep one line
and the table grows wider than the frame. contain-horizontal moves that
overflow into a keyboard-focusable scroll region; the page never scrolls
sideways. With no scroll-label, the visible caption names the region
(aria-labelledby), so both read "Recent deployments".
-->
<div class="deployments">
<GhostTable contain-horizontal>
<GhostTableCaption>Recent deployments</GhostTableCaption>
<GhostTableHead>
<GhostTableRow>
<GhostTableHeaderCell scope="col">Service</GhostTableHeaderCell>
<GhostTableHeaderCell scope="col">Route</GhostTableHeaderCell>
<GhostTableHeaderCell scope="col">Owner</GhostTableHeaderCell>
<GhostTableHeaderCell scope="col">Region</GhostTableHeaderCell>
<GhostTableHeaderCell scope="col">Updated</GhostTableHeaderCell>
</GhostTableRow>
</GhostTableHead>
<GhostTableBody>
<GhostTableRow v-for="row in deployments" :key="row.service">
<GhostTableHeaderCell scope="row">{{
row.service
}}</GhostTableHeaderCell>
<GhostTableCell>{{ row.route }}</GhostTableCell>
<GhostTableCell>{{ row.owner }}</GhostTableCell>
<GhostTableCell>{{ row.region }}</GhostTableCell>
<GhostTableCell class="deployments__date">{{
row.updated
}}</GhostTableCell>
</GhostTableRow>
</GhostTableBody>
</GhostTable>
</div>
</template>
<style scoped>
/* Values stay on one line (inherited by the cells); the region scrolls. */
.deployments {
max-inline-size: 40rem;
white-space: nowrap;
}
.deployments__date {
font-variant-numeric: var(--ghost-type-numeric-tabular);
}
</style>
table/themed
Themed seat usage table with row headers, a totals footer, and end-aligned tabular figures.
| Team | Used | Seats |
|---|---|---|
| Design | 8 | 10 |
| Engineering | 24 | 30 |
| Support | 6 | 6 |
| Total | 38 | 46 |
<script setup lang="ts">
import { GhostTable } from '@ghostvue/themes'
import {
GhostTableBody,
GhostTableCaption,
GhostTableCell,
GhostTableFoot,
GhostTableHead,
GhostTableHeaderCell,
GhostTableRow,
} from '@ghostvue/vue'
// Deterministic local data; totals are derived so the footer always agrees.
const seats = [
{ team: 'Design', used: 8, total: 10 },
{ team: 'Engineering', used: 24, total: 30 },
{ team: 'Support', used: 6, total: 6 },
] as const
const usedTotal = seats.reduce((sum, row) => sum + row.used, 0)
const seatTotal = seats.reduce((sum, row) => sum + row.total, 0)
</script>
<template>
<div class="seats">
<GhostTable>
<GhostTableCaption>Seat usage by team</GhostTableCaption>
<GhostTableHead>
<GhostTableRow>
<GhostTableHeaderCell scope="col">Team</GhostTableHeaderCell>
<GhostTableHeaderCell scope="col" class="seats__number">
Used
</GhostTableHeaderCell>
<GhostTableHeaderCell scope="col" class="seats__number">
Seats
</GhostTableHeaderCell>
</GhostTableRow>
</GhostTableHead>
<GhostTableBody>
<GhostTableRow v-for="row in seats" :key="row.team">
<GhostTableHeaderCell scope="row">{{
row.team
}}</GhostTableHeaderCell>
<GhostTableCell class="seats__number">{{ row.used }}</GhostTableCell>
<GhostTableCell class="seats__number">{{ row.total }}</GhostTableCell>
</GhostTableRow>
</GhostTableBody>
<GhostTableFoot>
<GhostTableRow>
<GhostTableHeaderCell scope="row">Total</GhostTableHeaderCell>
<GhostTableCell class="seats__number">{{ usedTotal }}</GhostTableCell>
<GhostTableCell class="seats__number">{{ seatTotal }}</GhostTableCell>
</GhostTableRow>
</GhostTableFoot>
</GhostTable>
</div>
</template>
<style scoped>
/* A compact summary table; the recipe fills whatever width it is given. */
.seats {
max-inline-size: 28rem;
}
/* Numbers align on the end edge and use tabular figures so digits line up. */
.seats__number {
font-variant-numeric: var(--ghost-type-numeric-tabular);
text-align: end;
}
</style>
table/row-headers
Themed service health table whose row headers name each record, with compact block padding for multiline rows.
| Service | Status | Uptime |
|---|---|---|
| Checkout API | HealthyNo incidents in the last 30 days. | 99.98% |
| Search | DegradedIndex rebuild in eu-west-1 is slowing queries until 18:00 UTC. | 99.71% |
| Webhooks | DownDeliveries are queued. Retries resume when the broker recovers. | 98.42% |
<script setup lang="ts">
import { GhostBadge, GhostTable } from '@ghostvue/themes'
import {
GhostTableBody,
GhostTableCaption,
GhostTableCell,
GhostTableHead,
GhostTableHeaderCell,
GhostTableRow,
} from '@ghostvue/vue'
type Health = 'healthy' | 'degraded' | 'down'
interface Service {
name: string
health: Health
uptime: string
note: string
}
// Deterministic local data: no clock or network.
const services: readonly Service[] = [
{
name: 'Checkout API',
health: 'healthy',
uptime: '99.98%',
note: 'No incidents in the last 30 days.',
},
{
name: 'Search',
health: 'degraded',
uptime: '99.71%',
note: 'Index rebuild in eu-west-1 is slowing queries until 18:00 UTC.',
},
{
name: 'Webhooks',
health: 'down',
uptime: '98.42%',
note: 'Deliveries are queued. Retries resume when the broker recovers.',
},
]
const healthLabel: Record<Health, string> = {
healthy: 'Healthy',
degraded: 'Degraded',
down: 'Down',
}
// Badge tone is a color intent, not a status vocabulary: map it here.
const healthTone: Record<Health, 'accent' | 'neutral' | 'danger'> = {
healthy: 'accent',
degraded: 'neutral',
down: 'danger',
}
</script>
<template>
<!--
Each service name is a row header (scope="row"), so a screen reader
announces "Search" with that row's status and uptime instead of reading
bare values. Three columns fit a 320px phone without a scroll region.
-->
<div class="service-health">
<GhostTable>
<GhostTableCaption>Service health, last 30 days</GhostTableCaption>
<GhostTableHead>
<GhostTableRow>
<GhostTableHeaderCell scope="col">Service</GhostTableHeaderCell>
<GhostTableHeaderCell scope="col">Status</GhostTableHeaderCell>
<GhostTableHeaderCell scope="col" class="service-health__number">
Uptime
</GhostTableHeaderCell>
</GhostTableRow>
</GhostTableHead>
<GhostTableBody>
<GhostTableRow v-for="service in services" :key="service.name">
<GhostTableHeaderCell scope="row">
{{ service.name }}
</GhostTableHeaderCell>
<GhostTableCell>
<span class="service-health__status">
<GhostBadge :tone="healthTone[service.health]">
{{ healthLabel[service.health] }}
</GhostBadge>
<span class="service-health__note">{{ service.note }}</span>
</span>
</GhostTableCell>
<GhostTableCell class="service-health__number">
{{ service.uptime }}
</GhostTableCell>
</GhostTableRow>
</GhostTableBody>
</GhostTable>
</div>
</template>
<style scoped>
/* A summary table; the recipe fills whatever width it is given. */
.service-health {
max-inline-size: 36rem;
}
/*
* Notes wrap, so rows grow to several lines on a phone. One step down the
* spacing scale (--ghost-space-inset-xs) keeps those rows short and lets
* three columns fit a 320px screen; every other recipe value stays as
* shipped. `:deep()` because the cells render inside GhostTable.
*/
.service-health :deep(:is(.ghost-table-cell, .ghost-table-header-cell)) {
padding: var(--ghost-space-inset-xs);
}
/*
* The recipe centres cells on the row. These rows wrap, so the service name
* and uptime align with the first line of the status cell instead.
*/
.service-health
:deep(.ghost-table-body :is(.ghost-table-cell, .ghost-table-header-cell)) {
vertical-align: baseline;
}
/* Numbers align on the end edge and use tabular figures so digits line up. */
.service-health__number {
font-variant-numeric: var(--ghost-type-numeric-tabular);
text-align: end;
white-space: nowrap;
}
/* The badge sits above its note; the note wraps inside the cell. */
.service-health__status {
display: grid;
gap: var(--ghost-space-gap-xs);
justify-items: start;
}
.service-health__note {
color: var(--ghost-text-muted);
}
</style>