Marker

A status line, system note, bordered row or labelled divider inside a conversation.

Created branch fix/leap-years
Thinking…
Earlier messages summarised
Searched 3 files
import { Marker, MarkerContent, MarkerIcon } from "@/components/ui/marker"
import { Spinner } from "@/components/ui/spinner"
import { VStack } from "@/components/ui/stack"
import { shimmerStyles } from "@/lib/shimmer"
import { widths } from "@/theme/widths"
import { GitBranchIcon } from "@phosphor-icons/react/dist/csr/GitBranch"
import { MagnifyingGlassIcon } from "@phosphor-icons/react/dist/csr/MagnifyingGlass"

export default function MarkerDemo() {
  return (
    <VStack gap={8} xstyle={widths.sm}>
      <Marker>
        <MarkerIcon>
          <GitBranchIcon />
        </MarkerIcon>
        <MarkerContent>Created branch fix/leap-years</MarkerContent>
      </Marker>
      <Marker role="status">
        <MarkerIcon>
          <Spinner />
        </MarkerIcon>
        <MarkerContent xstyle={shimmerStyles.base}>Thinking…</MarkerContent>
      </Marker>
      <Marker variant="separator">
        <MarkerContent>Earlier messages summarised</MarkerContent>
      </Marker>
      <Marker>
        <MarkerIcon>
          <MagnifyingGlassIcon />
        </MarkerIcon>
        <MarkerContent>Searched 3 files</MarkerContent>
      </Marker>
    </VStack>
  )
}

Installation

pnpm dlx shadcn@latest add @arene/marker

Needs the arene setup first. Also adds Separator.

Usage

import { Marker, MarkerContent, MarkerIcon } from "@/components/ui/marker"
<Marker>
  <MarkerIcon>
    <CheckIcon />
  </MarkerIcon>
  <MarkerContent>Searched 3 files</MarkerContent>
</Marker>

Composition

Marker
├── MarkerIcon
└── MarkerContent

Variants

variant picks one of three shapes: inline, a bordered row or a labelled separator.

The default marker sits inline with the text.
The separator variant
The border variant marks off a row.
import { Marker, MarkerContent } from "@/components/ui/marker"
import { VStack } from "@/components/ui/stack"
import { widths } from "@/theme/widths"

export default function MarkerVariants() {
  return (
    <VStack gap={8} xstyle={widths.sm}>
      <Marker>
        <MarkerContent>The default marker sits inline with the text.</MarkerContent>
      </Marker>
      <Marker variant="separator">
        <MarkerContent>The separator variant</MarkerContent>
      </Marker>
      <Marker variant="border">
        <MarkerContent>The border variant marks off a row.</MarkerContent>
      </Marker>
    </VStack>
  )
}
VariantDescription
defaultAn inline marker for status, notes and actions
borderA default marker with a hairline under the row
separatorA centred label with a divider line on either side

Status

Set role="status" and put a Spinner in MarkerIcon for a streaming or in-progress marker, so the update is announced.

Summarising earlier messages
Running 48 tests
import { Marker, MarkerContent, MarkerIcon } from "@/components/ui/marker"
import { Spinner } from "@/components/ui/spinner"
import { VStack } from "@/components/ui/stack"
import { widths } from "@/theme/widths"

export default function MarkerStatus() {
  return (
    <VStack gap={8} xstyle={widths.sm}>
      <Marker role="status">
        <MarkerIcon>
          <Spinner />
        </MarkerIcon>
        <MarkerContent>Summarising earlier messages</MarkerContent>
      </Marker>
      <Marker variant="separator" role="status">
        <MarkerIcon>
          <Spinner />
        </MarkerIcon>
        <MarkerContent>Running 48 tests</MarkerContent>
      </Marker>
    </VStack>
  )
}

Shimmer

Merge shimmerStyles.base into MarkerContent through xstyle to animate streaming status text.

Thinking…
Searching the docs
import { Marker, MarkerContent } from "@/components/ui/marker"
import { VStack } from "@/components/ui/stack"
import { shimmerStyles } from "@/lib/shimmer"
import { widths } from "@/theme/widths"

export default function MarkerShimmer() {
  return (
    <VStack gap={8} xstyle={widths.sm}>
      <Marker role="status">
        <MarkerContent xstyle={shimmerStyles.base}>Thinking…</MarkerContent>
      </Marker>
      <Marker variant="separator" role="status">
        <MarkerContent xstyle={shimmerStyles.base}>Searching the docs</MarkerContent>
      </Marker>
    </VStack>
  )
}

Separator

Use the separator variant for a labelled divider, such as a date or a section break, in a conversation.

Today
Took 1m 12s
Earlier messages summarised
import { Marker, MarkerContent } from "@/components/ui/marker"
import { VStack } from "@/components/ui/stack"
import { widths } from "@/theme/widths"

export default function MarkerSeparator() {
  return (
    <VStack gap={8} xstyle={widths.sm}>
      <Marker variant="separator">
        <MarkerContent>Today</MarkerContent>
      </Marker>
      <Marker variant="separator">
        <MarkerContent>Took 1m 12s</MarkerContent>
      </Marker>
      <Marker variant="separator">
        <MarkerContent>Earlier messages summarised</MarkerContent>
      </Marker>
    </VStack>
  )
}

Border

The border variant keeps the default layout and draws a hairline under the row, which sets it apart from the row that follows.

Checked out fix/leap-years
Searched 12 calendar modules
Opened the design notes
import { Marker, MarkerContent, MarkerIcon } from "@/components/ui/marker"
import { VStack } from "@/components/ui/stack"
import { widths } from "@/theme/widths"
import { FileTextIcon } from "@phosphor-icons/react/dist/csr/FileText"
import { GitBranchIcon } from "@phosphor-icons/react/dist/csr/GitBranch"
import { MagnifyingGlassIcon } from "@phosphor-icons/react/dist/csr/MagnifyingGlass"

export default function MarkerBorder() {
  return (
    <VStack gap={3} xstyle={widths.sm}>
      <Marker variant="border">
        <MarkerIcon>
          <GitBranchIcon />
        </MarkerIcon>
        <MarkerContent>Checked out fix/leap-years</MarkerContent>
      </Marker>
      <Marker variant="border">
        <MarkerIcon>
          <MagnifyingGlassIcon />
        </MarkerIcon>
        <MarkerContent>Searched 12 calendar modules</MarkerContent>
      </Marker>
      <Marker variant="border">
        <MarkerIcon>
          <FileTextIcon />
        </MarkerIcon>
        <MarkerContent>Opened the design notes</MarkerContent>
      </Marker>
    </VStack>
  )
}

With icon

Use MarkerIcon to render an icon beside the content. To stack the icon above the content, pass flexDirection: "column" through xstyle.

Created branch fix/leap-years
Searched 3 files
Notes synced
import * as stylex from "@stylexjs/stylex"
import { Marker, MarkerContent, MarkerIcon } from "@/components/ui/marker"
import { VStack } from "@/components/ui/stack"
import { widths } from "@/theme/widths"
import { BookOpenTextIcon } from "@phosphor-icons/react/dist/csr/BookOpenText"
import { GitBranchIcon } from "@phosphor-icons/react/dist/csr/GitBranch"
import { MagnifyingGlassIcon } from "@phosphor-icons/react/dist/csr/MagnifyingGlass"

const styles = stylex.create({
  stacked: { flexDirection: "column" },
})

export default function MarkerIconDemo() {
  return (
    <VStack gap={12} xstyle={widths.sm}>
      <Marker>
        <MarkerIcon>
          <GitBranchIcon />
        </MarkerIcon>
        <MarkerContent>Created branch fix/leap-years</MarkerContent>
      </Marker>
      <Marker variant="separator">
        <MarkerIcon>
          <MagnifyingGlassIcon />
        </MarkerIcon>
        <MarkerContent>Searched 3 files</MarkerContent>
      </Marker>
      <Marker xstyle={styles.stacked}>
        <MarkerIcon>
          <BookOpenTextIcon />
        </MarkerIcon>
        <MarkerContent>Notes synced</MarkerContent>
      </Marker>
    </VStack>
  )
}

Turn a marker into a link or a button with render. A marker rendered as an a is underlined, and an a or button marker shows a pointer, turns to the foreground colour on hover and shows a ring on keyboard focus. A link inside MarkerContent is underlined and lights up on hover too.

"use client"

import { useState } from "react"
import { Marker, MarkerContent, MarkerIcon } from "@/components/ui/marker"
import { VStack } from "@/components/ui/stack"
import { widths } from "@/theme/widths"
import { ArrowCounterClockwiseIcon } from "@phosphor-icons/react/dist/csr/ArrowCounterClockwise"
import { GitPullRequestIcon } from "@phosphor-icons/react/dist/csr/GitPullRequest"

export default function MarkerLinkButton() {
  const [reverted, setReverted] = useState(false)

  return (
    <VStack gap={8} xstyle={widths.sm}>
      <Marker render={<a href="#links-and-buttons" />}>
        <MarkerIcon>
          <GitPullRequestIcon />
        </MarkerIcon>
        <MarkerContent>Open pull request #128</MarkerContent>
      </Marker>
      <Marker render={<button type="button" onClick={() => setReverted((value) => !value)} />}>
        <MarkerIcon>
          <ArrowCounterClockwiseIcon />
        </MarkerIcon>
        <MarkerContent>{reverted ? "Edit undone. Redo" : "Undo this edit"}</MarkerContent>
      </Marker>
    </VStack>
  )
}
<Marker render={<a href="/pulls/128" />}>
  <MarkerContent>Open pull request #128</MarkerContent>
</Marker>

Accessibility

Marker renders a plain div with no role, because the right semantics depend on what the marker is for.

  • Status and progress. For a marker that updates while work runs, such as "Thinking…" or a running tool, pass role="status" so assistive technology announces the change.
  • Labelled separators. A separator with text needs no role. Its lines are hidden with aria-hidden, and the label is read as ordinary content.
  • Decorative icons. MarkerIcon sets aria-hidden, so MarkerContent carries the meaning. A marker with only an icon still needs text: put it in a MarkerContent with xstyle={states.srOnly}, which hides it visually. An aria-label on the marker is not read, because a div with no role cannot be named.
  • Interactive markers. A marker that navigates or acts should render a real a or button through render, so it is focusable and exposes the right role. Its accessible name comes from the marker text.

Don't put role="separator" on a labelled divider. That role is named only by aria-label and treats its children as presentational, so a screen reader would skip the visible label.

API reference

Pass render to replace a part's element or compose it with another component. Every part also takes xstyle, className and style, which is real inline CSS merged over the compiled styles.

Marker

Renders a div. With variant="separator" it renders a hidden line, styled with separatorStyles from Separator, before and after its children.

PropTypeDefault
variant"default" | "border" | "separator""default"

MarkerIcon

Renders a span with aria-hidden, sized by --arene-icon-size.

MarkerContent

Renders a span that wraps long words rather than overflowing.

markerStyles

The style map behind the component, exported so you can apply the same styles to any element.

KeyDescription
baseThe row, muted text, link and hover styles, and the focus ring
variantsOne entry per variant, keyed by its name
iconThe icon box
contentThe content's wrapping

Data attributes

AttributeOnEffect
data-slot="marker"the rootTargets the marker
data-variantthe rootReflects the variant prop
data-slot="marker-icon"the iconTargets the icon box
data-slot="marker-content"the contentTargets the text

CSS variables

VariableOnEffect
--arene-icon-sizethe rootThe icon size, 1rem. Set it with style on Marker

Cast the object to CSSProperties, as Sidebar does. xstyle rejects a StyleX entry that sets only custom properties.