• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
dpdiliberto

dpdiliberto

table

Public
Like
table
Home
Code
5
backend
1
frontend
4
shared
1
README.md
new-file-4156.ts
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
…
README.md

Span Data Table Component

A clean, simple React table component that displays span data through message-based communication. The component listens for postMessage events and displays span data in a table format matching the provided design.

Features

  • Message-based data handling: Listens for postMessage events with span data
  • Flexible schema: Uses Zod for runtime validation of incoming messages
  • Clean design: Simple table layout without borders or heavy styling
  • Type safety: Full TypeScript support with proper type inference
  • Flexible data types: Handles any data type in span fields (string, number, object, etc.)

Message Schema

The component accepts data messages in this format:

{ type: 'data', data: { span_id: string, input: unknown, // Any data type output: unknown, // Any data type expected: unknown, // Any data type metadata: unknown | null // Any data type or null } }

Usage

The component automatically starts listening for messages when mounted. To send data:

// Send span data window.postMessage({ type: 'data', data: { span_id: 'd42cbeb6-aaff-43d6-8517-99bbbd82b941', input: "Some input text", output: "Some output text", expected: 1, metadata: { some: "additional info" } } }, '*');

Demo

  • Main page (/): Clean table with sample data
  • Demo page (/demo): Interactive demo with buttons to test different data

File Structure

├── backend/
│   └── index.ts          # Hono server for serving files
├── frontend/
│   ├── components/
│   │   └── SpanTable.tsx # Main table component
│   ├── index.html        # Clean table display
│   ├── demo.html         # Interactive demo
│   └── test-messages.js  # Test utilities
└── README.md

Table Layout

The table displays data in this column order:

  • id: The span_id value
  • input: Input data (any type, converted to string)
  • output: Output data (any type, converted to string)
  • expected: Expected data (any type, converted to string)
  • metadata: Metadata (formatted as JSON if object, otherwise as string)

Technical Details

  • Built with React 18.2.0
  • Uses Zod for runtime schema validation
  • Styled with TailwindCSS (minimal styling)
  • No external UI library dependencies
  • Fully typed with TypeScript
  • Safe rendering of all data types including null/undefined values
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.