Skip to content

Marker

Small inline markers inside a reply: numbered citations that link to their sources (with a preview on hover and focus), and status markers such as "Searching…", "Done" or "Error". Same markup and props in every style: switch the style in the header to see it change.

Citations

Numbered chips after a sentence. Hover or focus one to see the source; Escape hides the preview.

The Fetch API returns a promise that resolves to a Response object1. It doesn't reject on HTTP errors such as 404, so check response.ok yourself23.

marker-citations.html
<p style="max-width: 520px; margin: 0; font-size: 15px; line-height: 1.65">
  The Fetch API returns a promise that resolves to a Response object<a class="vin-marker" href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API" aria-label="Source 1: Using the Fetch API, developer.mozilla.org">1<span class="vin-marker__preview" aria-hidden="true"><span class="vin-marker__title">Using the Fetch API</span><span class="vin-marker__source">developer.mozilla.org</span></span></a>.
  It doesn't reject on HTTP errors such as 404, so check <code>response.ok</code> yourself<a class="vin-marker" href="https://fetch.spec.whatwg.org/" aria-label="Source 2: Fetch Standard, fetch.spec.whatwg.org">2<span class="vin-marker__preview" aria-hidden="true"><span class="vin-marker__title">Fetch Standard</span><span class="vin-marker__source">fetch.spec.whatwg.org</span></span></a><a class="vin-marker" href="https://web.dev/articles/introduction-to-fetch" aria-label="Source 3: Introduction to fetch(), web.dev">3<span class="vin-marker__preview" aria-hidden="true"><span class="vin-marker__title">Introduction to fetch()</span><span class="vin-marker__source">web.dev</span></span></a>.
</p>

Status

Inline steps while the assistant works: running, done and failed.

Searching the web… Read 4 pages Couldn't open example.com
marker-status.html
<div style="display: grid; gap: 10px; justify-items: start">
  <span class="vin-marker vin-marker--status" role="status"><span class="vin-spinner vin-spinner--sm" aria-hidden="true"></span>Searching the web…</span>
  <span class="vin-marker vin-marker--status vin-marker--success"><svg class="vin-marker__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="m8.5 12 2.5 2.5 4.5-5"/></svg>Read 4 pages</span>
  <span class="vin-marker vin-marker--status vin-marker--danger"><svg class="vin-marker__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 8v4.5"/><path d="M12 16h.01"/></svg>Couldn't open example.com</span>
</div>

Installation

React, Vue and Svelte: add the component to your project with the CLI. It reads your framework from vin.json and also copies any component this one needs. Then import it:

Terminal
npx @vinish/ui add marker
React
import { Marker, StatusMarker } from "@/components/vin/marker";
Vue
import Marker, { StatusMarker } from "@/components/vin/marker.vue";
Svelte
import Marker from "$lib/components/vin/marker.svelte";
import StatusMarker from "$lib/components/vin/marker-status.svelte";

The import paths assume the default folders: @/components/vin (React and Vue, with the usual @ → src alias) and $lib/components/vin (SvelteKit). Use your own if you chose another folder in init. How the Vue and Svelte versions pass values and content is in Frameworks.

Plain HTML: the classes come with the style's stylesheet. It needs no JavaScript.

API

From spec/marker.json, which every framework version is tested against.

PropValuesDefaultIn HTML
index
The number in the citation chip.
number | string—the text of a.vin-marker
href
Where the source lives.
string——
title / source
The source's title and where it's from. They fill the preview and the link's name ("Source 1: Title, domain").
string—aria-label on the link + span.vin-marker__preview[aria-hidden] > .vin-marker__title + .vin-marker__source
StatusMarker
What the assistant is doing, inline.
component—span.vin-marker.vin-marker--status
status
StatusMarker: a spinner, a check or a warning sign.
runningdoneerrorrunningvin-marker--success | vin-marker--danger
live
StatusMarker: announce changes (role="status"). Default: true while running.
boolean—role="status"

Parts

React, Vue, SvelteHTML classes
<Marker><StatusMarker>.vin-marker.vin-marker__preview.vin-marker__title.vin-marker__source.vin-marker--status.vin-marker--success.vin-marker--danger.vin-marker__icon

Accessibility

  • A citation is a link named "Source 1: Title, domain", so it makes sense out of context. The preview repeats the same words and is hidden from screen readers.
  • The preview shows on keyboard focus as well as hover, stays open while the pointer is over it, and Escape hides it (WCAG 1.4.13). In HTML, vinui.js adds the Escape key.
  • A running status marker is a status message, so screen readers announce it when its text changes. Use role="status" on one marker that you update, not on every finished one.
  • Done and error are told apart by their icon and words, not colour alone.