Response
An AI agent's answer from its Markdown: headings, lists, tables and code, steady while it streams in.
When to use it: For each reply in a chat. Read the text with parseMarkdown from turtlekit/ai.
Example
To get paid invoices into your own system, add a webhook. Acme sends it the moment an invoice is paid.
import { createServer } from "node:http";
import { readBody, verify } from "./http";
createServer(async (request, response) => {
const body = await readBody(request);
if (!verify(body, request.headers["acme-signature"])) {
response.writeHead(401).end();
return;
}
const event = JSON.parse(body);
if (event.type === "invoice.paid") await markPaid(event.invoice.id, event.invoice.amount_paid);
response.writeHead(200).end();
}).listen(8787);Then register its address. The secret it prints signs every call:
acme webhooks add https://books.example.com/hooks/acme --events invoice.paidAnswer within 10 seconds with a 200, or Acme tries again: after 1 minute, 10 minutes, then hourly for a day.
Here are the three plans side by side, billed monthly per seat:
| Plan | Seats | Per seat | Invoices a month | Support |
|---|---|---|---|---|
| Starter | 1 to 3 | £6 | 50 | |
| Team | 4 to 25 | £9 | 500 | Email and chat |
| Business | 26 and up | £14 | No limit | A named manager |
For 12 people sending about 200 invoices a month, Team fits: £108 a month.
Your next invoice, INV-0049, goes to Harbour & Finch on 1 December.
Guidelines
- Give every button, link and icon button a name, every image alt text (alt="" for decoration), and every SVG aria-hidden or role="img" with a name.
a11y.accessible-name - Give each page one h1 and step heading levels down one at a time (h2, then h3).
type.heading-order - Make link text name its destination ("View all projects").
readability.link-text
Add it to your project
It’s included in turtlekit.css and the turtlekit package: install it.
Your AI will also copy only this component, and what it needs, into your project. That comes with Turtlekit Pro, opening soon. Hear when it opens.
In detail
An AI agent's answer, drawn from its Markdown in the kit's native element styles: headings, paragraphs, emphasis, lists, quotes, rules, links, tables (each in a focusable group named by its columns, scrolling when wider than the reply, figures aligned to the end) and code (each block a CodeBlock named by its language and its first line, coloured where CodeBlock knows the language, plain otherwise; a repeated name in one reply gets " 2"). content takes parseMarkdown(text) from "turtlekit/ai" (its own entry, so an app without a chat never carries the formatter; plain data, so a server can read the reply), read again with the whole text as it arrives; only the blocks that changed draw again, and each block lands in its place as it arrives. streaming while it arrives: a line that could still become something else (a list marker, a fence, a table's header or row) waits for its end, emphasis, code and links left open draw closed where the text stops, an unfinished code block offers no copy yet, and the reply is aria-busy. Safe: HTML in the text shows as text, links lead only to web pages (opening in a new tab, said to screen readers), email, phone numbers and places on the page, and images become links named by their alt text. headingLevel (default 3) is the level of the reply's first heading; deeper ones step down from it. The reply reads in its own language's direction (dir="auto"). html takes HTML another parser made, sanitised first, used as given. codeLabel, tableLabel and newTabLabel are the words for other languages. Never widens a chat row: tables are contained and long tokens break. Naming each reply and announcing a finished one are the conversation's job.
Styles: css/response.css, css/elements.css, css/typography.css, css/button.css.
How it’s built
The engineering patterns inside Response, each explained in Turtlekit Editorial.
Deriving state
The blocks shown (the whole reply, or while it streams its settled part), the code blocks' names and each table's name are derived from content during render; nothing is stored.
Partial rendering
Each block draws what it holds: a table without rows yet draws its header, a code block that has only opened stands one line tall.
Smart vs dumb components
Reading the Markdown is parseMarkdown's, in its own entry; Response only draws the blocks it is given.