Skip to content
WunderUI

Source List

Pro

The numbered sources of an answer, with an icon per kind of source, a line of detail and links that open in a new tab. The numbers match the citations in the text.

Playground

Sources

5 pinned
  1. 1q3-report.pdfFile · 2.4 MB
  2. 2Pricing, WunderUIwunderui.com · web page
  3. 3Billing migration planDocument · edited by Priya Raman
  4. 4#release-notesChannel · 128 messages
  5. 5Changelog, WunderUIwunderui.com · web page

Installation

Source List comes with WunderUI Core and Pro, in the package from your plan. See the plans.

Then import what you need:

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

Then use it:

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

const sources = [
  { title: "q3-report.pdf", meta: "File · 2.4 MB", kind: "file" },
  { title: "Pricing, WunderUI", meta: "wunderui.com · web page", kind: "web", href: "https://wunderui.com/pricing" },
] as const

export function Sources() {
  return <SourceList id="answer-sources" sources={[...sources]} />
}

Expected result: You see a card titled Sources with 2 pinned and two numbered rows. The second row is a link.

When to use

Use Source List for

  • The sources an answer used, with numbers that match the citations in the text
  • A set of pinned files, documents, web pages and channels in a chat
  • A list the reader can open in a new tab

Use something else for

A source with an http(s) or relative link opens in a new tab. Any other address, such as file:, mailto: or javascript:, is shown as plain text.

Amount

The list grows with the array and counts the rows it shows. It has no limit and no empty state of its own.

Sources

1 pinned
  1. 1q3-report.pdfFile · 2.4 MB

Pass a title to name the list. The count on the right is fixed text, N pinned.

Sources

3 pinned
  1. 1q3-report.pdfFile · 2.4 MB
  2. 2Pricing, WunderUIwunderui.com · web page
  3. 3Billing migration planDocument · edited by Priya Raman

Text

Titles and detail lines wrap onto more lines inside the card and never run out of it.

Newer props

countLabel replaces the word after the count and an empty string hides it. highlight marks the source a citation points at. Each row has an id (id-1, id-2) so a citation can scroll to it.

Own count label and a highlighted source

Sources

3 cited
  1. 1Payouts overviewacme.dev/docs/payouts
  2. 2Instant payoutsacme.dev/docs/instant
  3. 3Fee scheduleacme.dev/pricing

Keyboard interactions

Only the rows that are links take part. The list itself handles no keys.

TaborShiftTab
Moves through the linked rows in order. A row that is not a link is not a stop.
Enter
Follows the link of the focused row, in a new tab.

Behavior and motion

What the list does with numbers, links, text and assistive technology.

Numbers
A row's number is its place in the array plus one, and you can't set it. With a list id, each row gets an id from it plus its number, so a citation can link to it.
Links
A source with an http(s) or relative link opens in a new tab without exposing the opener, and the row doesn't say so, so mention it in the meta line if it matters. Any other link draws a plain row.
Count
The header reads N pinned for the rows drawn, such as 1 pinned or 7 pinned. Set to use another word, or an empty string to hide it.
Empty
An empty array draws the header with 0 pinned and an empty list. There is no empty text, so draw your own sentence instead of the list.
Kinds
Kind picks the icon: web (default), file, doc or channel. The icon is the only visual of a source, with no favicon and no loading state.
Long text
Titles and meta lines wrap and nothing is cut. A long list title wraps in the header beside the count.
Assistive technology
The section is named by the title when it is a string, otherwise Sources. The title is a fixed h3, so place the list under an h2.
Motion
The list has no motion. A link row changes nothing on hover, only its focus ring appears.
Reduced motion
There is nothing to reduce.

Anatomy

The parts the component is made of. Each one renders a you can target from CSS.

Sources

3 pinned
  1. 1Pricing, WunderUIwunderui.com · web page
  2. 2Billing migration planDocument · edited by Priya Raman
  3. 3q3-report.pdfFile · 2.4 MB
  • data-slot="source-list"

    A section with a 1 px border and a 16 px radius, named by the title when it is a string, otherwise Sources. It is as wide as its container.

  • The title in 14 px semibold, Sources by default.

  • N pinned, the number of rows drawn, in 12 px tertiary text. replaces the word and an empty string hides the count.

  • One item of an ordered list with a hairline above it. With a list id each row gets that id plus its number, and a source with an http(s) or relative link is an anchor, any other a span.

  • A 20 px indigo tint circle with the place of the source in the array, starting at 1. A citation points to this number.

  • A decorative 16 px Lucide icon by kind: a globe for web (the default), a file, a document or a channel. There is no favicon.

  • The title in 14 px medium and an optional meta line in 12 px secondary text, for the domain, size or editor. Both wrap.

Best practices

  • Do

    Number citations from the same array. Link citation 2 to the row with id answer-sources-2, so both numbers cannot drift apart.

  • Do

    Put the domain, size or editor in the meta line. There is no favicon, so the line under the title is where a person sees where a source comes from.

  • Do

    Pass a link only for http(s) and relative addresses. Anything else, such as file, mailto, javascript or data, is drawn as a plain row, so a source from the open web cannot run code.

  • Do

    Cut a long list yourself. Slice the array from the start so numbers still match the citations, and add a button saying how many are hidden, like Show 3 more.

  • Do

    Draw the list only when there is something to list. Say No sources were used for this answer or show skeleton rows while sources are looked up.

  • Don’t

    Don't pass an empty array. The list draws its header with 0 pinned and nothing else.

  • Don’t

    Don't reorder the array after the answer was written. The numbers in the text are places in the array.

  • Don’t

    Don't use a long sentence as the title. It sits beside the count on one row and wraps, so keep it to a word or two.

API reference

SourceList is a plain component, so the table lists every prop. A source has a title, and optionally a meta line, a kind and a link.

A section with a 1 px border and a 16 px radius, named by the title when it is a string, otherwise Sources. It is as wide as its container.

PropTypeDefaultDescription
sources requiredSource[]—The sources, in order. Each has a , an optional line, an optional (, , or , default ) and an optional . The place in the array is the number.
titleReactNode"Sources"The heading of the list. Default . When it is a string it also names the section for assistive technology.
idstring—Gives the rows ids: , and so on, for citations to link to. Without it the rows have no id.
classNamestring—Extra classes for the list, for example a maximum width.
countLabelstring"pinned"The word after the count in the header ("3 pinned"). Pass an empty string to hide the count.
highlightnumber—1-based number of the source a citation points at right now. It gets a subtle fill and .

Notes for AI

Give your coding assistant the Markdown reference instead of screenshots.

MCPget_component("source-list")
InstallIncluded in Core and Pro

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