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.
<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>import { Marker } from "@/components/vin/marker";
export function MarkerCitations() {
return (
<p style={{ maxWidth: 520, margin: 0, fontSize: 15, lineHeight: 1.65 }}>
The Fetch API returns a promise that resolves to a Response object
<Marker index={1} href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API" title="Using the Fetch API" source="developer.mozilla.org" />.
It doesn't reject on HTTP errors such as 404, so check <code>response.ok</code> yourself
<Marker index={2} href="https://fetch.spec.whatwg.org/" title="Fetch Standard" source="fetch.spec.whatwg.org" />
<Marker index={3} href="https://web.dev/articles/introduction-to-fetch" title="Introduction to fetch()" source="web.dev" />.
</p>
);
}The Vue version renders the same markup as the HTML tab, so it looks and works the same.
<script setup lang="ts">
import Marker from "@/components/vin/marker.vue";
</script>
<template>
<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
<Marker :index="1" href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API" title="Using the Fetch API" source="developer.mozilla.org" />.
It doesn't reject on HTTP errors such as 404, so check <code>response.ok</code> yourself
<Marker :index="2" href="https://fetch.spec.whatwg.org/" title="Fetch Standard" source="fetch.spec.whatwg.org" />
<Marker :index="3" href="https://web.dev/articles/introduction-to-fetch" title="Introduction to fetch()" source="web.dev" />.
</p>
</template>The Svelte version renders the same markup as the HTML tab, so it looks and works the same.
<script lang="ts">
import Marker from "$lib/components/vin/marker.svelte";
</script>
<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<Marker
index={1}
href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API"
title="Using the Fetch API"
source="developer.mozilla.org"
/>. It doesn't reject on HTTP errors such as 404, so check <code>response.ok</code> yourself<Marker
index={2}
href="https://fetch.spec.whatwg.org/"
title="Fetch Standard"
source="fetch.spec.whatwg.org"
/><Marker index={3} href="https://web.dev/articles/introduction-to-fetch" title="Introduction to fetch()" source="web.dev" />.
</p>Status
Inline steps while the assistant works: running, done and failed.
<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>import { StatusMarker } from "@/components/vin/marker";
export function MarkerStatus() {
return (
<div style={{ display: "grid", gap: 10, justifyItems: "start" }}>
<StatusMarker status="running">Searching the web…</StatusMarker>
<StatusMarker status="done">Read 4 pages</StatusMarker>
<StatusMarker status="error">Couldn't open example.com</StatusMarker>
</div>
);
}The Vue version renders the same markup as the HTML tab, so it looks and works the same.
<script setup lang="ts">
import { StatusMarker } from "@/components/vin/marker.vue";
</script>
<template>
<div style="display: grid; gap: 10px; justify-items: start">
<StatusMarker status="running">Searching the web…</StatusMarker>
<StatusMarker status="done">Read 4 pages</StatusMarker>
<StatusMarker status="error">Couldn't open example.com</StatusMarker>
</div>
</template>The Svelte version renders the same markup as the HTML tab, so it looks and works the same.
<script lang="ts">
import StatusMarker from "$lib/components/vin/marker-status.svelte";
</script>
<div style="display: grid; gap: 10px; justify-items: start">
<StatusMarker status="running">Searching the web…</StatusMarker>
<StatusMarker status="done">Read 4 pages</StatusMarker>
<StatusMarker status="error">Couldn't open example.com</StatusMarker>
</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:
npx @vinish/ui add markerimport { Marker, StatusMarker } from "@/components/vin/marker";import Marker, { StatusMarker } from "@/components/vin/marker.vue";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.
| Prop | Values | Default | In HTML |
|---|---|---|---|
indexThe number in the citation chip. | number | string | — | the text of a.vin-marker |
hrefWhere the source lives. | string | — | — |
title / sourceThe 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 |
StatusMarkerWhat the assistant is doing, inline. | component | — | span.vin-marker.vin-marker--status |
statusStatusMarker: a spinner, a check or a warning sign. | runningdoneerror | running | vin-marker--success | vin-marker--danger |
liveStatusMarker: announce changes (role="status"). Default: true while running. | boolean | — | role="status" |
Parts
| React, Vue, Svelte | HTML 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.
Customize
Saved in this browser. Style and accent are in the header.