Skip to content

shadcn.io is an independent project built on shadcn/ui

Components

Free

Marker for Svelte

One-line system notes in a chat transcript, such as a branch switch, a running task or a Today divider, for Svelte with Ark UI, in three variants.

On this page9 sections
UI library: Ark UI

Marker is one muted line in a chat transcript for something the system did rather than said: it switched branches, explored four files, or compacted the conversation. It comes as an inline note with an optional icon, a label set in a rule, or a row with a rule under it, and sits in the same column as the messages.

For a rule with no words, use a Separator. Anything a person or the assistant says belongs in a Message.

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

Anatomy

Marker anatomy: root, icon, content

Usage

<script lang="ts">
import { CheckIcon } from "lucide-svelte";
import {
  Marker, MarkerContent, MarkerIcon,
} from "@/components/ui/marker";
</script>

MarkerIcon is optional, and it hides whatever it holds from screen readers, so the words in MarkerContent have to say everything.

<Marker>
  <MarkerIcon>
    <CheckIcon />
  </MarkerIcon>
  <MarkerContent>Explored 4 files</MarkerContent>
</Marker>

Accessibility

Marker has no role of its own. It renders a div around its icon and its text, so a screen reader reads its words in the flow of the transcript, and MarkerIcon is hidden from assistive tech, which leaves the text in MarkerContent as all that is read. For a line that changes while it is on screen, such as a running task, add role="status": the marker becomes a polite live region, and a screen reader announces each change to its words without moving focus. Rendered as a link or a button, the marker is focusable like one, and its text is its name.

Demos

Variants

Three markers with no icons, one for each value of variant: the default inline note, separator with a rule running out from both sides of its label, and border with a rule under the row. Choose the default for a note in the flow of the transcript, separator for a break such as a new day, and border when the notes stack up as a log.

Preview width

Status

Two tasks in progress, Compacting conversation as an inline note and Running tests on a separator, each with a spinner in MarkerIcon and role set to status. Keep the same marker mounted and change its words when the task moves on, to Conversation compacted for example, and a screen reader announces the new text. The spinner is hidden along with the rest of the icon.

Preview width

Live status

A test run reported in place: the marker reads Running tests beside a spinner, then two seconds later Tests passed beside a check, and Run the tests again starts it over. The same Marker stays mounted with role set to status, so a screen reader announces each new line. Use it for an agent's tool call that you follow from start to finish.

Preview width

Shimmer

Two live lines with no spinner, Thinking and Reading 4 files, where the shimmer class on MarkerContent sweeps a band of light across the words. Use it when an icon would crowd the row and the label itself should look busy. The class comes from the Shimmer utility, which installing Marker doesn't add, so install it too or the words stay still.

Preview width

Separator

Three labeled breaks in a transcript, Today, Worked for 42s and Conversation compacted, each with a rule running out from both sides of its label. Use one where the conversation changes footing, at a new day or after earlier turns were summarized. Keep the label to a few words, because on a separator it neither shrinks nor wraps, and a long one runs past the edge of a narrow column.

Preview width

Border

Three log entries, each with an icon and a rule under it: a switch to the release-candidate branch, 8 related files reviewed and implementation notes opened. The rule and the padding above it set each event apart, so a run of them reads as a list. Use border for finished steps someone may scan afterwards, such as an agent's activity log.

Preview width

Icon

Icons in three layouts: a branch icon before an inline note, a search icon on a separator between the left rule and its label, and a book icon stacked above Syncing completed by a flex-col class on Marker. Add an icon where it helps people scan a long transcript, since the words already carry the meaning.

Preview width

Two rows that are controls end to end: a link labeled View the pull request, and a Revert this change button that turns into Restore this change when pressed. asChild is a snippet here: call the function it receives and spread the props it returns onto the a or button you render in it. Use a link when the row goes somewhere and a button when it changes something.

Preview width

FAQ

When should I use Marker instead of Separator?

Use Separator for a plain rule with no words, and a Marker with variant set to separator when the rule needs a label, such as Today or Conversation compacted.

The two aren't built alike. Marker draws its rules with CSS and has no separator role, so a screen reader reads only the label, as a line of text. It doesn't install or use the Separator component.

How do I announce a running task in a Marker to screen readers?

Add role="status" to the Marker, which makes it a polite live region, and change its words as the task moves on. A screen reader announces each new text after it finishes what it is reading, without moving focus.

Keep that marker mounted from the start of the task to the end, and swap its icon and text in place, from Running tests to Tests passed. A note that never changes after it appears needs no role. The Live status demo does this with a test run, and Status shows two tasks still running.

How do I show AI SDK tool calls as Marker lines?

Render a Marker for each tool part in a message's parts, and pick its icon and words from the part's state. While the state is input-streaming or input-available, the tool is still running: give the marker a spinner and role="status". At output-available, swap in a check and a past-tense summary, such as Read 4 files, and at output-error, a warning icon and what failed.

Keep the same marker for the part from start to end, keyed by its toolCallId, so the change is announced. When people need to read the tool's input and output, use Tool instead, which opens to show them.

Why doesn't the shimmer animate on my Marker?

Most often the class has nothing behind it. shimmer comes from the Shimmer utility, and installing Marker doesn't add it, so install that utility as well and the Shimmer demo's sweep appears on your labels.

With the utility in place, a system set to reduce motion still shows the label without the sweep, because the utility turns the animation off under prefers-reduced-motion. The words then have to say on their own that the work is still running.

Can a Marker hold more than one line of text?

It can wrap, but it is meant for one short note. MarkerContent is a single span, and in the default and border variants a long sentence wraps under itself beside the icon. On a separator the label neither shrinks nor wraps, so keep it to a few words there.

For several events, stack one Marker per event, as the Border demo does. For a run of steps that opens to show detail, use Chain of Thought or Task.

How do I change the style of a Marker?

Edit markerVariants in your copy of components/ui/marker: it holds the base classes and one set for each variant, so every marker in the app picks up the change. For one marker, add a class to it or to MarkerContent.

The root carries data-variant with the variant's name, so a style elsewhere can target one kind of marker, such as only the separators, without a new prop. The text is small and muted by default, which keeps system notes quieter than the messages around them.

API Reference

Marker

<div> data-slot="marker"

PropType
variant?"border" | "default" | "separator"

The visual style.

Type
"border" | "default" | "separator"
Default
"default"
asChild?Snippet<[PropsFn]>

Render your own element: a snippet that gets the part's props to spread on it.

Type
Snippet<[PropsFn]>
Default
false
class?string

Merged with the part's classes.

AttributeType
data-variant?string

Mirrors variant.

MarkerContent

<span> data-slot="marker-content"

PropType
class?string

Merged with the part's classes.

MarkerIcon

<span> data-slot="marker-icon"

PropType
class?string

Merged with the part's classes.