Inline Citation

A source that sits in the sentence it supports, and opens on hover.

Usage

Inline Citation

Next.js streams a route in chunks, so the page shows up before every request finishes. nextjs.org : Linking and Navigating (opens in a new tab)

Wrap a slow part of the page in a Suspense boundary and React sends the fallback first. When the data resolves, the finished HTML streams into the same response and replaces the fallback, with no extra request from the browser. react.dev : <Suspense> (opens in a new tab) Server Components help here, because their code never ships to the browser. react.dev : Server Components (opens in a new tab)

A loading.tsx file does the same for a whole route segment. nextjs.org : loading.js (opens in a new tab) It all runs over chunked transfer encoding, so there is nothing extra to set up. developer.mozilla.org : Transfer-Encoding (opens in a new tab)

import { Component, ViewEncapsulation, computed, input } from '@angular/core';import {  ScLink,  ScPreviewCard,  ScPreviewCardPortal,  ScPreviewCardProvider,  ScPreviewCardTrigger,} from '@semantic-components/ui';
interface Source {

A Link component in a small secondary button look, with a Preview Card of the page. To list the sources after the reply, use Sources.

Anatomy

import {  ScPreviewCardProvider, ScPreviewCardTrigger, ScPreviewCardPortal, ScPreviewCard,  ScLink,} from '@semantic-components/ui';
<span scPreviewCardProvider>  <a scLink scPreviewCardTrigger variant="secondary" size="xs"     [href]="url" target="_blank" rel="noreferrer">    {{ hostname }}    <span class="sr-only">: {{ title }} (opens in a new tab)</span>  </a>  <ng-template scPreviewCardPortal>    <div scPreviewCard class="flex w-64 flex-col gap-1">      <div class="font-medium">{{ title }}</div>      …    </div>  </ng-template></span>

Accessibility

Not shadcn's: there, the citation is a button, and the link to the source sits in the card. A preview card is for the eyes only — not announced, not reached with the keyboard — so here the citation is the link itself: Tab reaches it, Enter follows it, and its name says where it goes (the title, in hidden text, and that it opens in a new tab). The card only previews it.

Examples

RTL

يبثّ Next.js المسار على دفعات، فتظهر الصفحة قبل أن ينتهي كل طلب. nextjs.org : التنقل والروابط (يُفتح في علامة تبويب جديدة)

import { Dir } from '@angular/cdk/bidi';import { Component, LOCALE_ID, ViewEncapsulation } from '@angular/core';import {  ScLink,  ScPreviewCard,  ScPreviewCardPortal,  ScPreviewCardProvider,  ScPreviewCardTrigger,} from '@semantic-components/ui';

API reference

See the Preview Card and the Link component.