BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/ns-ui/context-compaction-river

Context Compaction River

ns-ui/context-compaction-river
FreeComponent

Context compaction drawn as a meandering river: live turns are points on one curving channel, and a compacted run of turns necks off into a reopenable, re-injectable oxbow lake sitting 12px off the channel.

Live preview

live · rendered by the registry
Rendered by ns-ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://design.helpmarq.com/r/context-compaction-river.json

Source

registry/core/context-compaction-river/component.tsxdesign.helpmarq.com/r/context-compaction-river.json · first 6 KB
1"use client";
2
3import { useEffect, useId, useMemo, useRef, useState, type KeyboardEvent as ReactKeyboardEvent } from "react";
4
5// OxbowTurn — the live conversation drawn as one meandering channel in a
6// side rail. Every live turn is a point the channel passes through; the
7// curve itself is decorative (aria-hidden SVG) and carries no information a
8// screen reader needs, because the same facts live as plain text in a real
9// list right below it ("Live context, N turns" / "Compacted: turns 3-9,
10// summarized 2 minutes ago").
11//
12// When turns get folded into a summary, the component doesn't just drop a
13// row — the compaction keeps its own place in the sequence, and the channel
14// simply stops routing through it: the surviving points ease toward their
15// new (tighter) spacing over ~300ms, which is what "the river gets shorter"
16// looks like here, while the folded turns settle 12px off the channel as a
17// closed oxbow-lake shape carrying a token-count chip. That chip is a real,
18// focusable button (never aria-hidden) — opening it reveals the summary and
19// a re-inject action in a role=menu popover. Re-inject animates the lake
20// back onto the channel before the prop change actually removes it, so nothing
21// is left to imagination between "click" and "the turns are back".
22//
23// The trigger is deliberately open-only (a second click does not close it —
24// only Escape, an outside click, or choosing the menu item does). That is
25// what keeps a synthetic "press" pass (which clicks the first control once,
26// unconditionally) and a later scripted "open this" check from fighting over
27// the same toggle.
28//
29// Positions are computed from each item's index in the full sequence (turn
30// or compaction alike), so a compaction never needs its own bookkeeping of
31// "where it used to be" — it already has a slot. Turn dots and the channel
32// path animate via a direct rAF loop (setAttribute only, no React state on
33// the hot path, sleeps once settled) exactly like this repo's other
34// spring-driven diagrams. Everything else (the oxbow's 12px settle, its
35// entrance/exit) is a plain CSS transform+opacity transition, which reduced
36// motion turns off wholesale in favor of an instant fade-and-move.
37
38export type OxbowTurnEntry = {
39 id: string;
40 /** short label, e.g. a turn number — used to build "turns 3-9" range text */
41 label: string;
42};
43
44export type OxbowTurnItem =
45 | { kind: "turn"; id: string; label: string; preview?: string }
46 | {
47 kind: "compaction";
48// … truncated

Files it writes

  • registry/core/context-compaction-river/component.tsx

Facts

Registry
ns-ui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-02
Last confirmed
yesterday

Go to the source

Docs on ns-ui design.helpmarq.com nikolas-sapa/ns-ui on GitHub Raw registry item This item as JSON

More from ns-ui

All 228 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordion Latchaccordion-latchns-uiComponentsFreeno deps
Approval Inline Diffapproval-inline-diffns-uiComponentsFreeno deps
ASCII Engraving Contourascii-engraving-contourns-uiComponentsFreeno deps
ASCII Globe Spinascii-globe-spinns-uiComponentsFreeno deps
ASCII Torus Donutascii-torus-donutns-uiComponentsFreeno deps
Autosave Ratchetautosave-ratchetns-uiComponentsFreeno deps
Avatar Stack Flockavatar-stack-flockns-uiComponentsFreeno deps
Background ASCII Ditherbackground-ascii-ditherns-uiComponentsFreeno deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex