All components

Reasoning

AI

The collapsible "thinking" trace from AI chat UIs — shimmers while streaming, then auto-collapses to a summary. Height animates with the grid-rows technique (no JS measurement), and it stays fully accessible and dependency-light.

The user wants a smooth reveal. Measure the content height implicitly with a grid row, then ease grid-template-rows from 0fr to 1fr so nothing reflows. Shimmer the label while streaming, and collapse automatically once the answer is ready.

Installation

Terminal
npx shadcn@latest add https://ui.saumyarex.xyz/r/reasoning.json

Props

PropTypeDefaultDescription
isStreamingbooleanfalseTrue while the model is producing its reasoning. Auto-expands the panel and shimmers the label; collapses automatically when it flips back to false.
durationnumberSeconds spent thinking, shown in the trigger once finished.
open / defaultOpenbooleanControlled / uncontrolled open state. Defaults to isStreaming.
onOpenChange(open: boolean) => voidFires when the user toggles the panel.

Dependencies

clsxtailwind-merge