Answer Paper

View registry JSON

Drag the paper’s bottom handle to shorten an answer or restore its detail.

Install with the shadcn CLI

npx shadcn@4.21.5 add @cavemio/answer-paper
First install? Configure @cavemio once

Run npx shadcn@4.21.5 init if shadcn is not set up, then merge this entry into the registries field in your existing components.json. Keep your other settings and registries.

components.json
{
  "registries": {
    "@cavemio": "https://registry.cavemio.dev/r/cavemio-{name}.json"
  }
}

Overview

Drag the paper’s bottom handle to shorten an answer or restore its detail.

The demo reproduces the supplied video’s four prepared answer versions. The component displays caller-provided summaries; it does not generate AI text or make network requests.

import { CavemioAnswerPaper } from "@/components/cavemio-answer-paper";

<CavemioAnswerPaper paperColor="#fffdf8" paperRadius={26} levels={[{ id: "short", label: "Brief", readTime: 1, content: <p>The short answer.</p> }, { id: "full", label: "Full answer", readTime: 10, content: <p>Your complete answer and supporting details go here.</p> }]} />

Props

PropTypeDescription
levelsreadonly AnswerPaperLevel[]Required. Answer versions ordered from shortest to longest.
levelnumberOptional. Controlled index into levels.
defaultLevelnumberOptional. Starts with the longest answer when omitted.
onLevelChange(index: number) => voidOptional. Called with the selected answer level index.
paperColorCSSProperties["backgroundColor"]Optional. Background color of the paper.
paperRadiusCSSProperties["borderRadius"]Optional. Border radius of the paper.
textColorCSSProperties["color"]Optional. Color of the answer text.
handleColorCSSProperties["color"]Optional. Color of the drag handle.
disabledbooleanOptional. Disable user interaction.
ariaLabelstringOptional. Accessible name for the component.
classNamestringOptional. Additional CSS classes for the root element.
styleCSSPropertiesOptional. Inline styles for the root element.