Compaction markerPro
Where a thread was compacted: one quiet line that says how many messages became a summary and how much room it made, with the summary one click away.
On this page
Installation
Usage
import { CompactionMarker } from "@/components/ui/chatcn/pro/compaction-marker"
<CompactionMarker
status={status}
messages={48}
before={182400}
after={23900}
limit={200000}
summary={summary}
/>A hairline across the conversation with the label at its centre, in the family of the free conversation divider. Compacting, the label shimmers with the number of messages being summarized. Done, it reads Earlier messages summarized, the count, and before to after tokens, with a 40 px meter: the old fill stays as a ghost and the new fill settles to its level once, so the room it made is visible at a glance. History that mounts already summarized shows the new fill at once. The summary opens below with a start rule, like reasoning, and can stream with the caret. onShowOriginals adds a link back to the kept messages. A failure says what to do next, with a retry.
Examples
States
Props
| Prop | Type | Notes |
|---|---|---|
status | "compacting" | "done" | "error" | Default done |
messages | number | How many messages the summary replaces |
before, after, limit | number | Tokens. The meter needs all three |
summary | string | string[] | ReactNode | Strings render as paragraphs |
streaming | boolean | The summary is still being written |
open, defaultOpen, onOpenChange | boolean | |
onRetry, onShowOriginals | () => void | |
labels | Partial<CompactionMarkerLabels> | Every string, for translation |
Keyboard
| Key | Action |
|---|---|
| Enter or Space | Open or close the summary |
Accessibility
- The marker is a button with
aria-expanded; the closed summary isinert. - Before and after are read as
182k to 24k tokens; the meter is decorative. - Failure is announced with
role="alert".
Motion
The summary opens in 200 ms on grid rows with a fade. The meter settles in 300 ms on the kit's ease in out, once per compaction. Reduced motion removes both and keeps the shimmer static.