Answer Paper
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-paperFirst 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
| Prop | Type | Description |
|---|---|---|
levels | readonly AnswerPaperLevel[] | Required. Answer versions ordered from shortest to longest. |
level | number | Optional. Controlled index into levels. |
defaultLevel | number | Optional. Starts with the longest answer when omitted. |
onLevelChange | (index: number) => void | Optional. Called with the selected answer level index. |
paperColor | CSSProperties["backgroundColor"] | Optional. Background color of the paper. |
paperRadius | CSSProperties["borderRadius"] | Optional. Border radius of the paper. |
textColor | CSSProperties["color"] | Optional. Color of the answer text. |
handleColor | CSSProperties["color"] | Optional. Color of the drag handle. |
disabled | boolean | Optional. Disable user interaction. |
ariaLabel | string | Optional. Accessible name for the component. |
className | string | Optional. Additional CSS classes for the root element. |
style | CSSProperties | Optional. Inline styles for the root element. |