fractalsvelte mascot fractalsvelte fractalsvelte

Svelte 5 component · machines-ui · Graphs

GraphTable

A framed data table with a rule under the header and an optional footer row for totals.

Install

GraphTable is a Svelte 5 ASCII table chart component in @fractaldesign/machines-ui. It works in SvelteKit and in any Svelte 5 app.

pnpm add @fractaldesign/machines-ui

Import

import
import '@fractaldesign/machines-ui/style.css';
import { GraphTable } from '@fractaldesign/machines-ui';

Usage

Example
<GraphTable
  title="WHAT THE RESEARCH COST"
  headers={['Agent', 'Tokens', 'Tool calls', 'Time']}
  align={['left', 'right', 'right', 'right']}
  rows={[
    ['Inks and paper', '115,207', '120', '16m'],
    ['Overprint and drift', '135,218', '164', '16m'],
    ['Naming the patterns', '186,716', '112', '18m']
  ]}
  footer={['Total', '437,141', '396', '~50m']}
/>

Props

NameTypeDefault
title string Caption drawn on the top edge as `[ TITLE ]`. Uppercase, 1–2 words.—
headers string[] Column headers, left to right.—
rows Cell[][] Body rows; each cell is a string, number, or snippet.—
footer Cell[] Optional totals row, one cell per column.—
align ('left' | 'right')[] Per-column alignment; defaults to left for the first column and right for the rest.—
corner string Character drawn at each corner of the frame.—
class string ''