Xzero UI
Pro library

Vector searchPro

Documents drop onto a tilted embedding plane and fold into points that cluster by topic; the index links neighbours, a query is typed, embedded and lowered onto the plane, a signal hops along the graph toward it, and a widening ring lights the nearest documents with connecting lines, similarity scores and a ranked list.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/vector-search
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/vector-search

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { VectorSearch } from "@/components/xzero/vector-search/vector-search";

export function RetrievalSection() {
  return <VectorSearch
    topics={[{ name: "Billing" }, { name: "Access" }, { name: "Deploys" }]}
    documents={[
      { title: "Refund a charge", topic: 0 },
      { title: "Update a card on file", topic: 0 },
      { title: "Download invoices", topic: 0 },
      { title: "Rotate an API key", topic: 1 },
      { title: "Scope API tokens", topic: 1 },
      { title: "Revoke a session", topic: 1 },
      { title: "Roll back a deploy", topic: 2 },
      { title: "Preview environments", topic: 2 },
      { title: "Add a custom domain", topic: 2 },
    ]}
    query="How do I rotate a leaked API key?"
    k={3}
  />;
}

API reference

VectorSearch

An animated vector search illustration. Documents drop onto a tilted embedding plane as small pages and fold into points in their topic color, while a readout beside the plane shows each one's title and vector. Similar documents land close together, so dashed clusters fade up around each topic and the index links every point to its nearest neighbours. Then the query is typed, embedded (its vector replaces the document's in the readout), and lowered onto the plane on a thin stem. A search signal enters the graph at the farthest point and hops along real links toward the query, lighting its path, before a ring widens from the query: each match it reaches gets a halo, a line to the query, and a similarity score, and fills a ranked list with the source of each document. Counters for embedded documents, links, and hops update in sync, and a step bar with play and pause replays or jumps between stages.

PropTypeDefaultDescription
documents{ title: string; topic: number; source?: { name: string; icon?: string | ReactNode; color?: string }; x?: number; y?: number }[]18 help articles across Billing, Access, and DeploysDocuments in the index, 6 to 24. topic indexes into topics. source is shown beside a match in the results: icon is Simple Icons path data (painted in color, or the text color when color is left out), an image URL for a full color logo, or a ReactNode. x and y place the point on the plane from -1 to 1; left out, points spiral around their topic's center.
topics{ name: string; color?: string }[]Billing, Access, DeploysTopics the documents cluster by, two to four. Each gets a region of the plane, a dashed cluster, and a name chip. color overrides the chart series color.
querystring"How do I rotate a leaked API key?"The search query, typed into the readout before it is embedded.
queryAt{ x: number; y: number }–Where the query lands on the plane, from -1 to 1. Defaults to beside the first document of the second topic.
knumber3How many nearest documents are returned, from 1 to 5.
dimensionsnumber1536Embedding size shown in the readout heading.
labels{ embed?; index?; query?; rank?; embedded?; links?; hops?; embedding?; queryHeading?; results?; queryChip? }Embed, Index, Query, Rank, Embedded, Links, Hops, Embedding, Query, Nearest documents, QueryStage names in the step bar, the three counter names, the readout headings, the results heading, and the chip on the falling query.
speednumber1Multiplies the pace. At 1 the whole story takes about 18 seconds. 0 holds still.
pausedbooleanfalseHolds the diagram still where it is, easing to rest instead of stopping in one frame.
controlsbooleantrueShows the step bar with play and pause above the diagram.
accentstring–Color of the query, the search path and signal, the ring, the match lines, and the score bars. Defaults to the accent token.
labelstring–Accessible description of the diagram. Built from the topics, the query, the hop count, and the real matches with their scores when left out.
captionReactNode–Optional visible caption under the diagram, rendered as a figcaption.
classNamestring–Extra class on the root figure.
styleCSSProperties–Inline styles on the root figure.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in illustrations

Guidance for AI tools

Vector search: Documents drop onto a tilted embedding plane and fold into points that cluster by topic; the index links neighbours, a query is typed, embedded and lowered onto the plane, a signal hops along the graph toward it, and a widening ring lights the nearest documents with connecting lines, similarity scores and a ranked list. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components