Skip to content

← All components

Display and feedback

Table

Accessible responsive data table with explicit surfaces, density, and striped rows.

Live example

PackageAdapterStatus
CSSNativeReady
ReactReact 19Ready
SvelteSvelte 5Ready

Usage

Each example includes the complete adapter-specific parameter reference. Copy it as a starting point, then remove options your use case does not need.

React

tsx
import { Table } from "@cofob/design-system-react";

/**
 * Complete Table parameter reference.
 * @param label
 *   type: string | renderable content
 *   required
 *   example: "Accessible label"
 * @param caption
 *   type: string | renderable content
 *   default: —
 *   example: "Build results by package"
 * @param density
 *   type: "comfortable" | "compact"
 *   default: "comfortable"
 *   example: "compact"
 * @param headerTone
 *   type: "strong" | "muted"
 *   default: "strong"
 *   example: "muted"
 * @param striped
 *   type: boolean
 *   default: true
 *   example: true
 * @param minWidth
 *   type: CSS length
 *   default: "36rem"
 *   example: "48rem"
 * @param containerClassName/containerClass
 *   type: string
 *   default: —
 *   example: "docs-table-shell"
 * @param children
 *   type: ReactNode | Svelte Snippet | child HTML
 *   default: —
 *   example: children / snippet / child HTML
 * @param table attributes
 *   type: native element attributes
 *   default: —
 *   example: class / style / aria-* / data-*
 */
export function TableExample() {
  return (
    <Table label="Package comparison"><thead>…</thead><tbody>…</tbody></Table>
  );
}

Svelte

svelte
<script lang="ts">
  import { Table } from "@cofob/design-system-svelte";

  // Complete Table parameter reference.
  // label
  //   type: string | renderable content
  //   required
  //   example: "Accessible label"
  // caption
  //   type: string | renderable content
  //   default: —
  //   example: "Build results by package"
  // density
  //   type: "comfortable" | "compact"
  //   default: "comfortable"
  //   example: "compact"
  // headerTone
  //   type: "strong" | "muted"
  //   default: "strong"
  //   example: "muted"
  // striped
  //   type: boolean
  //   default: true
  //   example: true
  // minWidth
  //   type: CSS length
  //   default: "36rem"
  //   example: "48rem"
  // containerClassName/containerClass
  //   type: string
  //   default: —
  //   example: "docs-table-shell"
  // children
  //   type: ReactNode | Svelte Snippet | child HTML
  //   default: —
  //   example: children / snippet / child HTML
  // table attributes
  //   type: native element attributes
  //   default: —
  //   example: class / style / aria-* / data-*
</script>

<Table label="Package comparison"><thead>…</thead><tbody>…</tbody></Table>

HTML

html
<!--
  Complete Table parameter reference.
  label
    type: string | renderable content
    required
    example: "Accessible label"
  caption
    type: string | renderable content
    default: —
    example: "Build results by package"
  density
    type: "comfortable" | "compact"
    default: "comfortable"
    example: "compact"
  headerTone
    type: "strong" | "muted"
    default: "strong"
    example: "muted"
  striped
    type: boolean
    default: true
    example: true
  minWidth
    type: CSS length
    default: "36rem"
    example: "48rem"
  containerClassName/containerClass
    type: string
    default: —
    example: "docs-table-shell"
  children
    type: ReactNode | Svelte Snippet | child HTML
    default: —
    example: children / snippet / child HTML
  table attributes
    type: native element attributes
    default: —
    example: class / style / aria-* / data-*
-->
<div class="cf-table-container" role="region" aria-label="Package comparison" tabindex="0"><table class="cf-table" data-header-tone="strong" data-striped="true"><thead>…</thead><tbody>…</tbody></table></div>

Parameters

Adapter differences are explicit. Native element attributes are forwarded in React and Svelte and can be written directly in HTML.

ParameterTypeDefaultAdaptersExampleDescription
labelrequiredstring | renderable contentrequiredReact · Svelte · HTML"Accessible label"Visible or accessible name, depending on the component.
captionstring | renderable contentReact · Svelte · HTML"Build results by package"Visible caption for a figure or table.
density"comfortable" | "compact""comfortable"React · Svelte · HTML"compact"Controls table cell and caption padding.
headerTone"strong" | "muted""strong"React · Svelte · HTML"muted"Chooses a high-contrast dark or quiet muted column-header surface.
stripedbooleantrueReact · Svelte · HTMLtrueAdds a subtle semantic surface to alternating body rows.
minWidthCSS length"36rem"React · Svelte · HTML"48rem"Sets the table width before the labelled container begins horizontal scrolling.
containerClassName/containerClassstringReact · Svelte · HTML"docs-table-shell"Adds a class to the labelled scroll container.
childrenReactNode | Svelte Snippet | child HTMLReact · Svelte · HTMLchildren / snippet / child HTMLIdiomatic adapter composition content.
table attributesnative element attributesReact · Svelte · HTMLclass / style / aria-* / data-*Forwards native class/style, accessibility, event, and data attributes to the root element.