Skip to content
WunderUI

Search Result Card

Pro

One ranked result of a web-search tool call: the source, how well it matched, a link to the page and a snippet of its text.

Playground

1

wunderui.com/components/tabs

94% match
Keyboard interaction for tabs

Arrow keys move focus between tabs. Home and End jump to the first and last tab. Only the selected tab is in the tab sequence.

Installation

Search Result Card comes with WunderUI Core and Pro, in the package from your plan. See the plans.

Then import what you need:

tsx
import {
  SearchResultCard,
  SearchResult,
  SearchResultRow,
} from "@wunderui/react"

Then use it:

tsx
import { SearchResultCard } from "@wunderui/react"

export function Result() {
  return (
    <SearchResultCard
      rank={1}
      title="Keyboard interaction for tabs"
      url="https://wunderui.com/components/tabs"
      snippet="Arrow keys move focus between tabs."
      relevance={0.94}
    />
  )
}

Expected result: You see a card with the number 1, the link icon with wunderui.com and /components/tabs, a 94% match badge, the title as a link and the snippet below. The link opens in a new tab.

When to use

Use Search Result Card for

  • The ranked results of a web-search or document-search tool call
  • A result the agent's answer cites, marked next to the ones it did not use
  • Results from the open web, where host and path help judge the source

Use something else for

  • Source List for the sources pinned under a final answer, as a compact list
  • Chat Source for a source cited inside a chat message
  • List Group for any other list of rows that are not search results

Source

The source line shows the host without www and the URL path, so people can judge the page before opening it. The query string is left out, and only http(s) and relative URLs become links.

Snippet

The snippet is any content. Highlight the words of the query with a mark element, or clamp the text to a few lines; the card never shortens it.

wunderui.com/components/tabs

Keyboard interaction for tabs

Arrow keys move focus between tabs. Home and End jump to the first and last tab. Only the selected tab is in the tab sequence.

Rank and match

The rank and the match badge are optional. Pass a relevance score only when the search tool returns one.

Meta

1

wunderui.com/components/tabs

94% match
Keyboard interaction for tabs

Arrow keys move focus between tabs. Home and End jump to the first and last tab. Only the selected tab is in the tab sequence.

States of the list

A search that is running, empty or failed has no result to show, so these are not card states. Build them from Skeleton, Empty State and Alert where the list will be.

List state

  • 1

    wunderui.com/components/tabs

    94% match
    Keyboard interaction for tabs

    Arrow keys move focus between tabs. Home and End jump to the first and last tab. Only the selected tab is in the tab sequence.

Result row

SearchResultRow is one hit in a result list or a command palette: an icon tile, a title, a two-line excerpt, where the hit lives and a chevron. With href the row is a link; without it a button that runs onSelect, so Enter and Space both work and nothing jumps to #. SearchResultCard stays the ranked result of an agent's web search; SearchResultRow replaces SearchResult.

Select and cited

With onSelect the whole card is one button, so Enter and Space work and hover and focus are visible. The title is then plain text, because a link inside a button is not valid. cited adds a "Cited" badge, so the state is not told by colour alone.

Select

Keyboard interactions

The only control is the title link, a native anchor, so the browser handles focus and activation.

TaborShiftTab
Moves focus to the title link of the next or previous card. Nothing else in the card takes focus.
Enter
Opens the page in a new tab. The opener and the referrer are not passed on.

Behavior and motion

How the card reads a URL and a score, what it links to and what it leaves to the list around it.

Source line
The host loses a leading www., the path shows unless it is just a slash, and the query string and hash are dropped. A value that is not a valid URL, such as docs/install, shows as given.
Link safety
The title links only for http(s) URLs and relative paths, and other schemes such as javascript or data show as plain text. Links open in a new tab and withhold the opener.
New tab
Nothing in the link tells a screen reader that it opens a new tab. If that matters, say so in the text around the list.
Relevance
A value up to 1 is a fraction and anything above is a percentage, rounded: 0.944 and 94.4 both read 94% match. The value is not clamped, so pass a real number or none.
Selected
Selected switches the border to primary, the fill to subtle and the badge to indigo. Hover changes nothing, because the card is not a control.
No images
The card shows no favicon and makes no request of its own. The icon beside the host is a fixed link icon.
Long content
Nothing is shortened: the title and snippet wrap, and a long path breaks at any character. To clamp the snippet, wrap it in a span with a two-line clamp.
States of the list
Loading, no results and a failed search are not card states. Build them from Skeleton, Empty State and Alert where the list goes, and mark the list busy while the search runs.
Motion
None. The title underlines on hover, and there is no animation to switch off.
Reduced motion
Reduced motion changes nothing.

Anatomy

The figure shows a result with every optional part. The link icon belongs to the source line and has no number of its own.

1

wunderui.com/components/tabs

94% match
Keyboard interaction for tabs

Arrow keys move focus between tabs. Home and End jump to the first and last tab. Only the selected tab is in the tab sequence.

  • data-slot="search-result-card"

    An article with a 1 px border, 16 px radius and 16 px padding. A selected result gets the primary border and the subtle fill.

  • Optional

    A 22 px circle with the position of the result, shown when a rank is set. It sits on the subtle fill, or on the card colour when selected.

  • Optional

    A link icon, the host without www. in medium text and the path in tertiary text. The query string and the hash are left out.

  • Optional

    A light Badge reading 94% match, shown when a relevance is set. Grey normally, indigo on a selected result.

  • The title in semibold link colour. It opens in a new tab, and only for http(s) URLs and relative paths.

  • Optional

    13 px secondary text under the title, any content you pass. It is not shortened, and an empty snippet is not rendered.

  • data-slot="search-result-row"Optional

    One search hit as a row, for a result list or a command palette: a 40 px icon tile in the indigo tint, a title, a two-line excerpt, where the hit lives and a chevron. With it is a link, without it a button. It replaces SearchResult.

  • Optional

Best practices

  • Do

    Pass the full URL with its scheme, so the card can show host and path and people can judge the source before opening it. A relative path of an internal search works too.

  • Do

    Put the cards in a list with one item per card. The card is an article without a name of its own.

  • Do

    Mark the cited result as selected and say it in words too, for example The answer cites result 2 in a status line. The card sets no ARIA state for selection.

  • Do

    Highlight the words of the query with mark and keep the snippet as text. It comes from the web, so never pass it as HTML.

  • Do

    Show a running, empty or failed search in the list itself, with a Skeleton, an Empty State or an Alert, and announce it in a status line.

  • Don’t

    Don't invent a relevance score. Pass one only when the tool provides it, or the badge claims a precision that does not exist.

  • Don’t

    Don't pass 1 to mean 1%, because values up to 1 are fractions and 1 reads 100% match. Use 0.01 for one percent.

  • Don’t

    Don't add a favicon from a third-party service. It tells that service what the agent searched for, so the card leaves it out on purpose.

API reference

SearchResultCard is a plain component, so the table lists every prop. It passes no other props on to the article. SearchResultRow renders a link or a button and takes only the props listed under it.

An article with a 1 px border, 16 px radius and 16 px padding. A selected result gets the primary border and the subtle fill.

PropTypeDefaultDescription
title requiredReactNode—The text of the link. Any content; it wraps and is never shortened.
url requiredstring—The address of the page. The card shows its host and path and links to it when it is http(s) or a relative path. Any other scheme is shown as plain text.
ranknumber—The position of the result, shown in a circle before the source line. Leave it out for an unordered list.
snippetReactNode—The text under the title. Any content, so it can hold for the words of the query. An empty value renders nothing.
relevancenumber—The match score. 0 to 1 is a fraction and above 1 a percentage, rounded and written as . Hidden when not set.
selectedbooleanfalseMarks the result the agent cited: primary border, subtle fill, indigo badge and . It sets no ARIA state, so say it in text as well. Default .
citedbooleanfalseThe agent used this result in its answer: shows a "Cited" badge.
onSelect() => void—Makes the whole card a button, for example to open the source in a side panel. The title is then text, not a link.
classNamestring—Extra classes for the card, for example a maximum width. It is by default.

One search hit as a row, for a result list or a command palette: a 40 px icon tile in the indigo tint, a title, a two-line excerpt, where the hit lives and a chevron. With it is a link, without it a button. It replaces SearchResult.

PropTypeDefaultDescription
title requiredReactNode—The name of the hit. Required.
descriptionReactNode—A short excerpt under the title, cut after two lines.
metaReactNode—Where the hit lives and when it changed, in 11 px tertiary text, such as .
iconReactNode—The icon in the tile. A document icon when left out.
hrefstring—Makes the row a link. Without it the row is a button, so nothing jumps to .
onSelect() => void—Called when the row is pressed, also on a link.
classNamestring—Extra classes on the row.

PropTypeDefaultDescription
title requiredReactNode—
descriptionReactNode—
hrefstring—
iconReactNode—
metaReactNode—
onSelect() => void—

Notes for AI

Give your coding assistant the Markdown reference instead of screenshots.

MCPget_component("search-result-card")
InstallIncluded in Core and Pro

The full library index for assistants is at /llms.txt.