Skip to content
pandacoderz/ui

Answer with Sources

Search-style answer with inline citations, a source grid, and follow-up questions.

Answer With Sources
Open preview

What’s inside

  • Prompt Input as the search bar, with a stop button while the answer streams.
  • Citation renders numbered chips inside the answer and source cards above it. Hovering either highlights both.
  • Suggestions power the empty state and the follow-up questions.
  • Text Shimmer narrates the searching, reading, and writing phases.

Installation

npx shadcn@latest add https://ui.spencerwueste.com/r/answer-with-sources.json

The registry item pulls in every component it depends on.

Usage

import AnswerWithSources from "@/components/blocks/answer-with-sources/answer-with-sources";

export default function Page() {
  return (
    <div className="h-dvh p-4">
      <AnswerWithSources />
    </div>
  );
}

Give the parent a bounded height. The block fills it and scrolls internally.

Going live

The ask function drives three phases: fetch sources, then stream the answer. Point it at your search endpoint for the sources and your model for the text, and keep [n] markers in the model output so CitedText can link them.