Skip to content
WebJs
Menu

Displays an inline status, system note, bordered row, or labeled separator in a conversation.

Switched to a new branch
Thinking...
Conversation compacted
Explored 4 files
import { html } from '@webjsdev/core';
import { cn } from '#lib/utils/cn.ts';
import { markerClass, markerContentClass, markerIconClass } from '#components/ui/marker.ts';
import { spinner } from '#components/ui/spinner.ts';
import { GitBranchIcon, SearchIcon } from '#lib/ui/lucide.ts';

export default function MarkerDemo() {
  return html`
    <div class="flex w-full max-w-sm flex-col gap-8 py-12">
      <div data-slot="marker" data-variant="default" class=${markerClass()}>
        <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
          ${GitBranchIcon()}
        </span>
        <span data-slot="marker-content" class=${markerContentClass()}>Switched to a new branch</span>
      </div>
      <div data-slot="marker" data-variant="default" role="status" class=${markerClass()}>
        <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
          ${spinner({ decorative: true })}
        </span>
        <span data-slot="marker-content" class=${cn(markerContentClass(), 'shimmer')}>Thinking...</span>
      </div>
      <div data-slot="marker" data-variant="separator" class=${markerClass({ variant: 'separator' })}>
        <span data-slot="marker-content" class=${markerContentClass()}>Conversation compacted</span>
      </div>
      <div data-slot="marker" data-variant="default" class=${markerClass()}>
        <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
          ${SearchIcon()}
        </span>
        <span data-slot="marker-content" class=${markerContentClass()}>Explored 4 files</span>
      </div>
    </div>
  `;
}
View Code

Installation

pnpm dlx @webjsdev/ui add marker

Usage

import { markerClass, markerContentClass, markerIconClass } from '#components/ui/marker.ts';
<div data-slot="marker" data-variant="default" class=${markerClass()}>
  <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
    ${CheckIcon()}
  </span>
  <span data-slot="marker-content" class=${markerContentClass()}>Explored 4 files</span>
</div>

Composition

Use the following composition to build a marker:

markerClass()
├── markerIconClass()
└── markerContentClass()

Features

  • Inline marker, bordered row, and labeled separator variants
  • Decorative icon slot that is hidden from assistive tech
  • Class helpers, so the root can be a <div>, a link, or a button
  • Pairs with the shimmer utility for streaming status text
  • Customizable styling by merging classes into each helper's result with cn

Variants

Use the variant option to switch between an inline marker, bordered row, and labeled separator. Set data-variant on the root to the same variant: the content's centring keys on it.

A default marker for inline notes.
A separator marker
A border marker for row boundaries.
import { html } from '@webjsdev/core';
import { markerClass, markerContentClass } from '#components/ui/marker.ts';

export default function MarkerVariantsDemo() {
  return html`
    <div class="flex w-full max-w-sm flex-col gap-8 py-12">
      <div data-slot="marker" data-variant="default" class=${markerClass()}>
        <span data-slot="marker-content" class=${markerContentClass()}>A default marker for inline notes.</span>
      </div>
      <div data-slot="marker" data-variant="separator" class=${markerClass({ variant: 'separator' })}>
        <span data-slot="marker-content" class=${markerContentClass()}>A separator marker</span>
      </div>
      <div data-slot="marker" data-variant="border" class=${markerClass({ variant: 'border' })}>
        <span data-slot="marker-content" class=${markerContentClass()}>A border marker for row boundaries.</span>
      </div>
    </div>
  `;
}
View Code
VariantDescription
defaultAn inline marker for status, notes, and actions.
borderA default marker with a bottom border under the row.
separatorA centered label with divider lines on each side.

Status

Set role="status" and include a Spinner for streaming or in-progress markers so updates are announced.

Compacting conversation
Running tests
import { html } from '@webjsdev/core';
import { markerClass, markerContentClass, markerIconClass } from '#components/ui/marker.ts';
import { spinner } from '#components/ui/spinner.ts';

export default function MarkerStatusDemo() {
  return html`
    <div class="flex w-full max-w-sm flex-col gap-8 py-12">
      <div data-slot="marker" data-variant="default" role="status" class=${markerClass()}>
        <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
          ${spinner({ decorative: true })}
        </span>
        <span data-slot="marker-content" class=${markerContentClass()}>Compacting conversation</span>
      </div>
      <div data-slot="marker" data-variant="separator" role="status" class=${markerClass({ variant: 'separator' })}>
        <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
          ${spinner({ decorative: true })}
        </span>
        <span data-slot="marker-content" class=${markerContentClass()}>Running tests</span>
      </div>
    </div>
  `;
}
View Code

Shimmer

Add the shimmer utility class to the marker content for an animated streaming-text effect. The utility comes from the kit's Tailwind stylesheet and is not part of its generated component CSS, so add it to your stylesheet first. See the shimmer docs for installation.

Thinking...
Reading 4 files
import { html } from '@webjsdev/core';
import { cn } from '#lib/utils/cn.ts';
import { markerClass, markerContentClass } from '#components/ui/marker.ts';

export default function MarkerShimmerDemo() {
  return html`
    <div class="flex w-full max-w-sm flex-col gap-8 py-12">
      <div data-slot="marker" data-variant="default" role="status" class=${markerClass()}>
        <span data-slot="marker-content" class=${cn(markerContentClass(), 'shimmer')}>Thinking...</span>
      </div>
      <div data-slot="marker" data-variant="separator" role="status" class=${markerClass({ variant: 'separator' })}>
        <span data-slot="marker-content" class=${cn(markerContentClass(), 'shimmer')}>Reading 4 files</span>
      </div>
    </div>
  `;
}
View Code

Separator

Use the separator variant for labeled dividers, such as dates or section breaks, in a conversation. A Checkpoint is a separator with a button that restores the thread to that point.

Today
Worked for 42s
Conversation compacted
import { html } from '@webjsdev/core';
import { markerClass, markerContentClass } from '#components/ui/marker.ts';

export default function MarkerSeparatorDemo() {
  return html`
    <div class="flex w-full max-w-sm flex-col gap-8 py-12">
      <div data-slot="marker" data-variant="separator" class=${markerClass({ variant: 'separator' })}>
        <span data-slot="marker-content" class=${markerContentClass()}>Today</span>
      </div>
      <div data-slot="marker" data-variant="separator" class=${markerClass({ variant: 'separator' })}>
        <span data-slot="marker-content" class=${markerContentClass()}>Worked for 42s</span>
      </div>
      <div data-slot="marker" data-variant="separator" class=${markerClass({ variant: 'separator' })}>
        <span data-slot="marker-content" class=${markerContentClass()}>Conversation compacted</span>
      </div>
    </div>
  `;
}
View Code

Border

Use the border variant for status rows that should keep the default marker alignment while separating the next row.

Switched to release-candidate
Reviewed 8 related files
Opened implementation notes
import { html } from '@webjsdev/core';
import { markerClass, markerContentClass, markerIconClass } from '#components/ui/marker.ts';
import { FileTextIcon, GitBranchIcon, SearchIcon } from '#lib/ui/lucide.ts';

export default function MarkerBorderDemo() {
  return html`
    <div class="flex w-full max-w-sm flex-col gap-3 py-12">
      <div data-slot="marker" data-variant="border" class=${markerClass({ variant: 'border' })}>
        <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
          ${GitBranchIcon()}
        </span>
        <span data-slot="marker-content" class=${markerContentClass()}>Switched to release-candidate</span>
      </div>
      <div data-slot="marker" data-variant="border" class=${markerClass({ variant: 'border' })}>
        <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
          ${SearchIcon()}
        </span>
        <span data-slot="marker-content" class=${markerContentClass()}>Reviewed 8 related files</span>
      </div>
      <div data-slot="marker" data-variant="border" class=${markerClass({ variant: 'border' })}>
        <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
          ${FileTextIcon()}
        </span>
        <span data-slot="marker-content" class=${markerContentClass()}>Opened implementation notes</span>
      </div>
    </div>
  `;
}
View Code

With Icon

Use markerIconClass() to render an icon alongside the content. Add flex-col to the root to stack the icon above the content.

Switched to a new branch
Explored 4 files
Syncing completed
import { html } from '@webjsdev/core';
import { cn } from '#lib/utils/cn.ts';
import { markerClass, markerContentClass, markerIconClass } from '#components/ui/marker.ts';
import { BookOpenCheck, GitBranchIcon, SearchIcon } from '#lib/ui/lucide.ts';

export default function MarkerIconDemo() {
  return html`
    <div class="flex w-full max-w-sm flex-col gap-12 py-12">
      <div data-slot="marker" data-variant="default" class=${markerClass()}>
        <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
          ${GitBranchIcon()}
        </span>
        <span data-slot="marker-content" class=${markerContentClass()}>Switched to a new branch</span>
      </div>
      <div data-slot="marker" data-variant="separator" class=${markerClass({ variant: 'separator' })}>
        <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
          ${SearchIcon()}
        </span>
        <span data-slot="marker-content" class=${markerContentClass()}>Explored 4 files</span>
      </div>
      <div data-slot="marker" data-variant="default" class=${cn(markerClass(), 'flex-col')}>
        <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
          ${BookOpenCheck()}
        </span>
        <span data-slot="marker-content" class=${markerContentClass()}>Syncing completed</span>
      </div>
    </div>
  `;
}
View Code

A class helper styles any element, so a marker that links or acts is an <a> or a <button> with the marker's classes.

View the pull request
import { html } from '@webjsdev/core';
import { cn } from '#lib/utils/cn.ts';
import { markerClass, markerContentClass, markerIconClass } from '#components/ui/marker.ts';
import { GitBranchIcon, RotateCcwIcon } from '#lib/ui/lucide.ts';

export default function MarkerLinkButtonDemo() {
  return html`
    <div class="flex w-full max-w-sm flex-col gap-8 py-12">
      <a href="#links-and-buttons" data-slot="marker" data-variant="default" class=${markerClass()}>
        <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
          ${GitBranchIcon()}
        </span>
        <span data-slot="marker-content" class=${markerContentClass()}>View the pull request</span>
      </a>
      <button type="button" data-slot="marker" data-variant="default" class=${cn(markerClass(), 'transition-colors hover:text-foreground')}>
        <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
          ${RotateCcwIcon()}
        </span>
        <span data-slot="marker-content" class=${markerContentClass()}>Revert this change</span>
      </button>
    </div>
  `;
}
View Code
import { html } from '@webjsdev/core';
import { markerClass, markerContentClass } from '#components/ui/marker.ts';

export function MarkerLinkDemo() {
  return html`
    <a href="#" data-slot="marker" data-variant="default" class=${markerClass()}>
      <span data-slot="marker-content" class=${markerContentClass()}>View the pull request</span>
    </a>
  `;
}

Accessibility

A marker is presentational by default. The correct semantics depend on how you use it, so choose the role based on intent rather than relying on a single default.

Status and Progress

For streaming or progress markers such as "Thinking..." or a running tool, set role="status" on the root so assistive tech announces the update as it appears.

<div data-slot="marker" data-variant="default" role="status" class=${markerClass()}>
  <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
    ${spinner({ decorative: true })}
  </span>
  <span data-slot="marker-content" class=${markerContentClass()}>Compacting conversation</span>
</div>

Labeled Separators

A separator that carries text, such as a date or a section label, needs no role. The divider lines are decorative CSS pseudo-elements, and the text is announced as ordinary content.

<div data-slot="marker" data-variant="separator" class=${markerClass({ variant: 'separator' })}>
  <span data-slot="marker-content" class=${markerContentClass()}>Today</span>
</div>

Note: Do not add role="separator" to a labeled divider. A separator takes its accessible name from aria-label, not from its text, and its contents are treated as presentational, so the visible label would not be announced. Reserve role="separator" for a divider with no meaningful text.

Bordered Markers

A bordered marker keeps the same semantics as the default marker. The bottom border is decorative, so choose role="status", a link or button element, or no role based on the marker's purpose.

<div data-slot="marker" data-variant="border" class=${markerClass({ variant: 'border' })}>
  <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
    ${FileTextIcon()}
  </span>
  <span data-slot="marker-content" class=${markerContentClass()}>Opened implementation notes</span>
</div>

Decorative Icons

The icon slot is decorative: put aria-hidden="true" on it, as the examples do, so the adjacent content carries the meaning. For an icon-only marker, provide an aria-label or visible text so it is not announced as empty.

<div data-slot="marker" data-variant="default" aria-label="Synced" class=${markerClass()}>
  <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
    ${CheckIcon()}
  </span>
</div>

Interactive Markers

When a marker links or triggers an action, render it as a real <button> or <a> carrying the marker's classes so it is focusable and exposes the correct role. The accessible name comes from the marker text.

<a href="/files" data-slot="marker" data-variant="default" class=${markerClass()}>
  <span data-slot="marker-icon" aria-hidden="true" class=${markerIconClass()}>
    ${FileTextIcon()}
  </span>
  <span data-slot="marker-content" class=${markerContentClass()}>Explored 4 files</span>
</a>

API Reference

markerClass

markerClass() returns the classes for the root marker element. Set data-variant to the variant you pass. markerVariants() is an alias of markerClass() that also merges a className.

OptionTypeDefaultDescription
variant"default" | "border" | "separator""default"The marker layout.

markerIconClass

The classes for the decorative icon slot. Hide it from assistive tech with aria-hidden="true". Takes no options.

markerContentClass

The classes for the marker text content. Takes no options.