tsquare wireframes

dev.tsquare由 tsquare.dev 發布官方發布者v0.14.2更新於 Nov 4, 2026

Draws UI wireframes from a small text language: multi-screen boards with notes and flow arrows.

已驗證Streamable HTTP可網頁執行開發者工具媒體與設計

概覽

AI 產生的概覽

遠端 MCP 伺服器,讓助理撰寫 tsquare 文字線框圖、渲染成 PNG 以便檢視,並產生分享連結或圖片連結。

可以做什麼
  • 透過內建指南學習線框圖文字語言的規則、元件與屬性
  • 驗證線框圖文字並渲染為 PNG 畫板,出錯時依行號回報問題
  • 為有效線框圖產生連結:在 playground 中編輯的分享連結,以及 SVG、PNG、Markdown 和 HTML 圖片連結
適用情境
適合讓助理快速畫出低保真介面草圖、含便箋與流程箭頭的多螢幕畫板,或把文字描述轉成視覺草圖與可分享的連結。
執行需求
需要 tsquare.dev 上的遠端 MCP 端點,在支援遠端 MCP 伺服器的用戶端中依 URL 加入。未宣告需要帳號、API 金鑰或環境變數。
安裝前請注意
分享連結與圖片連結會把整段線框圖文字壓縮進 URL,並未加密,任何取得連結的人都能讀取,因此不要在分享的線框圖中放入敏感內容。渲染與產生連結會把線框圖文字傳送到 tsquare.dev 服務。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 tsquare wireframes,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/dev.tsquare%2Ftsquare/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "tsquare-wireframes": {
      "type": "http",
      "url": "https://tsquare.dev/mcp"
    }
  }
}

README

[tsquare]

tsquare

[CI] [npm]

Wireframes in plain text: easy for LLMs to write, fast to render as SVG or PNG. A small text language for low-fidelity screens, with several devices side by side and notes beside them. Built for LLMs to write: the prompt comes from the component catalog, and errors come back with line numbers so a model can fix its own output.

tsquare
board "Login"  screen phone "Sign in"    heading "Welcome back"    input "Email" placeholder="[email protected]"    input password "Password"    checkbox "Remember me" checked    button primary "Sign in" fullWidth

Save that as login.tsq, then:

bash
npx tsquare render login.tsq -o login.png --scale 2

Requires Node 20 or newer. To work on tsquare itself, clone the repo, run npm install, and use npm run render -- examples/notes-mobile.tsq -o notes.png --scale 2.

Docs

Getting started · The language · Components · Icons · Colors · Using it with AI

Playground

Online at tsquare.dev/playground, or locally:

bash
npx tsquare playground   # http://localhost:4321
  • Editor: syntax highlighting, autocomplete for components, options, props, icons and colors, and problems underlined by line. Paste a whole model reply and it keeps just the code block.
  • Preview: renders as you type. Zoom and pan (⌘/Ctrl + scroll or pinch), jump to a single screen, or go full screen.
  • Links: copy a share link that reopens the wireframe in the playground, or an image link (SVG, PNG, Markdown, HTML) to embed it anywhere.
  • Examples with thumbnails, light and dark themes, a resizable split, and SVG/PNG export.
  • Components: every component with its props and a rendered example. Prompt: the system prompt for models, with a copy button.

The local playground uses the same renderer as the CLI; its links point to tsquare.dev. In this repo, npm run playground runs it from source.

Image links

A wireframe can be embedded anywhere an image works (Notion, GitHub, docs sites) with a link that contains the wireframe itself:

markdown
![Login](https://tsquare.dev/svg/zNYwxDsIwEAT7vGJ…)

The playground's Copy link menu makes these; Embedding has the steps for Notion, GitHub and your own site. The text is compressed into the URL, not encrypted, so anyone with the link can read it; see privacy. encodeWireframe and decodeWireframe in the library produce and read the same links.

Use it with

With AI

  • Claude: the tsquare skill teaches Claude the language and how to check its own wireframes.
  • Any model: the system prompt, or the hosted MCP server for Claude, ChatGPT, Cursor, VS Code and other tools that take a remote MCP URL.

In your docs

  • Docusaurus, Astro, MDX: remark-tsquare draws ```tsquare code blocks when the site is built.
  • VitePress, Eleventy: markdown-it-tsquare, the same for sites built on markdown-it.
  • Any web page: one script tag draws the code blocks in the reader's browser, with no build step.
  • Notion, GitHub and anywhere an image works: image links.

In your app

  • React: @tsquare-js/react shows boards, a zoomable viewer, an editor and a playground, including boards in a model's reply while it's still streaming in.
  • Node or the browser: the library itself.

In your editor and notes

  • VS Code (and Cursor, VSCodium, Windsurf): the tsquare extension gives .tsq files a live preview, problems as you type, highlighting and autocomplete. Also on Open VSX.
  • Obsidian: the tsquare plugin draws ```tsquare code blocks in your notes, on desktop and mobile. See the Obsidian page.

The language

One element per line; children are indented two spaces under their parent. The first line is the board.

You writeIt means
button "Sign in"a quoted string sets the main text (label, title, text…)
button primary lgbare words set options: phone, desktop, primary, ghost, row, sm, left, bottom, password…
checkbox checked, toggle offa prop name turns a boolean on; off / unchecked / no-<prop> turn it off
stack width=240 gap=8key=value sets any prop
tabs items=[All notes, Pinned]lists in [ ], items separated by commas; an item can contain spaces
data=[["$1,200", "Smith, J"]]quote an item that contains a comma (\" for a quote inside quotes)
tabbar items=[{label=Home icon=home}]objects in { }
# note to selfa comment, on its own line only; elsewhere # is text ([#1001, #1002])

If a bare word could mean two props (for example start, which is both an align and a justify value), write it as key=value. Code fences (```) are ignored, so a model's reply can be rendered as-is.

Structure

  • The top element is a board. Its children are screens, plus optional notes beside them.
  • A screen stacks its children vertically. A navbar is pinned to the top and a tabbar to the bottom.
  • modal and drawer are overlays and must be direct children of a screen.

Colors

Wireframes are grayscale. There are three deliberate exceptions in the UI itself:

You writeIt colors
board "App" accent=blueprimary buttons, solid badges, checked checkboxes and radios, toggles that are on, the active tab and tab-bar item, ghost button text
badge "Failed" tone=dangerone badge: success, warning or danger
input "Email" error helper="Required"the field's border and helper text, in red

accent takes blue, indigo, violet, pink, red, orange, green or teal, or a hex color like #1a73e8. With a light hex color, text on it switches to dark and accent-colored text is darkened so it stays readable. There are no other UI color props, on purpose.

Sticky notes beside the wireframe have their own colors, since they're annotations rather than part of the UI: note "TBD" color=pink (yellow is the default, plus blue, pink and green). See Colors for more.

Components

GroupComponents
Canvasboard, screen (phone 390×844, tablet 820×1180, desktop 1280×800, custom), note
Layoutstack, grid, card, divider, spacer
Contentheading, text (lines=3 draws placeholder lines), image (X-box placeholder), icon (any Lucide name or a brand logo such as brand-google, see Icons), avatar, badge
Controlsbutton, input (multiline=4 for a textarea), checkbox, radio, toggle, select
Navigation & datanavbar, tabbar, tabs, list, listitem, table
Overlaysmodal, drawer (left, right, bottom sheet)

Each component has its own page with a rendered example and its props: see Components.

CLI

bash
tsquare render <file.tsq|-> [-o out.svg|out.png] [--scale 2]tsquare check  <file.tsq|->        # problems by line numbertsquare fmt    <file.tsq|-> [-w]   # canonical formatting (drops comments)tsquare prompt                     # system prompt for modelstsquare playground [--port 4321]   # live editor, component reference, prompt

Run them with npx tsquare … (nothing to install), or install the tsquare command with npm install -g tsquare. Use - to read from stdin. In this repo, run them through npm: npm run check -- file.tsq. Files use the .tsq extension; the CLI reads any text file.

Library

bash
npm install tsquare
ts
import { renderWireframe, compileWireframe, formatIssues } from "tsquare";
const { issues } = compileWireframe(source);           // problems by line, empty when validconst png = await renderWireframe(source, { format: "png", scale: 2 });

tsquare/playground exports the playground's request handler, for hosting it inside your own Node server. tsquare/viewer is the playground's zoomable board (zoom, pan, pinch, a chip per screen) for your own page: pass it the elements, then show() the SVG from renderWireframeSvg with the size and screens from measureBoardLayout (exact; boardLayout is a synchronous estimate that can be off by a line or more on boards with notes). It sets the styles its zoom math needs itself; give the stage a size, and optionally style the classes it toggles on the stage: panning (while dragging), animate (while fitting or zooming to a screen, e.g. .animate > * { transition: transform .25s }) and stale (from setStale, e.g. .stale img { opacity: .35 }). Call destroy() when you remove it. Give it the board's measureElements entries (setElements) and it reports clicks and hovers on elements, outlines them (highlight) and zooms to them (zoomTo): see Element positions. languageData() lists every component, prop, option word, icon and accent, for editor highlighting and autocomplete. In a browser bundle (esbuild, Vite, webpack) the same imports render SVG with no setup; PNG and share links need Node. On a page without a build step, <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/tsquare.min.js"></script> draws every ```tsquare code block on the page (see Embedding). See Using it with AI for the prompt and the repair loop. measureElements gives each element's box on the board and its line in the text, and elementsAt what's under a click, for making a board clickable (see Element positions).

The editor: tsquare/editor

The playground's code editor for your own page: highlighting, autocomplete for components, props, option words, icons and accents, problems underlined on their lines, Enter keeping the indentation, and pasting a whole model reply keeps just its code block. CodeMirror is bundled inside (about 125 KB compressed once your bundler minifies it), so it imports nothing and can't clash with a CodeMirror your page already has.

ts
import { createEditor } from "tsquare/editor";import { compileWireframe, languageData } from "tsquare";
const editor = createEditor(document.getElementById("code")!, {  doc: "board\n  screen phone",  data: languageData(), // autocomplete; leave it out for none  onChange: (text) => editor.setIssues(compileWireframe(text).issues),});

Give the element a height; the editor fills it. Options: doc, data, onChange, onCursorLine (the caret's line, when it moves to another), lineNumbers (default true), lineWrapping (default false: wrap long lines instead of scrolling sideways, continuation rows indented 4 spaces past their line's indentation, so they don't look like a child element) and ariaLabel (default "Wireframe text"). The editor has getText(), setText(text) (one undoable step), setIssues(issues), goToLine(n), focus(), dom and destroy().

Its colors are CSS variables, light or dark by the page's color-scheme, defaulting to the playground's:

Variables
--tsquare-editor-bg, --tsquare-editor-fg, --tsquare-editor-gutter, --tsquare-editor-active-line, --tsquare-editor-selection, --tsquare-editor-errorthe editor
--tsquare-editor-popup-bg, --tsquare-editor-popup-border, --tsquare-editor-popup-selectedautocomplete and problem popups
--tsquare-editor-font, --tsquare-editor-font-size, --tsquare-editor-ui-fontcode font and size (13px), popup text font
--tsquare-syntax-component, --tsquare-syntax-string, --tsquare-syntax-prop, --tsquare-syntax-number, --tsquare-syntax-word, --tsquare-syntax-color, --tsquare-syntax-comment, --tsquare-syntax-puncthighlighting

Using it with Claude (skill)

skill/tsquare/ is a Claude skill: the syntax, the component reference, and a workflow of write → tsquare check → tsquare render → look at the PNG and fix. Copy it to ~/.claude/skills/tsquare (all projects) or <project>/.claude/skills/tsquare, and make sure npx tsquare runs where Claude works. Rebuild it after catalog changes with npm run skill.

How it works

Text is parsed into a json-render spec and validated against Zod schemas. It's then laid out and drawn by Satori into SVG; PNG output goes through resvg.

FileContents
src/text.tsparser
src/print.tsformatter (spec → text)
src/compile.tsparse + validate with line numbers, renderWireframe
src/prompt.tsmodel prompt, generated from the catalog
src/catalog.tscomponents and their props
src/components.tsxSatori renderers
src/render.tsvalidation, board sizing, SVG/PNG
src/layout.tscolors, device sizes, spacing

Measured

How often models write valid tsquare on the first try, with no repair round:

SonnetHaiku
Valid on the first try (20 requests)100%80%
Median tokens per wireframe (JSON took about 4× as many)184210
Color checks passed (7 requests)11/1111/11

How it was measured, the tasks, every model output, and the scripts: eval/.

License

MIT. The Inter font comes from the @fontsource/inter dependency, under the SIL Open Font License 1.1. Icons are from Lucide, under the ISC license. Brand logos are from Simple Icons (CC0); the logos themselves are trademarks of their owners. The browser build (dist/browser/) bundles some dependencies, Inter and satori (MPL-2.0) among them; their notices are in dist/browser/THIRD_PARTY_LICENSES.txt.

來源:README.md,提交 3aa55c7

工具

3

wireframe_guide

tsquare language guide

How to write a tsquare wireframe: the text format, the rules, a worked example and every component with its props. Call it once before writing your first wireframe.

無需輸入參數。

render_wireframe

Render a wireframe

Check tsquare wireframe text and render it. Returns a PNG of the board so you can see it, or the problems by line number (with the valid options) if the text isn't valid. Fix every problem and call it again.

輸入參數text必填flows

share_wireframe

Share a wireframe

Links for valid tsquare wireframe text, the same kinds as the playground's Copy link menu: a share link to edit it in the playground, image links (SVG, PNG), Markdown and HTML. Ask only for the links the user needs (default: an SVG image link and the share link). Each link contains the whole wireframe text (compressed), so anyone with a link can read it.

輸入參數text必填flowslinks

版本歷史

1
  1. v0.14.2最新Nov 4, 2026

評分

已滿足適用檢查項的 100%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分