Skip to content
2k
On This Page

Marker

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
// Inline SVG icons from Lucide (https://lucide.dev), ISC License, Copyright (c) Lucide Icons and Contributors.

import { Marker, MarkerContent, MarkerIcon } from "~/components/ui/marker"
import { Spinner } from "~/components/ui/spinner"

export default function MarkerDemo() {
  return (
    <div class="flex w-full max-w-sm flex-col gap-8 py-12">
      <Marker>
        <MarkerIcon>
          <svg
            width="24"
            height="24"
            viewBox="0 0 24 24"
            fill="none"
            stroke="currentColor"
            stroke-width="2"
            stroke-linecap="round"
            stroke-linejoin="round"
            aria-hidden="true"
          >
            <path d="M15 6a9 9 0 0 0-9 9V3" />
            <circle cx="18" cy="6" r="3" />
            <circle cx="6" cy="18" r="3" />
          </svg>
        </MarkerIcon>
        <MarkerContent>Switched to a new branch</MarkerContent>
      </Marker>
      <Marker role="status">
        <MarkerIcon>
          <Spinner />
        </MarkerIcon>
        <MarkerContent class="shimmer">Thinking...</MarkerContent>
      </Marker>
      <Marker variant="separator">
        <MarkerContent>Conversation compacted</MarkerContent>
      </Marker>
      <Marker>
        <MarkerIcon>
          <svg
            width="24"
            height="24"
            viewBox="0 0 24 24"
            fill="none"
            stroke="currentColor"
            stroke-width="2"
            stroke-linecap="round"
            stroke-linejoin="round"
            aria-hidden="true"
          >
            <path d="m21 21-4.34-4.34" />
            <circle cx="11" cy="11" r="8" />
          </svg>
        </MarkerIcon>
        <MarkerContent>Explored 4 files</MarkerContent>
      </Marker>
    </div>
  )
}

The Marker component displays inline conversation markers such as status updates, system notes, bordered rows, and labeled separators. Compose it with Message in a conversation thread.

Installation

pnpm dlx solidui-cli@latest add marker

Install the following dependencies:

pnpm add class-variance-authority

Copy and paste the following code into your project.

components/ui/marker.tsx
import { dynamic, type ComponentProps, type JSX } from "@solidjs/web"
import { cva, type VariantProps } from "class-variance-authority"
import { isStatic, omit } from "solid-js"

import { cn } from "~/lib/utils"

const markerVariants = cva(
  "min-h-4 gap-2 text-left text-sm text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [a]:underline [a]:underline-offset-3 [a]:hover:text-foreground group/marker relative flex w-full items-center",
  {
    variants: {
      variant: {
        default: "",
        separator: "before:mr-1 before:h-px before:min-w-0 before:flex-1 before:bg-border after:ml-1 after:h-px after:min-w-0 after:flex-1 after:bg-border",
        border: "border-b border-border pb-2"
      }
    }
  }
)

export function Marker(
  props: Omit<ComponentProps<"div">, "class"> & {
    class?: string
    variant?: VariantProps<typeof markerVariants>["variant"]
    render?: (
      props: Record<string, unknown> & { class: string; children?: JSX.Element }
    ) => JSX.Element
  }
) {
  const Comp = dynamic(() => props.render ?? "div", {
    static: isStatic(props, "render")
  })
  const rest = omit(props, "class", "variant", "render")
  return (
    <Comp
      data-slot="marker"
      data-variant={props.variant ?? "default"}
      class={cn(
        markerVariants({ variant: props.variant ?? "default" }),
        props.class
      )}
      {...rest}
    />
  )
}

export function MarkerIcon(
  props: Omit<ComponentProps<"span">, "class"> & { class?: string }
) {
  return (
    <span
      {...props}
      data-slot="marker-icon"
      aria-hidden="true"
      class={cn("size-4 [&_svg:not([class*='size-'])]:size-4 shrink-0", props.class)}
    />
  )
}

export function MarkerContent(
  props: Omit<ComponentProps<"span">, "class"> & { class?: string }
) {
  return (
    <span
      {...props}
      data-slot="marker-content"
      class={cn("group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground min-w-0 wrap-break-word", props.class)}
    />
  )
}

export { markerVariants }

Update the import paths to match your project setup.

Usage

import { Marker, MarkerContent } from "~/components/ui/marker"
<Marker>
  <MarkerContent>Explored four files</MarkerContent>
</Marker>

variant is default, separator, or border. MarkerIcon is decorative; MarkerContent contains the readable label.

Composition

Use the following composition to build a marker:

Marker
├── MarkerIcon
└── MarkerContent

Features

  • Inline marker, bordered row, and labeled separator variants
  • Decorative icon slot that is hidden from assistive tech
  • Polymorphic root via render for link and button markers
  • Pairs with the shimmer utility for streaming status text
  • Customizable styling through the class prop on every part

Variants

Use variant to switch between an inline marker, bordered row, and labeled separator.

A default marker for inline notes.
A separator marker
A border marker for row boundaries.
import { Marker, MarkerContent } from "~/components/ui/marker"

export default function MarkerVariantsDemo() {
  return (
    <div class="flex w-full max-w-sm flex-col gap-8 py-12">
      <Marker>
        <MarkerContent>A default marker for inline notes.</MarkerContent>
      </Marker>
      <Marker variant="separator">
        <MarkerContent>A separator marker</MarkerContent>
      </Marker>
      <Marker variant="border">
        <MarkerContent>A border marker for row boundaries.</MarkerContent>
      </Marker>
    </div>
  )
}
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 { Marker, MarkerContent, MarkerIcon } from "~/components/ui/marker"
import { Spinner } from "~/components/ui/spinner"

export default function MarkerStatusDemo() {
  return (
    <div class="flex w-full max-w-sm flex-col gap-8 py-12">
      <Marker role="status">
        <MarkerIcon>
          <Spinner />
        </MarkerIcon>
        <MarkerContent>Compacting conversation</MarkerContent>
      </Marker>
      <Marker variant="separator" role="status">
        <MarkerIcon>
          <Spinner />
        </MarkerIcon>
        <MarkerContent>Running tests</MarkerContent>
      </Marker>
    </div>
  )
}

Shimmer

Add shimmer to MarkerContent for animated streaming text. The class is included in the shared stylesheet.

Thinking...
Reading 4 files
import { Marker, MarkerContent } from "~/components/ui/marker"

export default function MarkerShimmerDemo() {
  return (
    <div class="flex w-full max-w-sm flex-col gap-8 py-12">
      <Marker role="status">
        <MarkerContent class="shimmer">Thinking...</MarkerContent>
      </Marker>
      <Marker variant="separator" role="status">
        <MarkerContent class="shimmer">Reading 4 files</MarkerContent>
      </Marker>
    </div>
  )
}

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 { Marker, MarkerContent } from "~/components/ui/marker"

export default function MarkerSeparatorDemo() {
  return (
    <div class="flex w-full max-w-sm flex-col gap-8 py-12">
      <Marker variant="separator">
        <MarkerContent>Today</MarkerContent>
      </Marker>
      <Marker variant="separator">
        <MarkerContent>Worked for 42s</MarkerContent>
      </Marker>
      <Marker variant="separator">
        <MarkerContent>Conversation compacted</MarkerContent>
      </Marker>
    </div>
  )
}

Border

A bordered marker keeps the same semantics as the default marker. The bottom border is decorative. Choose role="status", a rendered link or button, or ordinary text according to the marker’s purpose.

Switched to release-candidate
Reviewed 8 related files
Opened implementation notes
// Inline SVG icons from Lucide (https://lucide.dev), ISC License, Copyright (c) Lucide Icons and Contributors.

import { Marker, MarkerContent, MarkerIcon } from "~/components/ui/marker"

export default function MarkerBorderDemo() {
  return (
    <div class="flex w-full max-w-sm flex-col gap-3 py-12">
      <Marker variant="border">
        <MarkerIcon>
          <svg
            width="24"
            height="24"
            viewBox="0 0 24 24"
            fill="none"
            stroke="currentColor"
            stroke-width="2"
            stroke-linecap="round"
            stroke-linejoin="round"
            aria-hidden="true"
          >
            <path d="M15 6a9 9 0 0 0-9 9V3" />
            <circle cx="18" cy="6" r="3" />
            <circle cx="6" cy="18" r="3" />
          </svg>
        </MarkerIcon>
        <MarkerContent>Switched to release-candidate</MarkerContent>
      </Marker>
      <Marker variant="border">
        <MarkerIcon>
          <svg
            width="24"
            height="24"
            viewBox="0 0 24 24"
            fill="none"
            stroke="currentColor"
            stroke-width="2"
            stroke-linecap="round"
            stroke-linejoin="round"
            aria-hidden="true"
          >
            <path d="m21 21-4.34-4.34" />
            <circle cx="11" cy="11" r="8" />
          </svg>
        </MarkerIcon>
        <MarkerContent>Reviewed 8 related files</MarkerContent>
      </Marker>
      <Marker variant="border">
        <MarkerIcon>
          <svg
            width="24"
            height="24"
            viewBox="0 0 24 24"
            fill="none"
            stroke="currentColor"
            stroke-width="2"
            stroke-linecap="round"
            stroke-linejoin="round"
            aria-hidden="true"
          >
            <path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" />
            <path d="M14 2v5a1 1 0 0 0 1 1h5" />
            <path d="M10 9H8" />
            <path d="M16 13H8" />
            <path d="M16 17H8" />
          </svg>
        </MarkerIcon>
        <MarkerContent>Opened implementation notes</MarkerContent>
      </Marker>
    </div>
  )
}

With Icon

Use MarkerIcon to render an icon alongside the content. Use flex-col to stack the icon above the content.

Switched to a new branch
Explored 4 files
Syncing completed
// Inline SVG icons from Lucide (https://lucide.dev), ISC License, Copyright (c) Lucide Icons and Contributors.

import { Marker, MarkerContent, MarkerIcon } from "~/components/ui/marker"

export default function MarkerIconDemo() {
  return (
    <div class="flex w-full max-w-sm flex-col gap-12 py-12">
      <Marker>
        <MarkerIcon>
          <svg
            width="24"
            height="24"
            viewBox="0 0 24 24"
            fill="none"
            stroke="currentColor"
            stroke-width="2"
            stroke-linecap="round"
            stroke-linejoin="round"
            aria-hidden="true"
          >
            <path d="M15 6a9 9 0 0 0-9 9V3" />
            <circle cx="18" cy="6" r="3" />
            <circle cx="6" cy="18" r="3" />
          </svg>
        </MarkerIcon>
        <MarkerContent>Switched to a new branch</MarkerContent>
      </Marker>
      <Marker variant="separator">
        <MarkerIcon>
          <svg
            width="24"
            height="24"
            viewBox="0 0 24 24"
            fill="none"
            stroke="currentColor"
            stroke-width="2"
            stroke-linecap="round"
            stroke-linejoin="round"
            aria-hidden="true"
          >
            <path d="m21 21-4.34-4.34" />
            <circle cx="11" cy="11" r="8" />
          </svg>
        </MarkerIcon>
        <MarkerContent>Explored 4 files</MarkerContent>
      </Marker>
      <Marker class="flex-col">
        <MarkerIcon>
          <svg
            width="24"
            height="24"
            viewBox="0 0 24 24"
            fill="none"
            stroke="currentColor"
            stroke-width="2"
            stroke-linecap="round"
            stroke-linejoin="round"
            aria-hidden="true"
          >
            <path d="M12 5v16" />
            <path d="m16 12 2 2 4-4" />
            <path d="M22 6V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2h4.001A2 2 0 0022 17v-1.344" />
          </svg>
        </MarkerIcon>
        <MarkerContent>Syncing completed</MarkerContent>
      </Marker>
    </div>
  )
}

Use the render prop on Marker to turn it into a link or button.

    View the pull request
    // Inline SVG icons from Lucide (https://lucide.dev), ISC License, Copyright (c) Lucide Icons and Contributors.
    
    import { Marker, MarkerContent, MarkerIcon } from "~/components/ui/marker"
    import { Toaster, createToaster } from "~/components/ui/toast"
    
    export default function MarkerLinkButtonDemo() {
      const toast = createToaster()
      return (
        <div class="flex w-full max-w-sm flex-col gap-8 py-12">
          <Toaster toaster={toast} />
          <Marker
            render={(partProps) => (
              <a {...partProps} href="#links-and-buttons">
                <MarkerIcon>
                  <svg
                    width="24"
                    height="24"
                    viewBox="0 0 24 24"
                    fill="none"
                    stroke="currentColor"
                    stroke-width="2"
                    stroke-linecap="round"
                    stroke-linejoin="round"
                    aria-hidden="true"
                  >
                    <path d="M15 6a9 9 0 0 0-9 9V3" />
                    <circle cx="18" cy="6" r="3" />
                    <circle cx="6" cy="18" r="3" />
                  </svg>
                </MarkerIcon>
                <MarkerContent>View the pull request</MarkerContent>
              </a>
            )}
          />
          <Marker
            render={(partProps) => (
              <button
                {...partProps}
                type="button"
                class={`${partProps.class} transition-colors hover:text-foreground`}
                onClick={() => toast("You clicked the revert button")}
              >
                <MarkerIcon>
                  <svg
                    width="24"
                    height="24"
                    viewBox="0 0 24 24"
                    fill="none"
                    stroke="currentColor"
                    stroke-width="2"
                    stroke-linecap="round"
                    stroke-linejoin="round"
                    aria-hidden="true"
                  >
                    <path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" />
                    <path d="M3 3v5h5" />
                  </svg>
                </MarkerIcon>
                <MarkerContent>Revert this change</MarkerContent>
              </button>
            )}
          />
        </div>
      )
    }

    Accessibility

    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" so assistive tech announces the update as it appears. Marker forwards role to the underlying element.

    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.

    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", asChild, or no role based on the marker’s purpose.

    Decorative Icons

    MarkerIcon is decorative and hidden from assistive tech with aria-hidden, so the adjacent MarkerContent carries the meaning. For an icon-only marker, provide an aria-label or visible text so it is not announced as empty.

    Interactive Markers

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

    API Reference

    Marker

    The root marker element. The file also exports markerVariants for composing the marker styles into custom components.

    PropTypeDefaultDescription
    variant"default" | "border" | "separator""default"The marker layout.
    renderRender function-Render a custom element with the part props.
    classstring-Additional classes to apply to the root element.

    MarkerIcon

    A decorative icon slot. Hidden from assistive tech with aria-hidden.

    PropTypeDefaultDescription
    classstring-Additional classes to apply to the icon slot.

    MarkerContent

    The marker text content.

    PropTypeDefaultDescription
    classstring-Additional classes to apply to the content slot.