This component no longer exists. It was in ns-ui’s manifest when we first indexed it and is not there now — the registry served its inventory on 2026-08-07 and this item was not on it. The install command below will fail. It is kept here because a tutorial somewhere still tells people to run it.
Context Prompt Shims
ns-ui/context-prompt-shimsRemovedComponent
Prompt composition rendered as machinist shims fitted into a fixed-height gap: each section's row height maps to its real token count, order is drag/keyboard reorderable with FLIP transforms, and an over-budget insert compresses the stack, bounces back to the tray, and surfaces a truncation remedy instead of an error string.
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-prompt-shims.jsonSource
1"use client";23import {4 useCallback,5 useEffect,6 useId,7 useMemo,8 useRef,9 useState,10 type KeyboardEvent as ReactKeyboardEvent,11 type PointerEvent as ReactPointerEvent,12} from "react";1314// ---------------------------------------------------------------------------15// ShimFit — prompt composition as fitting machinist's shims into a gap of16// fixed height (the context window). Every section (system / tools / memory17// / retrieved docs / user message) is a real DOM row whose height maps to its18// token count; stack order IS prompt order, reordered by drag or by a full19// keyboard listbox pattern (Space lifts, arrows move, Space drops) with FLIP20// transforms on every reorder. Remaining budget is a real empty clearance21// region above the stack, never a percentage bar. Inserting a tray candidate22// that would blow the budget elastically compresses the stack, springs the23// candidate back to the tray, pulses the largest truncatable row's edge, and24// opens a persistent "thin this one" remedy — no error string, a visible25// non-fit plus a suggested fix. Pure DOM/CSS, no canvas.26// ---------------------------------------------------------------------------2728export interface ShimSection {29 id: string;30 label: string;31 tokens: number;32 /** may be offered as the trim target when an insert overflows */33 truncatable?: boolean;34 /** floor tokens can't be trimmed below; defaults to 30% of initial tokens */35 minTokens?: number;36}3738export interface ShimFitProps {39 /** total context-window budget, in tokens */40 budget?: number;41 /** initial stack, top-to-bottom = prompt order */42 sections?: ShimSection[];43 /** candidates waiting in the tray, not yet part of the prompt */44 candidates?: ShimSection[];45 /** px per token for row height (min 8px floor still applies) */46 scale?: number;47 className?: string;48 "aria-label"?: string;49}5051// Floor a row at 16px, not 8px: an 8px row cannot contain its own ~14px label,52// so a thin row (e.g. a 120-token message) let its centered text bleed past the53// row and — being the last row, flush at the frame's clipped bottom edge — get54// severed by the frame's overflow-hidden. 16px holds the (hairline-sized) label55// cleanly; the stack still fits with clearance to spare.56const MIN_ROW_PX = 16;57const HAIRLINE_PX = 18;58const COMPRESS_MS = 120;59const FLIP_MS = 320;60const FLIP_EASE = "cubic-bezier(0.22,1,0.36,1)";61const PULSE_MS = 620;62const SUGGEST_DISMISS_MS = 9000;6364const DEFAULT_SECTIONS: ShimSection[] = [65// … truncated
