Marker Rails Components
Markers are the small lines between messages in a conversation: inline statuses, system notes, bordered activity rows, and labeled separators. Use them to show what an assistant or teammate is doing without interrupting the thread.
Installation
Static markers are plain HTML and Tailwind, so most examples work without JavaScript. Add this Stimulus controller for the live and expandable markers. It has no dependencies.
import { Controller } from "@hotwired/stimulus";
// Marker
//
// Static markers (inline notes, bordered rows, labeled separators) are plain
// HTML and do not need this controller. Neither does the shimmer: it is the
// CSS animate-marker-shimmer utility. Add the controller when a marker should
// change over time:
//
// 1. Live state - swaps between views ("running" -> "done" / "failed") and
// keeps an elapsed-time counter ticking while running.
// 2. Disclosure - expands a marker to reveal details ("Explored 4 files").
//
// Every feature is opt-in through targets, so use only the ones you need.
export default class extends Controller {
static targets = ["view", "elapsed", "trigger", "panel"];
static values = {
// Current state. Shows the "view" target whose data-marker-state matches.
// "running" also starts the elapsed timer. Leave empty for static markers.
state: { type: String, default: "" },
// Epoch milliseconds the work started at, so a server-rendered marker
// keeps counting from the right moment. Defaults to "now".
startedAt: { type: Number, default: 0 },
// Whether the details panel is expanded.
open: { type: Boolean, default: false },
};
initialize() {
// Value callbacks fire before connect(), so they need this already.
this.reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)");
}
disconnect() {
this.stopTimer();
this.viewAnimation?.cancel();
this.panelAnimation?.cancel();
}
// ---- Actions -------------------------------------------------------------
// (Re)start the running state and reset the elapsed timer.
start() {
this.startedAtValue = Date.now();
this.stateValue = "running";
}
complete() {
this.stateValue = "done";
}
fail() {
this.stateValue = "failed";
}
toggle() {
this.openValue = !this.openValue;
}
// ---- Live state ----------------------------------------------------------
stateValueChanged(state, previousState) {
const isInitialRender = previousState === undefined;
this.showView(state, !isInitialRender);
if (state === "running") {
this.startTimer();
} else {
this.stopTimer();
}
if (!isInitialRender) {
this.dispatch("change", { detail: { state, previousState } });
}
}
startedAtValueChanged() {
if (this.stateValue === "running") this.startTimer();
}
showView(state, animate) {
if (!this.hasViewTarget) return;
this.viewAnimation?.cancel();
this.viewTargets.forEach((view) => {
const isActive = view.dataset.markerState === state;
const wasHidden = view.hidden;
view.hidden = !isActive;
if (isActive && wasHidden && animate) {
// A short blur bridges the swap so it reads as one line changing, not
// two lines trading places. Reduced motion keeps only the fade.
const from = this.reducedMotion.matches
? { opacity: 0 }
: { opacity: 0, transform: "translateY(3px)", filter: "blur(3px)" };
const to = this.reducedMotion.matches
? { opacity: 1 }
: { opacity: 1, transform: "translateY(0)", filter: "blur(0)" };
this.viewAnimation = view.animate([from, to], {
duration: 240,
easing: "cubic-bezier(0.23, 1, 0.32, 1)",
});
}
});
}
// ---- Elapsed timer -------------------------------------------------------
startTimer() {
this.stopTimer({ render: false });
this.startTime = this.startedAtValue || Date.now();
this.timerRunning = true;
this.renderElapsed();
this.intervalId = setInterval(() => this.renderElapsed(), 1000);
}
stopTimer({ render = true } = {}) {
clearInterval(this.intervalId);
// Freeze the final duration ("Thought for 6s"). Markers that were never
// running keep whatever text the server rendered.
if (this.timerRunning && render) this.renderElapsed();
this.timerRunning = false;
}
renderElapsed() {
if (!this.hasElapsedTarget) return;
const seconds = Math.max(0, Math.round((Date.now() - this.startTime) / 1000));
const label = this.formatDuration(seconds);
this.elapsedTargets.forEach((element) => {
if (element.textContent !== label) element.textContent = label;
});
}
// 8 -> "8s", 72 -> "1m 12s", 3720 -> "1h 2m"
formatDuration(totalSeconds) {
const hours = Math.floor(totalSeconds / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
const seconds = totalSeconds % 60;
if (hours > 0) return `${hours}h ${minutes}m`;
if (minutes > 0) return `${minutes}m ${seconds}s`;
return `${seconds}s`;
}
// ---- Disclosure ----------------------------------------------------------
openValueChanged(open, previousOpen) {
if (this.hasTriggerTarget) {
this.triggerTarget.setAttribute("aria-expanded", String(open));
}
if (!this.hasPanelTarget) return;
const panel = this.panelTarget;
const isInitialRender = previousOpen === undefined;
if (isInitialRender || this.reducedMotion.matches) {
this.panelAnimation?.cancel();
panel.hidden = !open;
return;
}
// Read the current height first so a toggle mid-animation continues from
// where the panel is instead of jumping.
const currentHeight = panel.hidden ? 0 : panel.getBoundingClientRect().height;
this.panelAnimation?.cancel();
panel.hidden = false;
const fullHeight = panel.scrollHeight;
this.panelAnimation = panel.animate(
[
{ height: `${currentHeight}px`, opacity: open ? 0 : 1 },
{ height: `${open ? fullHeight : 0}px`, opacity: open ? 1 : 0 },
],
{ duration: open ? 240 : 180, easing: "cubic-bezier(0.23, 1, 0.32, 1)" },
);
this.panelAnimation.onfinish = () => {
panel.hidden = !open;
};
}
}
Examples
Basic Marker
A quiet inline note for a conversation: a decorative icon and a short line of text.
<%# Marker: an inline note in a conversation. The icon is decorative, the text carries the meaning. %>
<div class="flex items-center gap-2 text-sm text-neutral-500 dark:text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="7.75" cy="7.75" r="5"></circle><path d="M15.25 15.25l-3.96-3.96"></path></svg>
<span>Explored 4 files</span>
</div>
Marker Variants
The three layouts: a default inline marker, a labeled separator, and a bordered row.
<div class="w-full max-w-sm space-y-5">
<%# Default: an inline note %>
<div class="flex items-center gap-2 text-sm text-neutral-500 dark:text-neutral-400">
<span>A default marker for inline notes.</span>
</div>
<%# Separator: a centered label between two divider lines %>
<div class="flex items-center gap-3 text-xs font-medium text-neutral-500 before:h-px before:flex-1 before:bg-black/10 after:h-px after:flex-1 after:bg-black/10 dark:text-neutral-400 dark:before:bg-white/10 dark:after:bg-white/10">
<span>A separator marker</span>
</div>
<%# Border: a default marker that closes the row with a bottom border %>
<div class="flex items-center gap-2 border-b border-black/10 pb-3 text-sm text-neutral-500 dark:border-white/10 dark:text-neutral-400">
<span>A border marker for row boundaries.</span>
</div>
</div>
Marker with Icon
Icons sit beside the text and are hidden from assistive tech. Tint them to signal an outcome, or use flex-col to stack the icon above the content.
bin/rails test
<div class="flex w-full max-w-sm flex-col gap-6">
<div class="space-y-3">
<div class="flex items-center gap-2 text-sm text-neutral-500 dark:text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="5" cy="3.75" r="1.75"></circle><circle cx="5" cy="14.25" r="1.75"></circle><circle cx="13" cy="5.75" r="1.75"></circle><path d="M5 5.5v7"></path><path d="M13 7.5v.5a2.5 2.5 0 0 1-2.5 2.5h-3A2.5 2.5 0 0 0 5 12.5"></path></svg>
<span>Switched to a new branch</span>
</div>
<div class="flex items-center gap-2 text-sm text-neutral-500 dark:text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.75 5.75L7 9l-3.25 3.25"></path><path d="M9.5 12.75h4.75"></path></svg>
<span>Ran <code class="rounded-md bg-neutral-100 px-1.5 py-0.5 font-mono text-xs text-neutral-700 dark:bg-neutral-800 dark:text-neutral-300">bin/rails test</code></span>
</div>
<%# Tinted icons carry the outcome at a glance; the text still says it. %>
<div class="flex items-center gap-2 text-sm text-neutral-500 dark:text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0 text-emerald-600 dark:text-emerald-400" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="9" cy="9" r="7.25"></circle><path d="M5.75 9.25l2.25 2.25 4.25-5"></path></svg>
<span>128 tests passed</span>
</div>
<div class="flex items-center gap-2 text-sm text-neutral-500 dark:text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0 text-red-600 dark:text-red-400" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="9" cy="9" r="7.25"></circle><path d="M9 5.5v4"></path><path d="M9 12.5v.01"></path></svg>
<span>Deploy to staging failed</span>
</div>
</div>
<%# Stacked: flex-col puts the icon above the content %>
<div class="flex flex-col items-center gap-2 text-center text-sm text-neutral-500 dark:text-neutral-400">
<span class="flex size-9 items-center justify-center rounded-full border border-black/10 bg-white shadow-xs dark:border-white/10 dark:bg-neutral-800">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0 text-neutral-700 dark:text-neutral-200" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.75 9.5l3.5 3.5 7-8.25"></path></svg>
</span>
<span>Syncing completed</span>
</div>
</div>
Status Marker
In-progress markers use role="status" with a spinner or a pulsing dot so updates are announced as they appear.
<%# role="status" makes assistive tech announce the marker when it appears. %>
<div class="w-full max-w-sm space-y-3">
<div role="status" class="flex items-center gap-2 text-sm text-neutral-500 dark:text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0 animate-spin" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><circle cx="9" cy="9" r="6.25" class="opacity-25"></circle><path d="M15.25 9A6.25 6.25 0 0 0 9 2.75"></path></svg>
<span>Compacting conversation</span>
</div>
<div role="status" class="flex items-center gap-2 text-sm text-neutral-500 dark:text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0 animate-spin" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><circle cx="9" cy="9" r="6.25" class="opacity-25"></circle><path d="M15.25 9A6.25 6.25 0 0 0 9 2.75"></path></svg>
<span>Running tests</span>
<span class="ml-auto text-xs tabular-nums text-neutral-400 dark:text-neutral-500">12 of 128</span>
</div>
<%# A quieter option: a pulsing dot instead of a spinner %>
<div role="status" class="flex items-center gap-2 text-sm text-neutral-500 dark:text-neutral-400">
<span class="relative flex size-4 shrink-0 items-center justify-center" aria-hidden="true">
<span class="absolute size-2 rounded-full bg-emerald-500 opacity-60 motion-safe:animate-ping"></span>
<span class="size-2 rounded-full bg-emerald-500"></span>
</span>
<span>Dana is typing</span>
</div>
</div>
Shimmer Marker
A highlight sweeps across streaming status text. It is pure CSS: add motion-safe:animate-marker-shimmer to the text-clipped gradient, so it needs no JavaScript and stays still when reduced motion is preferred. The keyframes ship with the Rails Blocks Tailwind theme; change the speed with [--marker-shimmer-duration:3s].
<%# A wide, text-clipped gradient that animate-marker-shimmer slides across the text. Pure CSS: no controller needed, and motion-safe keeps it still for reduced motion. %>
<div class="w-full max-w-sm space-y-3">
<div role="status" class="flex items-center gap-2 text-sm">
<span class="bg-linear-to-r from-neutral-400 from-35% via-neutral-950 via-50% to-neutral-400 to-65% bg-[length:250%_100%] bg-[position:100%_0] bg-clip-text text-transparent motion-safe:animate-marker-shimmer dark:from-neutral-400 dark:from-40% dark:via-white dark:to-neutral-400 dark:to-60%">Thinking…</span>
</div>
<div role="status" class="flex items-center gap-2 text-sm text-neutral-500 dark:text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10.25 1.75h-4.5a2 2 0 0 0-2 2v10.5a2 2 0 0 0 2 2h6.5a2 2 0 0 0 2-2v-8.5z"></path><path d="M10.25 1.75v4h4"></path><path d="M6.75 9.75h4.5"></path><path d="M6.75 12.75h3"></path></svg>
<span class="bg-linear-to-r from-neutral-400 from-35% via-neutral-950 via-50% to-neutral-400 to-65% bg-[length:250%_100%] bg-[position:100%_0] bg-clip-text text-transparent motion-safe:animate-marker-shimmer dark:from-neutral-400 dark:from-40% dark:via-white dark:to-neutral-400 dark:to-60%">Reading 4 files</span>
</div>
</div>
Separator Marker
Labeled dividers for dates, durations, unread messages, and checkpoints with a restore button.
<%# Labeled separators need no role: the lines are decorative pseudo-elements and the label is read as ordinary text. %>
<div class="w-full max-w-md space-y-6">
<%# Date %>
<div class="flex items-center gap-3 text-xs font-medium text-neutral-500 before:h-px before:flex-1 before:bg-black/10 after:h-px after:flex-1 after:bg-black/10 dark:text-neutral-400 dark:before:bg-white/10 dark:after:bg-white/10">
<time datetime="2026-11-09">Today</time>
</div>
<%# With an icon %>
<div class="flex items-center gap-3 text-xs font-medium text-neutral-500 before:h-px before:flex-1 before:bg-black/10 after:h-px after:flex-1 after:bg-black/10 dark:text-neutral-400 dark:before:bg-white/10 dark:after:bg-white/10">
<span class="flex items-center gap-1.5">
<svg xmlns="http://www.w3.org/2000/svg" class="size-3.5 shrink-0" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="9" cy="9" r="7.25"></circle><path d="M9 4.75V9l2.75 2"></path></svg>
Worked for 42s
</span>
</div>
<%# Left aligned: drop the leading line %>
<div class="flex items-center gap-3 text-xs font-medium text-neutral-500 after:h-px after:flex-1 after:bg-black/10 dark:text-neutral-400 dark:after:bg-white/10">
<span>Conversation compacted</span>
</div>
<%# Unread divider %>
<div class="flex items-center gap-3 text-xs font-medium text-red-600 before:h-px before:flex-1 before:bg-red-500/30 after:h-px after:flex-1 after:bg-red-500/30 dark:text-red-400">
<span>3 new messages</span>
</div>
<%# Checkpoint: a separator with a button that restores the thread to this point %>
<div class="flex items-center gap-3 text-xs font-medium text-neutral-500 before:h-px before:flex-1 before:bg-black/10 after:h-px after:flex-1 after:bg-black/10 dark:text-neutral-400 dark:before:bg-white/10 dark:after:bg-white/10">
<div class="flex items-center gap-1">
<span class="flex items-center gap-1.5">
<svg xmlns="http://www.w3.org/2000/svg" class="size-3.5 shrink-0" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4.75 15.75V3.25a1 1 0 0 1 1-1h6.5a1 1 0 0 1 1 1v12.5L9 12.5z"></path></svg>
Checkpoint
</span>
<button type="button" class="relative flex items-center justify-center gap-1.5 rounded-md bg-transparent px-1.5 py-1 text-xs font-medium whitespace-nowrap text-neutral-800 transition-all duration-100 ease-in-out select-none after:absolute after:-inset-2 hover:bg-neutral-100 hover:text-neutral-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-600 disabled:cursor-not-allowed disabled:opacity-50 dark:text-neutral-50 dark:hover:bg-neutral-600/50 dark:hover:text-white dark:focus-visible:outline-neutral-200">Restore</button>
</div>
</div>
</div>
Border Marker
Bordered rows for an activity log, with a timestamp pushed to the end of each row.
<%# Border markers keep the default alignment and close each row with a line. The last row drops it. %>
<div class="w-full max-w-sm">
<div class="flex items-center gap-2 border-b border-black/10 py-3 text-sm text-neutral-500 dark:border-white/10 dark:text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="5" cy="3.75" r="1.75"></circle><circle cx="5" cy="14.25" r="1.75"></circle><circle cx="13" cy="5.75" r="1.75"></circle><path d="M5 5.5v7"></path><path d="M13 7.5v.5a2.5 2.5 0 0 1-2.5 2.5h-3A2.5 2.5 0 0 0 5 12.5"></path></svg>
<span class="min-w-0 truncate">Switched to <span class="font-medium text-neutral-800 dark:text-neutral-200">release-candidate</span></span>
<time datetime="09:41" class="ml-auto shrink-0 text-xs tabular-nums text-neutral-400 dark:text-neutral-500">9:41</time>
</div>
<div class="flex items-center gap-2 border-b border-black/10 py-3 text-sm text-neutral-500 dark:border-white/10 dark:text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="7.75" cy="7.75" r="5"></circle><path d="M15.25 15.25l-3.96-3.96"></path></svg>
<span class="min-w-0 truncate">Reviewed 8 related files</span>
<time datetime="09:42" class="ml-auto shrink-0 text-xs tabular-nums text-neutral-400 dark:text-neutral-500">9:42</time>
</div>
<div class="flex items-center gap-2 py-3 text-sm text-neutral-500 dark:text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10.25 1.75h-4.5a2 2 0 0 0-2 2v10.5a2 2 0 0 0 2 2h6.5a2 2 0 0 0 2-2v-8.5z"></path><path d="M10.25 1.75v4h4"></path><path d="M6.75 9.75h4.5"></path><path d="M6.75 12.75h3"></path></svg>
<span class="min-w-0 truncate">Opened implementation notes</span>
<time datetime="09:44" class="ml-auto shrink-0 text-xs tabular-nums text-neutral-400 dark:text-neutral-500">9:44</time>
</div>
</div>
Link and Button Markers
Markers that navigate or trigger an action are real links and buttons with hover, press, focus, and disabled states.
<%# Interactive markers are real <a> and <button> elements, so they are focusable and named by their text. %>
<div class="flex w-full max-w-sm flex-col items-start gap-1">
<a href="#" class="group -mx-2 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-neutral-500 transition-colors duration-150 ease-out hover:bg-neutral-100 hover:text-neutral-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-600 dark:text-neutral-400 dark:hover:bg-neutral-800 dark:hover:text-white dark:focus-visible:outline-neutral-200">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="5" cy="3.75" r="1.75"></circle><circle cx="5" cy="14.25" r="1.75"></circle><circle cx="13" cy="5.75" r="1.75"></circle><path d="M5 5.5v7"></path><path d="M13 7.5v.5a2.5 2.5 0 0 1-2.5 2.5h-3A2.5 2.5 0 0 0 5 12.5"></path></svg>
<span>View the pull request</span>
<svg xmlns="http://www.w3.org/2000/svg" class="size-3.5 shrink-0 -translate-x-1 opacity-0 transition-[opacity,translate] duration-150 ease-out group-hover:translate-x-0 group-hover:opacity-100 group-focus-visible:translate-x-0 group-focus-visible:opacity-100" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5.25 12.75l7.5-7.5"></path><path d="M6.75 5.25h6v6"></path></svg>
</a>
<button type="button" class="group -mx-2 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-neutral-500 transition-[color,background-color] duration-150 ease-out hover:bg-neutral-100 hover:text-neutral-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-600 dark:text-neutral-400 dark:hover:bg-neutral-800 dark:hover:text-white dark:focus-visible:outline-neutral-200">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0 transition-[rotate] duration-300 ease-out group-hover:-rotate-45 motion-reduce:transition-none" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.75 9a6.25 6.25 0 1 0 1.83-4.42L2.75 6.41"></path><path d="M2.75 2.75v3.66h3.66"></path></svg>
<span>Revert this change</span>
</button>
<button type="button" disabled class="-mx-2 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-neutral-500 disabled:cursor-not-allowed disabled:opacity-50 dark:text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M11.5 3.25l3.25 3.25-8.25 8.25-3.75.5.5-3.75z"></path></svg>
<span>Edit and resend (unavailable)</span>
</button>
</div>
Live Marker
A marker that counts elapsed time while running, then settles into a done or failed view. Press Replay or Retry to run it again.
<%#
Live markers swap between "view" targets when data-marker-state-value changes.
In production, update that attribute from a Turbo Stream or call marker#complete / marker#fail.
The ticking counter is aria-hidden so screen readers hear the state changes, not every second.
%>
<div class="w-full max-w-sm space-y-3">
<div role="status" data-controller="marker" data-marker-state-value="running" class="flex h-7 items-center text-sm text-neutral-500 dark:text-neutral-400">
<div data-marker-target="view" data-marker-state="running" class="flex items-center gap-2">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0 animate-spin" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><circle cx="9" cy="9" r="6.25" class="opacity-25"></circle><path d="M15.25 9A6.25 6.25 0 0 0 9 2.75"></path></svg>
<span class="bg-linear-to-r from-neutral-400 from-35% via-neutral-950 via-50% to-neutral-400 to-65% bg-[length:250%_100%] bg-[position:100%_0] bg-clip-text text-transparent motion-safe:animate-marker-shimmer dark:from-neutral-400 dark:from-40% dark:via-white dark:to-neutral-400 dark:to-60%">Thinking…</span>
<span data-marker-target="elapsed" aria-hidden="true" class="text-xs tabular-nums text-neutral-400 dark:text-neutral-500">0s</span>
</div>
<div data-marker-target="view" data-marker-state="done" hidden class="flex items-center gap-2">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0 text-emerald-600 dark:text-emerald-400" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.75 9.5l3.5 3.5 7-8.25"></path></svg>
<span>Thought for <span data-marker-target="elapsed" class="tabular-nums">6s</span></span>
</div>
<button type="button" data-action="marker#start" class="relative ml-auto flex items-center justify-center gap-1.5 rounded-md bg-transparent px-2 py-1 text-xs font-medium whitespace-nowrap text-neutral-800 transition-all duration-100 ease-in-out select-none after:absolute after:-inset-2 hover:bg-neutral-100 hover:text-neutral-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-600 disabled:cursor-not-allowed disabled:opacity-50 dark:text-neutral-50 dark:hover:bg-neutral-600/50 dark:hover:text-white dark:focus-visible:outline-neutral-200">Replay</button>
</div>
<%# A run that fails, with a retry action in the failed view %>
<div role="status" data-controller="marker" data-marker-state-value="running" class="flex h-7 items-center text-sm text-neutral-500 dark:text-neutral-400">
<div data-marker-target="view" data-marker-state="running" class="flex items-center gap-2">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0 animate-spin" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><circle cx="9" cy="9" r="6.25" class="opacity-25"></circle><path d="M15.25 9A6.25 6.25 0 0 0 9 2.75"></path></svg>
<span>Deploying to staging</span>
<span data-marker-target="elapsed" aria-hidden="true" class="text-xs tabular-nums text-neutral-400 dark:text-neutral-500">0s</span>
</div>
<div data-marker-target="view" data-marker-state="failed" hidden class="flex w-full items-center gap-2">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0 text-red-600 dark:text-red-400" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="9" cy="9" r="7.25"></circle><path d="M9 5.5v4"></path><path d="M9 12.5v.01"></path></svg>
<span>Deploy failed after <span data-marker-target="elapsed" class="tabular-nums">4s</span></span>
<button type="button" data-action="marker#start" class="relative ml-auto flex items-center justify-center gap-1.5 rounded-md bg-transparent px-2 py-1 text-xs font-medium whitespace-nowrap text-neutral-800 transition-all duration-100 ease-in-out select-none after:absolute after:-inset-2 hover:bg-neutral-100 hover:text-neutral-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-600 disabled:cursor-not-allowed disabled:opacity-50 dark:text-neutral-50 dark:hover:bg-neutral-600/50 dark:hover:text-white dark:focus-visible:outline-neutral-200">Retry</button>
</div>
</div>
</div>
Expandable Marker
A marker that opens to reveal the details behind it. The toggle is interruptible and keyboard accessible.
- app/models/invoice.rb 142 lines
- app/models/concerns/billable.rb 88 lines
- app/controllers/invoices_controller.rb 64 lines
- spec/models/invoice_spec.rb 210 lines
<%# A marker that opens to show what happened. The controller keeps aria-expanded in sync and animates the panel height. min-h-36 only reserves room so this demo does not shift when it opens. %>
<div class="min-h-36 w-full max-w-sm" data-controller="marker">
<button type="button" data-marker-target="trigger" data-action="marker#toggle" aria-expanded="false" aria-controls="marker-explored-files" class="group -mx-2 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-neutral-500 transition-colors duration-150 ease-out hover:text-neutral-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-600 aria-expanded:text-neutral-900 dark:text-neutral-400 dark:hover:text-white dark:focus-visible:outline-neutral-200 dark:aria-expanded:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="7.75" cy="7.75" r="5"></circle><path d="M15.25 15.25l-3.96-3.96"></path></svg>
<span>Explored 4 files</span>
<svg xmlns="http://www.w3.org/2000/svg" class="size-3.5 shrink-0 transition-[rotate] duration-200 ease-out group-aria-expanded:rotate-90 motion-reduce:transition-none" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6.75 3.75L12 9l-5.25 5.25"></path></svg>
</button>
<div id="marker-explored-files" data-marker-target="panel" hidden class="overflow-hidden">
<ul class="ml-2 space-y-2 border-l border-black/10 py-2 pl-4 text-sm text-neutral-500 dark:border-white/10 dark:text-neutral-400">
<li class="flex items-center justify-between gap-4">
<span class="min-w-0 truncate font-mono text-xs">app/models/invoice.rb</span>
<span class="shrink-0 text-xs tabular-nums text-neutral-400 dark:text-neutral-500">142 lines</span>
</li>
<li class="flex items-center justify-between gap-4">
<span class="min-w-0 truncate font-mono text-xs">app/models/concerns/billable.rb</span>
<span class="shrink-0 text-xs tabular-nums text-neutral-400 dark:text-neutral-500">88 lines</span>
</li>
<li class="flex items-center justify-between gap-4">
<span class="min-w-0 truncate font-mono text-xs">app/controllers/invoices_controller.rb</span>
<span class="shrink-0 text-xs tabular-nums text-neutral-400 dark:text-neutral-500">64 lines</span>
</li>
<li class="flex items-center justify-between gap-4">
<span class="min-w-0 truncate font-mono text-xs">spec/models/invoice_spec.rb</span>
<span class="shrink-0 text-xs tabular-nums text-neutral-400 dark:text-neutral-500">210 lines</span>
</li>
</ul>
</div>
</div>
Markers in a Conversation
All the pieces together in a thread: a date separator, activity notes, a checkpoint, and a streaming status.
Invoices over $10k are rounding wrong. Can you find out why?
Found it. Invoice#total converts to a float before applying tax. I switched it to BigDecimal and added a spec.
Nice. Run the full suite before we merge.
<%# Every marker variant working together in a thread: date separator, activity notes, a checkpoint, and a streaming status. %>
<div class="w-full max-w-md rounded-xl border border-black/10 bg-white p-4 shadow-xs sm:p-5 dark:border-white/10 dark:bg-neutral-900">
<div class="flex flex-col gap-4">
<div class="flex items-center gap-3 text-xs font-medium text-neutral-500 before:h-px before:flex-1 before:bg-black/10 after:h-px after:flex-1 after:bg-black/10 dark:text-neutral-400 dark:before:bg-white/10 dark:after:bg-white/10">
<time datetime="2026-11-09">Today</time>
</div>
<p class="max-w-[85%] self-end rounded-2xl rounded-br-md bg-neutral-100 px-3.5 py-2 text-sm text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100">Invoices over $10k are rounding wrong. Can you find out why?</p>
<div class="space-y-2.5">
<div class="flex items-center gap-2 text-sm text-neutral-500 dark:text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="5" cy="3.75" r="1.75"></circle><circle cx="5" cy="14.25" r="1.75"></circle><circle cx="13" cy="5.75" r="1.75"></circle><path d="M5 5.5v7"></path><path d="M13 7.5v.5a2.5 2.5 0 0 1-2.5 2.5h-3A2.5 2.5 0 0 0 5 12.5"></path></svg>
<span class="min-w-0 truncate">Switched to <span class="font-medium text-neutral-800 dark:text-neutral-200">fix/invoice-rounding</span></span>
</div>
<div class="flex items-center gap-2 text-sm text-neutral-500 dark:text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="7.75" cy="7.75" r="5"></circle><path d="M15.25 15.25l-3.96-3.96"></path></svg>
<span>Explored 4 files</span>
</div>
</div>
<p class="text-sm leading-relaxed text-neutral-800 dark:text-neutral-200">Found it. <code class="rounded-md bg-neutral-100 px-1.5 py-0.5 font-mono text-xs dark:bg-neutral-800">Invoice#total</code> converts to a float before applying tax. I switched it to <code class="rounded-md bg-neutral-100 px-1.5 py-0.5 font-mono text-xs dark:bg-neutral-800">BigDecimal</code> and added a spec.</p>
<div class="flex items-center gap-3 text-xs font-medium text-neutral-500 before:h-px before:flex-1 before:bg-black/10 after:h-px after:flex-1 after:bg-black/10 dark:text-neutral-400 dark:before:bg-white/10 dark:after:bg-white/10">
<div class="flex items-center gap-1">
<span>Worked for 42s</span>
<button type="button" class="relative flex items-center justify-center gap-1.5 rounded-md bg-transparent px-1.5 py-1 text-xs font-medium whitespace-nowrap text-neutral-800 transition-all duration-100 ease-in-out select-none after:absolute after:-inset-2 hover:bg-neutral-100 hover:text-neutral-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-600 disabled:cursor-not-allowed disabled:opacity-50 dark:text-neutral-50 dark:hover:bg-neutral-600/50 dark:hover:text-white dark:focus-visible:outline-neutral-200">Restore</button>
</div>
</div>
<p class="max-w-[85%] self-end rounded-2xl rounded-br-md bg-neutral-100 px-3.5 py-2 text-sm text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100">Nice. Run the full suite before we merge.</p>
<div role="status" class="flex items-center gap-2 text-sm text-neutral-500 dark:text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 shrink-0 animate-spin" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><circle cx="9" cy="9" r="6.25" class="opacity-25"></circle><path d="M15.25 9A6.25 6.25 0 0 0 9 2.75"></path></svg>
<span class="bg-linear-to-r from-neutral-400 from-35% via-neutral-950 via-50% to-neutral-400 to-65% bg-[length:250%_100%] bg-[position:100%_0] bg-clip-text text-transparent motion-safe:animate-marker-shimmer dark:from-neutral-400 dark:from-40% dark:via-white dark:to-neutral-400 dark:to-60%">Running 128 tests…</span>
</div>
</div>
</div>
Configuration
Controller Values
All values belong on the element with data-controller="marker".
Targets, Actions and Events
Accessibility
- Markers are presentational by default. Add
role="status"only to markers that report progress, so they are announced when they appear or change. - Do not add
role="separator"to a labeled separator: its text would stop being announced. The divider lines are decorative pseudo-elements. - Icons are decorative and use
aria-hidden="true". An icon-only marker needs anaria-label. - Markers that navigate or act are real
<a>and<button>elements. - The ticking elapsed counter is hidden from assistive tech while running, so only the state change is announced.