Astryx

Astryx Table

Component

About

Styled, data-driven table with density, dividers, hover highlight, striped rows, and named plugin support. T must extend Record<string, unknown>. Astryx by Meta. Source: https://astryx.atmeta.com/components/Table

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Astryx Table to your project and fits it to your theme.

Code

How Astryx Table is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

'use client';

/* Copyright (c) 2026 Meta Platforms, Inc. See MIT notice in astryx-table.tsx. */

import '@/components/ui/astryx-table-utils/astryx-preview.css';
import {
  Table,
  useTableSortable,
  useTableSortableState,
  proportional,
  pixel,
} from '@/components/ui/astryx-table';
import type {TableColumn} from '@/components/ui/astryx-table';

interface Employee extends Record<string, unknown> {
  id: string;
  name: string;
  email: string;
  role: string;
  age: number;
}

const employees: Employee[] = [
  {
    id: '1',
    name: 'Alice',
    email: 'alice@example.com',
    role: 'Engineer',
    age: 32,
  },
  {id: '2', name: 'Bob', email: 'bob@example.com', role: 'Designer', age: 28},
  {
    id: '3',
    name: 'Charlie',
    email: 'charlie@example.com',
    role: 'Manager',
    age: 45,
  },
  {
    id: '4',
    name: 'Diana',
    email: 'diana@example.com',
    role: 'Engineer',
    age: 37,
  },
  {id: '5', name: 'Eve', email: 'eve@example.com', role: 'Admin', age: 29},
];

const columns: TableColumn<Employee>[] = [
  {key: 'name', header: 'Name', width: proportional(1), sortable: true},
  {key: 'role', header: 'Role', width: proportional(1), sortable: true},
  {key: 'age', header: 'Age', width: pixel(80), sortable: true},
];

function OfficialSample() {
  const {sortedData, sortConfig} = useTableSortableState<Employee>({
    data: employees,
    defaultSort: [{sortKey: 'name', direction: 'ascending'}],
  });

  const sortablePlugin = useTableSortable<Employee>(sortConfig);

  return (
    <Table
      data={sortedData}
      columns={columns}
      idKey="id"
      plugins={{sortable: sortablePlugin}}
    />
  );
}

export default function Demo() {
  return (
    <div className="astryx-demo" data-astryx-theme="neutral" data-theme="light">
      <div className="astryx-demo-content" data-centered style={{maxWidth: 510}}>
        <OfficialSample />
      </div>
    </div>
  );
}

Dependencies

More by Astryx

View all
  • Astryx Banner

    Astryx Banner

    61
  • Astryx Avatar

    Astryx Avatar

    34
  • Astryx Aspect Ratio

    Astryx Aspect Ratio

    32
  • Astryx Badge

    Astryx Badge

    30
  • Astryx Button Group

    Astryx Button Group

    29
  • Astryx Chat Composer Drawer

    Astryx Chat Composer Drawer

    27
  • Astryx Toggle Button

    Astryx Toggle Button

    17
  • Astryx Chat Tokenized Text

    Astryx Chat Tokenized Text

    10