All components

Table

Display authored rows with semantic headers.

Examples

Display authored rows with semantic headers

Items by state
State Count
Open 8
In review 3
React code
import { Table } from "@accelerate/react/components";

export function Example() {
  return (
    <>
      <Table>
        <caption>Items by state</caption>
        <thead>
          <tr>
            <th scope="col">State</th>
            <th scope="col">Count</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <th scope="row">Open</th>
            <td>8</td>
          </tr>
          <tr>
            <th scope="row">In review</th>
            <td>3</td>
          </tr>
        </tbody>
      </Table>
    </>
  );
}
Angular code
import { Component } from "@angular/core";
import { AccTable } from "@accelerate/angular/components";

@Component({
  selector: "app-example",
  imports: [
    AccTable,
  ],
  template: `
    <table accTable>
      <caption>Items by state</caption>
      <thead>
        <tr>
          <th scope="col">State</th>
          <th scope="col">Count</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th scope="row">Open</th>
          <td>8</td>
        </tr>
        <tr>
          <th scope="row">In review</th>
          <td>3</td>
        </tr>
      </tbody>
    </table>
  `,
})
export class Example {}

Installation

Source preview. The expanded component catalog is ahead of the public npm releases. To run these examples in your own application, use packages built from the SDK source used for the previews or a release that includes the APIs below.

React
@accelerate/ui@0.4.0 and @accelerate/react@0.4.0
Angular
@accelerate/ui@0.4.0 and @accelerate/angular@0.2.0

Load @accelerate/ui/theme.css and put acc-theme on the app or the region using Accelerator components. See the framework setup guide for the theme and adapter conventions.

Usage

Compose semantic caption, head, body, rows and cells. Wrap in a named ScrollArea when horizontal scrolling is needed.

Import the React component Table from @accelerate/react/components. For Angular, add AccTable to the standalone component’s imports and use <table accTable>.

Examples use these React parts: Table. The Angular examples show the corresponding directives and template hosts.

API reference

caption
Names the table.
scope
Associates row and column headers with their cells.
Data Table
Use the managed table when you need sorting or filtering.