# Truncation

Truncation cuts a line of text that does not fit its space and ends it with an ellipsis, so a long customer name or task title does not break the layout. It is only acceptable when people can still read the whole text when they need it. Meadowstack's `Truncate` shows the full text in a tooltip on hover, from the keyboard and on touch, and only when the text is really cut.

Checked 2 December 2026. By Bohuslav Poláček. https://meadowstack.com/glossary/truncation/

*The header of the kit's Truncate: an ellipsis, the whole text only when it is really cut, from a mouse, a keyboard or a finger, and kept for screen readers.*

From `packages/kit/src/components/truncate.tsx` in the Meadowstack repository:

```tsx
* Truncate: text that may not fit its column (a block on a machine plan, a
* name in a narrow table cell, a task on a Gantt bar, a description of two
* lines). Bob, 25 Oct 2026: "we have to solve what to do when an element does
* not fit here; maybe a hover that stretches it so we can read it?" The text
* ends in an ellipsis, after one line or after `lines`, and only when it is
* really cut can it be read whole in the kit's tooltip (2 Dec 2026, decision
* 0020, the audit's truncation-access: "it has to work from the keyboard and
* on touch too, a title alone is not enough where it is the main content"):
* - with a mouse, on hover after the usual 400ms (also under a control
*   stretched over its row or card, which takes the pointer from the text);
* - from the keyboard: when the control the text sits in (a link, a button, a
*   menu item) takes focus from the keyboard, the first cut text in it opens
*   at once; cut text in no control takes a tab stop of its own while it is
*   cut (with the focus ring), and text that fits never does;
* - on a touch screen: a tap opens and closes it; inside a control a tap does
*   what the control does (the record it opens shows the whole text), and a
*   touch and hold of half a second opens the tooltip instead.
* The tooltip shows the text as plain words (a link inside is not copied into
* it). The full text stays in the accessibility tree, so a screen reader never
* hears the ellipsis. Content that cuts its own lines (a link with `truncate`,
```

## Why it matters in a business app

Business data has long values in narrow places: a supplier's full legal name in a 176px column, a task on a Gantt bar two days wide, a machine job on a plan. Wrapping makes rows different heights and breaks the scan down a table; overflowing text runs into the next column.

Cutting with an ellipsis keeps the rows even, but two suppliers whose names start the same now look identical. People need a way to see the rest without opening the record.

## How Meadowstack handles it

- **One component.** AGENTS.md: cut text is `Truncate`. `DataTable` cells use it, and a column kind's width becomes the cap at which the text ends in an ellipsis.
- **A tooltip only when cut.** It measures whether the text is really cut when it mounts, when its content changes, when its box resizes and when a web font lands, and only cut text offers the whole in the kit's tooltip. Text that fits shows nothing extra.
- **Readable for everyone.** With a mouse the tooltip opens on hover after the usual 400ms. From the keyboard it opens when the link or button the text sits in takes focus; cut text in no control takes a tab stop of its own while it is cut. On touch a tap opens it, and inside a control a touch and hold does. The full text stays in the accessibility tree, so a screen reader never hears the ellipsis.
- **A shorter form.** `short` swaps in a shorter text, such as a first name, instead of an ellipsis when the whole does not fit, and swaps back as soon as there is room.
- **Even rows.** Rows in a list are one height; secondary facts get their own one-line column.

## Common mistakes

- **Cutting what people must read whole.** A rejection reason or a message is not a label; the kit's manifest marks `Truncate` "not" for text people must read whole.
- **A tooltip only a mouse can open.** Keyboard and touch users never see the rest.
- **Cutting IDs and amounts.** "INV-2026-04…" and "12,48…" are worse than useless; give those columns their kind's width.
- **Tooltips on everything.** A tooltip on text that already fits is noise.

## Questions

### Should long text in a table wrap or truncate?

In a list people scan, truncate to keep rows one height and show the full text on hover and focus. Text people must read whole, such as a comment, should wrap in a place made for it.

### Is truncated text accessible?

It can be, when the full text stays available to screen readers and a keyboard user can reveal it as a mouse user can. Meadowstack's Truncate does both.

### How do I truncate text with CSS?

For one line, overflow hidden, white-space nowrap and text-overflow ellipsis on an element with a set width. Showing the rest on demand needs a small script that checks whether the text is actually cut.

## Related

- [Business app UI check](https://meadowstack.com/tools/ui-check/) (Tools)
- [Data tables in business apps: kinds, figures, headers, cut text](https://meadowstack.com/blog/data-tables-in-business-apps/) (Blog)
- [The business app UI standard, with the numbers behind each rule](https://meadowstack.com/blog/business-app-ui-standard/) (Blog)
- [BulkBar: what to do with the selection](https://meadowstack.com/components/bulk-bar/) (Components)
- [DataTable: the table of every list](https://meadowstack.com/components/data-table/) (Components)
- [StatusLabel: a status as a glyph and a word](https://meadowstack.com/components/status-label/) (Components)
