npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

structured-table

v0.1.1

Published

Structured, themeable, SSR-friendly tables for React and Sanity.

Downloads

209

Readme

Structured Table

type-safe, parser-agnostic, and themeable structured table engine.

This package is the core engine of the Structured Table Project. It provides the logic for parsing, validating, and converting structured table data (STL) into a format that UI components can render.

It is designed to be used with the Structured Table CLI (to generate the UI components) or as a standalone utility for parsing STL in any JavaScript/TypeScript environment.

Installation

npm install structured-table

Features

  • STL Parser: specific custom parser to parse the raw string into a structured JSON Object.
  • SSR Friendly: logic is decoupled from rendering, making it perfect for Next.js or other SSR frameworks.
  • Type-Safe: Written in TypeScript with full type definitions.
  • Sanity Ready: Designed to work seamlessly with Sanity CMS or any markdown-based content.

Usage

1. Parsing STL (String -> Object)

The primary use case is parsing a "Structured Table Language" (STL) string into a usable object.

import { STL } from "structured-table";

const rawSTL = `
#table
# This is the STL - stands for (Structured Table Format)
name: Comparison Table
cols: 4
showSerialIndex: true

[header]
Title | Feature | Value | CTA

[body]
Plan A | Fast               | 120ms | [button text="Buy" url="/buy-a"]
Plan B | Medium{colSpan=2}  | [link text="Learn More" href="/plans/b"]
Plan B | Medium             | 200ms | [link text="Learn More" href="/plans/b"]

[footer]
Note | * | * | Data updated weekly

#endtable
`;

const tableData = STL.parse(rawSTL);

console.log(tableData);
/*
Output:
{
  name: "Comparison Table",
  cols: 4,
  header: { ... },
  body: [ ... ],
  footer: { ... },
  ...
}
*/

2. Stringifying (Object -> STL)

You can also convert the structured object back into an STL string.

import { STL } from "structured-table";

const tableObject = {
  name: "My Table",
  cols: 2,
  body: [
    { cells: [{ type: "text", value: "Cell 1" }, { type: "text", value: "Cell 2" }] }
  ]
  // ... rest of the structure
};

const stlString = STL.stringify(tableObject);
console.log(stlString);

The STL Format (Structured Table Language)

STL is a simple, markdown-like syntax designed for readability and ease of editing.

Basic Structure

name: Table Name
cols: 3
showSerialIndex: true

[header]
Heading 1 | Heading 2 | Heading 3

[body]
Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3
Row 2 Col 1 | Row 2 Col 2 | Row 2 Col 3

Attributes (Spanning & Alignment)

You can add attributes to any cell using { key="value" } or { key=value }.

Supported attributes:

  • colSpan: Number of columns to span.
  • rowSpan: Number of rows to span.
  • align: "left" | "center" | "right".

Example:

[body]
Standard Cell | Spanning 2 Columns {colSpan=2} |
Centered Text {align="center"} | Standard Cell | Standard Cell

Interactive Elements (Buttons & Links)

STL supports "Rich Cells" like buttons and links specifically.

Buttons: [button text="..." variant="..."] Links: [link text="..." href="..."]

Example:

[body]
User Name | [button text="Delete" variant="ghost" action="delete-user"]
Project X | [link text="Go to Project" href="https://example.com" newTab="true"]