Back

When you ask the chat at Octolane for your open deals, the answer is a table. For a long time that table was markdown. The model typed pipe characters, and the chat turned them into a table as they arrived.

In a screenshot, it looked fine. Then I actually started using it, and the cracks showed up one after another. The copy button sat on top of the cells. The table fell apart on my phone. It jumped around while the reply streamed. And it couldn't sort, filter, or even tell me how many rows it was hiding. Here's how I ended up replacing it with a real table, and the tool that feeds it.

The old table

I started where every markdown table ended up, a component called CopyableTable. It wrapped the table in a scroll box, capped each cell at 25 characters so long text would wrap, and stuck a copy button in the top right corner.

I always start with whatever covers the content, and that button did. It sat on top of the table instead of beside it, so it covered the header of the last column, and the edge fades washed right into it. A control shouldn't sit on the data it acts on, so I gave it a row of its own.

DealAccountStageValueNext step
Platform renewalNorthwindNegotiation$84,000Send redlines
20 seatsFabrikamTrial$18,500Check trial usage
New businessContosoDemo$42,000+ add legal review
EMEA expansionTailspinLead—Find the budget owner
The copy button before and after the first fix. As an overlay it sat inside the header row, over the last column, and on a table that scrolled the edge fade washed over it. In its own toolbar row it covers nothing.

While it streamed

Streaming came next. Replies arrive a few characters at a time, and the markdown gets parsed again on every update. But markdown only knows a table is a table once the line of dashes under the header shows up. Until then, I was staring at a paragraph of pipes.

And when the table finally appeared, it measured its width once, from whatever first row or two it had. It watched the chat area, not the table, so later rows never changed it. A long row that came in later had to wrap, or scroll, inside a box sized for short ones. That's also why the same table came out wider after a reload: it measured again, with every row in place.

Three deals are open in EMEA this quarter. Northwind's renewal is the largest, and it's already in negotiation.

DealAccountStageValue
RenewalNorthwindNegotiation$84,000
20 seatsFabrikamTrial$18,500
New business with the analytics add-on for the whole EMEA teamContoso Pharmaceuticals InternationalDemo$42,000
Switching renderers replays the stream, and you can pause it at any point. The reply's prose streams first, then the table. As markdown, the header shows as pipe text until the |---| row lands, and only then becomes a table that fills in row by row. As a widget, nothing shows until the whole table has arrived.

Why patching stopped working

I patched it first, one pull request at a time. Each patch fixed a symptom, and the cause stayed underneath.

A markdown table is only strings. It has no column types, so money can't be formatted as money or sorted as a number. It has no row count, so it can't tell you it's showing 20 of 1,240. And it arrives a character at a time, so its shape keeps changing while you look at it. No amount of patching fixes that. So I closed the pull request, and the table became a tool.

The plan in the ticket

The ticket asked for a real table component, with search, filters, sorting and CSV export. My first sketch was a new kind of message part, with headers and a category for every kind of cell.

The core idea held up: the table travels as its own part, not as text. The shape didn't. I moved the types off the cells and onto the columns, reusing the field types the CRM already has. Then I added a few fields that only start to matter once a table gets big:

TypeScript
type TableWidget = {  table_id: string;  dataset_ref: string; // "table://<dataset_id>"  source: "producer" | "inline";  title?: string;  columns: {    key: string;    label: string;    type: AttributeType; // the CRM's own field types    ref?: { entity: RefEntity; id_key: string };    hidden?: boolean;  }[];  rows: Record<string, string | number | boolean | null>[]; // at most 500  row_count: number; // the true total, may exceed rows.length  truncated: boolean; // row_count > 500  order: "source"; // producer order, never a ranking};

Layout isn't in there, on purpose. The frontend decides how to show the table. The backend never sends a layout hint.

One tool, three row sources

Instead of typing pipes, the model now calls render_table. The cheapest way to call it is to point at a search it already ran this turn. Those rows are already sitting on the server, so the model never retypes them, which means it can't get one wrong.

Some results are too big to send back inline, or come from a sub-agent, so I added a second source for those: a handle to a dataset held on the server. Only when neither fits, say a comparison the model pieced together from the web or the conversation, does it pass the rows itself.

Rows out of band

Then there was context. Whatever a tool returns gets shown to the model again on every step after it. Put the rows in that return value, and they eat context for the rest of the turn. Worse, a 500-row table crosses the size limit for tool results. When that happens, the whole result gets swapped for a short stub, and no table renders at all. On exactly the tables the cap exists for.

The way out was to keep the rows away from the model entirely. The tool hands it an envelope with no rows, and keeps the full payload on the turn. When the stream gets turned into parts, the rows slip back in.

1

Model asks for a table

Running

Not a Markdown table: it points at the search it already ran

2

Server builds the table

Running

Keeps up to 500 rows, counts the real total, gives each column a type

3

Model gets a summary

Running

The title, column names and row count. No rows at all

4

Model writes the reply

Running

Its memory holds the summary, never the whole table

What the model sees

5

Full rows sent to you

Running

The full rows travel with the reply, out of the model's sight

6

Columns set up by type

Running

Each header knows what it holds: money, a date, a stage

7

Each cell drawn by type

Running

Names become links, amounts read as money, stages as chips

What you see

From the model's request to the table on your screen. The model only ever sees a short summary; the rows go straight to your screen, where every cell is drawn to match its column's type.

A row count you can trust

The table ships at most 500 rows, and its count is always the true total. Count the sliced array instead, and it'll happily tell you 500 of 500 when there are 1,240. That's a number said with total confidence, and it's wrong.

I also marked the rows as coming in the order they were produced, not ranked. That one little field ended up shaping the design later, because sorting 500 rows out of 1,240 doesn't find you the top deal.

Headers people can read

The first tables came back with headers like sent_at. One had a column called # holding 1 to 15, a copy of the row numbers the table already draws. The prompt had rules for column types and titles, and nothing about labels.

So I wrote one: labels a person would say out loud, in Title Case, never a raw field key and never a # column. Then I put it in three places, the system prompt, the tool description and the field's schema, so it holds no matter which one the model is reading.

No more pipe tables

Even with the tool in place, some answers still came back as markdown. A pricing comparison gave it away. The cause was four older parts of the prompt that still invited a markdown table, one of them on every single turn. A comparison matched those better than it matched the ban. And background turns, where sub-agents write their summaries, had never gotten the rule at all.

Rewording the ban wouldn't have fixed that. Instead I deleted the lines it was fighting with, gave background turns the rule, and spelled out the exact habit to stop:

Prompt
Never write a markdown pipe table. Every row-shaped answer goes through render_table.A comparison you wrote from your own knowledge, from web research, from memory, or from the conversation is still a table. Running no tools this turn is not a reason to fall back to markdown. A 2-row or 2-column table is a table. If you find yourself typing a | to line values up, or writing a |---| separator row, stop and call render_table instead.

Slack got to stay the exception. It has no widgets, and it shows markdown tables well, so it keeps them.

One table, always inline

The ticket pictured a small card in the chat that opens the table in a side panel. My first version shipped half of that: small, complete tables inline, everything else as a card. The card showed a title, a few column names and a row count. It described a table, in the space where the table would have fit, and then made you click to see it.

I want a preview to be the content itself, so I dropped the card. Every table renders inline now, and the long ones offer the panel. I kept search, filter and sort out of the inline table on purpose. It shows the first five rows in the order they came, and sorting those would look like a ranking of the whole table. Anything that reorders lives in the panel, which has room to say what it applied to.

Rows and columns that say what they are

Above the table, I added one line in muted type: how many rows you're looking at, out of how many, and how many columns. The prose around it already tells you what the table is about. What it can't tell you is how much of it you're seeing.

Show more

My first “Show all” button sat under a table that ended on a clean bottom border. The edge said this is the whole table. The button said it wasn't.

So I had the preview render two rows past the five, and cut the frame right through the middle of the last one. Nobody mistakes a half-cut row for the last row. Then I floated the button over the fade.

Showing 5 of 500 rows·8 columns
Deal
Account
Contact
Deal Owner
Stage
Deal Value
Close Date
Next Step

Platform renewal

Northwind

Nora Blake

Priya Shah

Negotiation

$84,000

Dec 4, 2026

Send redlines

20 seats

Fabrikam

Omar Haddad

Leo Martin

Trial

$18,500

Dec 11, 2026

Check trial usage

New business

Contoso

Ines Duarte

Ana Ruiz

Demo

$42,000

Dec 19, 2026

+ add legal review

EMEA expansion

Tailspin

Kai Moreno

Priya Shah

Lead

—

Jan 8, 2027

Find the budget owner

Analytics add-on

Litware

Ruth Adeyemi

Sam Okafor

Won

$9,600

Nov 28, 2026

Hand off to onboarding

The inline table. Five rows you can read, two more cut under the fade, and the way out floating on top. Press Show all: the panel opens over the page at the right edge, as it does in the product. Collapse it to a strip to read around it, and close it with its button or Escape.

Those two extra rows are pure decoration, so I hid them from screen readers and made sure they can't be focused. The caption still says five, because nobody can actually read them.

Fades as masks

The fades started out as gradients painted over the content, in a colour meant to match the background. I tried three colours. None of them looked right, because the gradient also covered the frame's border and its rounded corners. The problem was the technique, not the colour.

I pulled every open deal from the pipeline, 500 in all. Four of the first five close before the end of the year, and together those five come to a little over $150,000. Northwind’s renewal is the one to watch: it’s the largest, and it’s already in negotiation. Here’s the list, with the owner, stage and next step for each deal.

Showing 5 of 500 rows·8 columns
Deal
Account
Contact
Deal Owner
Stage
Deal Value
Close Date
Next Step

Platform renewal

Northwind

Nora Blake

Priya Shah

Negotiation

$84,000

Dec 4, 2026

Send redlines

20 seats

Fabrikam

Omar Haddad

Leo Martin

Trial

$18,500

Dec 11, 2026

Check trial usage

New business

Contoso

Ines Duarte

Ana Ruiz

Demo

$42,000

Dec 19, 2026

+ add legal review

EMEA expansion

Tailspin

Kai Moreno

Priya Shah

Lead

—

Jan 8, 2027

Find the budget owner

Analytics add-on

Litware

Ruth Adeyemi

Sam Okafor

Won

$9,600

Nov 28, 2026

Hand off to onboarding

Want me to draft a nudge for the Fabrikam deal still in trial, or find a budget owner for Tailspin?

Painted on top, a fade has to guess a colour, and it lands as a band that never quite matches the table. A mask fades the content itself, so there is no colour to pick.

So I switched to a mask. A mask fades the content itself, so there's no colour to pick at all. One catch: an element only gets one mask image, so two classes for two directions just replace each other. I ended up with one class that stacks both gradients, and keeps a pixel only where both keep it:

CSS
.scroll-mask-xy {  mask-image:    linear-gradient(      to bottom,      transparent 0,      black var(--scroll-mask-t),      black calc(100% - var(--scroll-mask-b)),      transparent 100%    ),    linear-gradient(      to right,      transparent 0,      black var(--scroll-mask-l),      black calc(100% - var(--scroll-mask-r)),      transparent 100%    );  /* A pixel survives only where both keep it. */  mask-composite: intersect;  animation:    scroll-mask-t linear,    scroll-mask-b linear,    scroll-mask-l linear,    scroll-mask-r linear;  animation-timeline:    scroll(self block),    scroll(self block),    scroll(self inline),    scroll(self inline);}

Each edge follows its own scroll position and stays out of the way until that direction overflows, so a table that fits gets no fade at all. I made the bottom fade deeper than the sides. It has to bury whole rows, while the sides only have to hint that the row keeps going.

The panel

“Show all” opens the side panel, and that's where all the tools went. Search marks matches in place, with a counter and arrows to step through them. It doesn't hide the other rows, because the rows around a match are what give it meaning. Narrowing is the filters' job, and they reuse the CRM's own filter operators, so a date column offers date operators.

The header always says how much it holds, 500 of 1,240 rows. In the product, the moment you sort, a note says it more firmly: these are sorted within the first 500, not ranked across the full set.

The side panel, with the same 500 rows. Search marks every match and steps through them without hiding the rows around them. The stage filter narrows. Click a header to sort. Export downloads a CSV, with the formula guard applied.

Then I pinned the first column while you scroll sideways, with a soft shadow once something slides under it. With collapsed borders, the table paints the borders itself, so the pinned column's divider got left behind when the cells moved. So the table uses separate border mode.

Export writes a CSV, and that needs a guard. Rows can hold web results, or text someone else typed into the CRM, and a cell like =HYPERLINK(…) runs the moment the file is opened. So those cells get a leading apostrophe. Numbers I left alone, otherwise a column of negative amounts would stop adding up.

TypeScript
const FORMULA_TRIGGERS = ["=", "+", "-", "@", "\t", "\r"];function neutralizeFormula(value: string) {  if (!FORMULA_TRIGGERS.some((t) => value.startsWith(t))) {    return value;  }  // -5 and +3.2 can't be formulas. Quoting them would turn  // a numeric column into text that no longer sums.  if (Number.isFinite(Number(value))) return value;  return `'${value}`;}

The old table, on a phone

One problem from the old table is still open: the phone. The chat reads in a narrow column, and wide tables used to break out of it to use the whole chat area. To pull that off, the component measured the table in JavaScript, set a width in pixels, and dragged it left with a negative margin to keep it centred.

On a phone, though, there's nothing to break out into. The table scrolled sideways inside the message, with most of its columns hidden behind a fade. The copy button landed on whatever header happened to be under it. Long cells still wrapped at 25 characters, so rows grew tall, and a height cap gave the table its own vertical scroll, inside the chat's. Two scrolls, one inside the other.

Five deals close before the end of the year. Northwind is the biggest and still in negotiation.

DealAccountStageWhy it matters
Platform renewalNorthwindNegotiationLargest renewal this year, legal is reviewing the new terms
20 seatsFabrikamTrialUsage doubled in the second week of the trial
New businessContosoDemoChampion moved teams, need a new sponsor
EMEA expansionTailspinLeadBudget owner not identified yet
Analytics add-onLitwareWonSigned, waiting on the onboarding kickoff
Multi-yearCoho WineryLeadAsked for a security review before pricing
Multi-yearWide WorldTrialWants a two-year term with a discount
Seat expansionAlpine SkiDemoPilot ends this month, decision expected after

Want me to draft the redlines for Northwind?

Markdown table

Five deals close before the end of the year. Northwind is the biggest and still in negotiation.

Showing 5 of 500 rows·8 columns
Deal
Account
Contact
Deal Owner
Stage
Deal Value
Close Date
Next Step

Platform renewal

Northwind

Nora Blake

Priya Shah

Negotiation

$84,000

Dec 4, 2026

Send redlines

20 seats

Fabrikam

Omar Haddad

Leo Martin

Trial

$18,500

Dec 11, 2026

Check trial usage

New business

Contoso

Ines Duarte

Ana Ruiz

Demo

$42,000

Dec 19, 2026

+ add legal review

EMEA expansion

Tailspin

Kai Moreno

Priya Shah

Lead

—

Jan 8, 2027

Find the budget owner

Analytics add-on

Litware

Ruth Adeyemi

Sam Okafor

Won

$9,600

Nov 28, 2026

Hand off to onboarding

Want me to draft the redlines for Northwind?

Table widget

The same answer on a phone. On the left, the markdown table hides most of its columns behind a fade, the copy button sits on a header, long cells wrap into tall rows, and the table scrolls both ways inside the chat's own scroll. On the right the frame sits on the text's margins and only scrolls sideways.

Streaming, and phones, again

With all that in, I went back to the two problems I started with, streaming and the phone. Both were fixed, for the same reason. The table doesn't come from text anymore, so there's nothing half-written to render. The reply streams its prose, and then the table arrives as one part with all its rows, fading in after the words before it.

And nothing gets measured anymore. The frame is the full width of the message, its corners on the same margins as the text, and a wide table scrolls inside it. A frame pinned to its parent can't overshoot anything, on a phone or anywhere else.

What I'd keep

Give data its own part. Text that has to be parsed while it streams will look broken while it streams.

Keep big payloads away from the model, and keep the true count with them. A number that's confidently wrong is worse than no number.

When a prompt rule doesn't hold, look for the lines it's competing with before you reword it.

And when no colour looks right, check the technique. Here the fade was the bug, not its colour.


A prompt to build your own

If your chat streams Markdown tables and you want the same thing, here's the prompt I'd hand an agent. It only covers behaviour. How it looks comes from your own design system and theme.

Prompt
Replace the Markdown tables in our AI chat with a real table widget. Use our existing components, design system and theme for every visual decision. This prompt describes behaviour only.1. Stop streaming tables as text- Add a tool the model calls instead of writing a Markdown table, e.g. render_table({ title, columns?, rows? | source_id? | dataset_ref? }).- Prefer pointing at rows the server already has (an earlier tool call's id, or a stored dataset) over the model retyping them. Inline rows are the fallback.- Build the payload on the server: { table_id, title, columns: [{ key, label, type, ref?, hidden? }], rows (capped, e.g. 500), row_count (the true total, never rows.length), truncated, order: "source" }.- Keep rows out of the model's context. Return a small envelope without rows to the model, keep the full payload on the turn, and attach it to a UI-only message part the client renders.- In the system prompt, tool description and schema: never write a Markdown pipe table where the widget exists; anything row-shaped goes through the tool; labels are readable Title Case; no index or "#" column. Remove older prompt lines that still invite Markdown tables. Keep Markdown on surfaces without widgets.2. Render inline in the message- Render a table only once its part has fully arrived, never half-streamed, and fade it in as one unit.- Caption with the shape: "Showing 5 of N rows · M columns", or "N rows" when all are shown.- Show the first 5 rows. If there are more, render 2 extra peek rows, cut the frame through the middle of the last one, and float a "Show all N rows" button over the fade. Peek rows are decoration: inert, aria-hidden, not counted.- The frame spans the message body. Measure nothing in JS. Columns size to content with a minimum width, and a wide table scrolls sideways inside the frame.- No search, filter or sort inline. The preview is in source order, and sorting it would read as a ranking of the whole set.3. Scroll masks- Fade edges with CSS mask-image, not overlay gradients, which cover borders and never match the background.- Combine the vertical and horizontal fades in one mask with mask-composite: intersect.- Each edge fades only when content continues past it, driven by scroll position. The bottom fade is deep enough to bury the peek rows; the side fades stay shallow.4. Panel ("Show all")- Opens outside the message: beside the chat when there is room, over it when there isn't. A close button and Escape close it, and focus returns to the trigger.- Header: the title and a live count, "N of TOTAL rows".- Search highlights matches in place, with a counter and next/previous (Enter, Shift+Enter). It never hides rows. Build a lowercase search index per row once, defer the query, and memoize rows so a keystroke re-renders only rows whose matches changed.- Filters narrow the rows, with operators chosen by column type.- Clicking a header sorts ascending, then descending, then off. Set aria-sort. Nulls sort last.- When truncated, say so. After a sort, say it is sorted within the loaded rows, not ranked across the full set.- Sticky header. Pin the first column and a row-number gutter, with a shadow once content scrolls under them. Use separate borders so pinned dividers move with their cells.- Row selection from the gutter, keyed by row identity so it survives sorting.- Resizable columns. Long values truncate, with a way to reach the full text.- Copy the table as Markdown or CSV, and any single cell on hover.- Export CSV with RFC 4180 quoting and a UTF-8 BOM. Prefix ' to values starting with = + - @ tab or carriage return, unless the value is a number.- Mount the first rows that fill the view when the panel opens, and the rest after its open animation.5. Cells- Format by column type: money, numbers, dates, selects as chips with a stable colour per value, record names as links (via a hidden id column), emails and URLs.- Empty cells show a dash. Unknown types render as text and never throw.6. Accessibility and motion- Real table semantics, keyboard-reachable controls with visible focus, and labels on icon buttons.- Under prefers-reduced-motion, fade with opacity only.Done when no Markdown pipe table reaches the chat, no table renders mid-stream, and every behaviour above works with 0, 1, 5, 6 and 500+ rows, and at phone width.

Articles are only designed for light and dark, so the other color themes are off here.