# Marker

Mark a conversation boundary or event without turning it into a message.

## Preview

marker-preview-1.jsx

```jsx
import { useEffect, useRef, useState } from "react";
import { UserRoundPlus } from "lucide-react";
import { Avatar } from "@/components/ui/avatar";
import { Button } from "@/components/ui/button";
import {
  Conversation,
  ConversationContent,
  ConversationItem,
} from "@/components/ui/conversation";
import { Marker } from "@/components/ui/marker";
import {
  Message,
  MessageAvatar,
  MessageBody,
  MessageContent,
  MessageFooter,
  MessageHeader,
} from "@/components/ui/message";

export default function Example() {
  const [phase, setPhase] = useState("idle");
  const timer = useRef(undefined);
  const phaseRef = useRef(phase);
  phaseRef.current = phase;
  useEffect(
    () => () => {
      if (timer.current !== undefined) window.clearTimeout(timer.current);
    },
    [],
  );
  const request = () => {
    if (phaseRef.current !== "idle") return;
    phaseRef.current = "connecting";
    setPhase("connecting");
    timer.current = window.setTimeout(() => {
      phaseRef.current = "joined";
      setPhase("joined");
    }, 900);
  };
  return (
    <div data-preview-wide>
      <Conversation
        label="Delivery support conversation"
        announcement={
          phase === "connecting"
            ? "Connecting Rina to the conversation."
            : phase === "joined"
              ? "Rina joined the conversation."
              : ""
        }
      >
        <ConversationContent>
          <Marker kind="date">Today</Marker>
          <ConversationItem id={MARTA.id} message={MARTA}>
            <Message actor="user">
              <MessageBody>{text(MARTA)}</MessageBody>
            </Message>
          </ConversationItem>
          <ConversationItem id={SOL.id} message={SOL}>
            <Message actor="assistant">
              <MessageAvatar>
                <Avatar
                  name="Sol support agent"
                  kind="agent"
                  seed="Sol support agent"
                />
              </MessageAvatar>
              <MessageContent>
                <MessageHeader>Sol</MessageHeader>
                <MessageBody>{text(SOL)}</MessageBody>
                {phase !== "joined" && (
                  <MessageFooter>
                    <Button
                      variant="outline"
                      size="sm"
                      leadingIcon={<UserRoundPlus />}
                      disabled={phase === "connecting"}
                      onClick={request}
                    >
                      {phase === "idle"
                        ? "Talk to a human agent"
                        : "Connecting\u2026"}
                    </Button>
                  </MessageFooter>
                )}
              </MessageContent>
            </Message>
          </ConversationItem>
          {phase === "connecting" && (
            <Marker kind="status" role="presentation">
              Connecting Rina to the conversation
            </Marker>
          )}
          {phase === "joined" && (
            <Marker kind="person-joined" role="presentation">
              Rina joined the conversation.
            </Marker>
          )}
          {phase === "joined" && (
            <ConversationItem id={RINA.id} message={RINA}>
              <Message actor="user" self={false}>
                <MessageAvatar>
                  <Avatar name="Rina Hart" kind="human" seed="Rina Hart" />
                </MessageAvatar>
                <MessageContent>
                  <MessageHeader>Rina</MessageHeader>
                  <MessageBody>{text(RINA)}</MessageBody>
                </MessageContent>
              </Message>
            </ConversationItem>
          )}
        </ConversationContent>
      </Conversation>
    </div>
  );
}

function message(id, actor, text2, author) {
  return {
    id,
    actor,
    author,
    parts: [
      {
        type: "text",
        text: text2,
      },
    ],
  };
}

function text(item) {
  return item.parts
    .flatMap((part) => (part.type === "text" ? [part.text] : []))
    .join("\n");
}

var MARTA = message(
  "marta-request",
  "user",
  "Could I speak with a person about this delivery?",
);

var SOL = message(
  "sol-reply",
  "assistant",
  "I\u2019ll bring someone from support into the conversation.",
  {
    id: "sol",
    name: "Sol",
  },
);

var RINA = message(
  "rina-reply",
  "user",
  "I\u2019m here. I\u2019ll review the delivery details with you.",
  {
    id: "rina",
    name: "Rina Hart",
  },
);

```

The handoff action sits inside the assistant message. Selecting “Talk to a human agent” shows a 900 ms connecting status, then adds Rina to the conversation. The application owns real handoff policy and transport.

## Design guidance

Use Marker for short transcript boundaries and events such as a date, unread count, participant change, or handoff. Use [Message](/ai-elements/message) for authored conversation content. kind records caller-owned event meaning; it does not create event text. The default presentation puts decorative rules on both sides. Choose variant="note" to omit the rules. Status content is caller-owned and uses role="status" unless the caller overrides it.

## Installation

```sh
npx shadcn@latest add https://ghost-ui.com/r/marker.json
```

```text
src/components/ui/marker.tsx
src/components/ui/marker.css
```

Import foundation.css once after shared tokens when using foundation styles.

## Basic usage

```tsx
import { Marker } from "@/components/ui/marker";

export function MarkerExample() {
  return <Marker kind="date">Today</Marker>;
}
```

## Structures

- Marker
  - MarkerContent (optional explicit wrapper)

Marker wraps plain children in optional MarkerContent; use it explicitly when you need span attributes or a ref. It renders two decorative Separator parts except with variant="note". kind identifies caller-owned event meaning, while variant selects appearance. A bare Marker has kind="note" and the separator presentation. Explicit variant="separator" defaults to kind="date"; explicit variant="status" defaults to kind="status". The status kind keeps status semantics with any explicit variant, unless the caller overrides role.

## Examples

### Time and history boundaries

#### Time marker

marker-time-marker-2.jsx

```jsx
import { Marker } from "@/components/ui/marker";

export default function Example() {
  return <Marker kind="time">10:42 AM</Marker>;
}

function message(id, actor, text, author) {
  return {
    id,
    actor,
    author,
    parts: [
      {
        type: "text",
        text,
      },
    ],
  };
}

var MARTA = message(
  "marta-request",
  "user",
  "Could I speak with a person about this delivery?",
);

var SOL = message(
  "sol-reply",
  "assistant",
  "I\u2019ll bring someone from support into the conversation.",
  {
    id: "sol",
    name: "Sol",
  },
);

var RINA = message(
  "rina-reply",
  "user",
  "I\u2019m here. I\u2019ll review the delivery details with you.",
  {
    id: "rina",
    name: "Rina Hart",
  },
);

```

#### Date boundary

marker-date-boundary-3.jsx

```jsx
import { Marker } from "@/components/ui/marker";

export default function Example() {
  return <Marker kind="date">Today</Marker>;
}

function message(id, actor, text, author) {
  return {
    id,
    actor,
    author,
    parts: [
      {
        type: "text",
        text,
      },
    ],
  };
}

var MARTA = message(
  "marta-request",
  "user",
  "Could I speak with a person about this delivery?",
);

var SOL = message(
  "sol-reply",
  "assistant",
  "I\u2019ll bring someone from support into the conversation.",
  {
    id: "sol",
    name: "Sol",
  },
);

var RINA = message(
  "rina-reply",
  "user",
  "I\u2019m here. I\u2019ll review the delivery details with you.",
  {
    id: "rina",
    name: "Rina Hart",
  },
);

```

#### Previous conversation boundary

marker-previous-conversation-boundary-4.jsx

```jsx
import { Marker } from "@/components/ui/marker";

export default function Example() {
  return <Marker kind="last-conversation">Previous conversation</Marker>;
}

function message(id, actor, text, author) {
  return {
    id,
    actor,
    author,
    parts: [
      {
        type: "text",
        text,
      },
    ],
  };
}

var MARTA = message(
  "marta-request",
  "user",
  "Could I speak with a person about this delivery?",
);

var SOL = message(
  "sol-reply",
  "assistant",
  "I\u2019ll bring someone from support into the conversation.",
  {
    id: "sol",
    name: "Sol",
  },
);

var RINA = message(
  "rina-reply",
  "user",
  "I\u2019m here. I\u2019ll review the delivery details with you.",
  {
    id: "rina",
    name: "Rina Hart",
  },
);

```

### Read boundaries

#### Last-read marker

marker-last-read-marker-5.jsx

```jsx
import { Marker } from "@/components/ui/marker";

export default function Example() {
  return <Marker kind="last-read">Last read · 10:42 AM</Marker>;
}

function message(id, actor, text, author) {
  return {
    id,
    actor,
    author,
    parts: [
      {
        type: "text",
        text,
      },
    ],
  };
}

var MARTA = message(
  "marta-request",
  "user",
  "Could I speak with a person about this delivery?",
);

var SOL = message(
  "sol-reply",
  "assistant",
  "I\u2019ll bring someone from support into the conversation.",
  {
    id: "sol",
    name: "Sol",
  },
);

var RINA = message(
  "rina-reply",
  "user",
  "I\u2019m here. I\u2019ll review the delivery details with you.",
  {
    id: "rina",
    name: "Rina Hart",
  },
);

```

#### Unread count

marker-unread-count-6.jsx

```jsx
import { Marker } from "@/components/ui/marker";

export default function Example() {
  return <Marker kind="unread">3 unread messages</Marker>;
}

function message(id, actor, text, author) {
  return {
    id,
    actor,
    author,
    parts: [
      {
        type: "text",
        text,
      },
    ],
  };
}

var MARTA = message(
  "marta-request",
  "user",
  "Could I speak with a person about this delivery?",
);

var SOL = message(
  "sol-reply",
  "assistant",
  "I\u2019ll bring someone from support into the conversation.",
  {
    id: "sol",
    name: "Sol",
  },
);

var RINA = message(
  "rina-reply",
  "user",
  "I\u2019m here. I\u2019ll review the delivery details with you.",
  {
    id: "rina",
    name: "Rina Hart",
  },
);

```

### Participant events

#### Person joined

marker-person-joined-7.jsx

```jsx
import { Marker } from "@/components/ui/marker";

export default function Example() {
  return (
    <Marker kind="person-joined">Rina Hart joined the conversation.</Marker>
  );
}

function message(id, actor, text, author) {
  return {
    id,
    actor,
    author,
    parts: [
      {
        type: "text",
        text,
      },
    ],
  };
}

var MARTA = message(
  "marta-request",
  "user",
  "Could I speak with a person about this delivery?",
);

var SOL = message(
  "sol-reply",
  "assistant",
  "I\u2019ll bring someone from support into the conversation.",
  {
    id: "sol",
    name: "Sol",
  },
);

var RINA = message(
  "rina-reply",
  "user",
  "I\u2019m here. I\u2019ll review the delivery details with you.",
  {
    id: "rina",
    name: "Rina Hart",
  },
);

```

#### Agent joined

marker-agent-joined-8.jsx

```jsx
import { Marker } from "@/components/ui/marker";

export default function Example() {
  return (
    <Marker kind="agent-joined">
      Support assistant joined the conversation.
    </Marker>
  );
}

function message(id, actor, text, author) {
  return {
    id,
    actor,
    author,
    parts: [
      {
        type: "text",
        text,
      },
    ],
  };
}

var MARTA = message(
  "marta-request",
  "user",
  "Could I speak with a person about this delivery?",
);

var SOL = message(
  "sol-reply",
  "assistant",
  "I\u2019ll bring someone from support into the conversation.",
  {
    id: "sol",
    name: "Sol",
  },
);

var RINA = message(
  "rina-reply",
  "user",
  "I\u2019m here. I\u2019ll review the delivery details with you.",
  {
    id: "rina",
    name: "Rina Hart",
  },
);

```

#### Person left

marker-person-left-9.jsx

```jsx
import { Marker } from "@/components/ui/marker";

export default function Example() {
  return <Marker kind="person-left">Marta left the conversation.</Marker>;
}

function message(id, actor, text, author) {
  return {
    id,
    actor,
    author,
    parts: [
      {
        type: "text",
        text,
      },
    ],
  };
}

var MARTA = message(
  "marta-request",
  "user",
  "Could I speak with a person about this delivery?",
);

var SOL = message(
  "sol-reply",
  "assistant",
  "I\u2019ll bring someone from support into the conversation.",
  {
    id: "sol",
    name: "Sol",
  },
);

var RINA = message(
  "rina-reply",
  "user",
  "I\u2019m here. I\u2019ll review the delivery details with you.",
  {
    id: "rina",
    name: "Rina Hart",
  },
);

```

#### Agent left

marker-agent-left-10.jsx

```jsx
import { Marker } from "@/components/ui/marker";

export default function Example() {
  return (
    <Marker kind="agent-left">Support assistant left the conversation.</Marker>
  );
}

function message(id, actor, text, author) {
  return {
    id,
    actor,
    author,
    parts: [
      {
        type: "text",
        text,
      },
    ],
  };
}

var MARTA = message(
  "marta-request",
  "user",
  "Could I speak with a person about this delivery?",
);

var SOL = message(
  "sol-reply",
  "assistant",
  "I\u2019ll bring someone from support into the conversation.",
  {
    id: "sol",
    name: "Sol",
  },
);

var RINA = message(
  "rina-reply",
  "user",
  "I\u2019m here. I\u2019ll review the delivery details with you.",
  {
    id: "rina",
    name: "Rina Hart",
  },
);

```

### Conversation events

#### Human handoff

marker-human-handoff-11.jsx

```jsx
import { Marker } from "@/components/ui/marker";

export default function Example() {
  return (
    <Marker kind="handoff">Rina took over from the support assistant.</Marker>
  );
}

function message(id, actor, text, author) {
  return {
    id,
    actor,
    author,
    parts: [
      {
        type: "text",
        text,
      },
    ],
  };
}

var MARTA = message(
  "marta-request",
  "user",
  "Could I speak with a person about this delivery?",
);

var SOL = message(
  "sol-reply",
  "assistant",
  "I\u2019ll bring someone from support into the conversation.",
  {
    id: "sol",
    name: "Sol",
  },
);

var RINA = message(
  "rina-reply",
  "user",
  "I\u2019m here. I\u2019ll review the delivery details with you.",
  {
    id: "rina",
    name: "Rina Hart",
  },
);

```

#### Conversation started

marker-conversation-started-12.jsx

```jsx
import { Marker } from "@/components/ui/marker";

export default function Example() {
  return <Marker kind="conversation-started">Conversation started</Marker>;
}

function message(id, actor, text, author) {
  return {
    id,
    actor,
    author,
    parts: [
      {
        type: "text",
        text,
      },
    ],
  };
}

var MARTA = message(
  "marta-request",
  "user",
  "Could I speak with a person about this delivery?",
);

var SOL = message(
  "sol-reply",
  "assistant",
  "I\u2019ll bring someone from support into the conversation.",
  {
    id: "sol",
    name: "Sol",
  },
);

var RINA = message(
  "rina-reply",
  "user",
  "I\u2019m here. I\u2019ll review the delivery details with you.",
  {
    id: "rina",
    name: "Rina Hart",
  },
);

```

#### Conversation ended

marker-conversation-ended-13.jsx

```jsx
import { Marker } from "@/components/ui/marker";

export default function Example() {
  return <Marker kind="conversation-ended">Conversation ended</Marker>;
}

function message(id, actor, text, author) {
  return {
    id,
    actor,
    author,
    parts: [
      {
        type: "text",
        text,
      },
    ],
  };
}

var MARTA = message(
  "marta-request",
  "user",
  "Could I speak with a person about this delivery?",
);

var SOL = message(
  "sol-reply",
  "assistant",
  "I\u2019ll bring someone from support into the conversation.",
  {
    id: "sol",
    name: "Sol",
  },
);

var RINA = message(
  "rina-reply",
  "user",
  "I\u2019m here. I\u2019ll review the delivery details with you.",
  {
    id: "rina",
    name: "Rina Hart",
  },
);

```

### Notes and status

#### Caller-defined note

marker-caller-defined-note-14.jsx

```jsx
import { Marker } from "@/components/ui/marker";

export default function Example() {
  return <Marker kind="note">Delivery details were updated.</Marker>;
}

function message(id, actor, text, author) {
  return {
    id,
    actor,
    author,
    parts: [
      {
        type: "text",
        text,
      },
    ],
  };
}

var MARTA = message(
  "marta-request",
  "user",
  "Could I speak with a person about this delivery?",
);

var SOL = message(
  "sol-reply",
  "assistant",
  "I\u2019ll bring someone from support into the conversation.",
  {
    id: "sol",
    name: "Sol",
  },
);

var RINA = message(
  "rina-reply",
  "user",
  "I\u2019m here. I\u2019ll review the delivery details with you.",
  {
    id: "rina",
    name: "Rina Hart",
  },
);

```

#### Caller-owned status

marker-caller-owned-status-15.jsx

```jsx
import { Marker } from "@/components/ui/marker";

export default function Example() {
  return <Marker kind="status">Connecting Rina to the conversation</Marker>;
}

function message(id, actor, text, author) {
  return {
    id,
    actor,
    author,
    parts: [
      {
        type: "text",
        text,
      },
    ],
  };
}

var MARTA = message(
  "marta-request",
  "user",
  "Could I speak with a person about this delivery?",
);

var SOL = message(
  "sol-reply",
  "assistant",
  "I\u2019ll bring someone from support into the conversation.",
  {
    id: "sol",
    name: "Sol",
  },
);

var RINA = message(
  "rina-reply",
  "user",
  "I\u2019m here. I\u2019ll review the delivery details with you.",
  {
    id: "rina",
    name: "Rina Hart",
  },
);

```

#### Plain note variant

Use the explicit note presentation when the content should read as a plain line without rules.

marker-plain-note-variant-16.jsx

```jsx
import { Marker } from "@/components/ui/marker";

export default function Example() {
  return <Marker variant="note">Delivery details were updated.</Marker>;
}

function message(id, actor, text, author) {
  return {
    id,
    actor,
    author,
    parts: [
      {
        type: "text",
        text,
      },
    ],
  };
}

var MARTA = message(
  "marta-request",
  "user",
  "Could I speak with a person about this delivery?",
);

var SOL = message(
  "sol-reply",
  "assistant",
  "I\u2019ll bring someone from support into the conversation.",
  {
    id: "sol",
    name: "Sol",
  },
);

var RINA = message(
  "rina-reply",
  "user",
  "I\u2019m here. I\u2019ll review the delivery details with you.",
  {
    id: "rina",
    name: "Rina Hart",
  },
);

```

#### Long participant label

Long participant names wrap inside the available conversation width, including unbroken strings.

marker-long-participant-label-17.jsx

```jsx
import { Marker } from "@/components/ui/marker";

export default function Example() {
  return (
    <Marker kind="person-joined">
      Alexandria-WillowbrookPartnershipOperationsandCustomerSuccess joined the
      delivery receipt review.
    </Marker>
  );
}

function message(id, actor, text, author) {
  return {
    id,
    actor,
    author,
    parts: [
      {
        type: "text",
        text,
      },
    ],
  };
}

var MARTA = message(
  "marta-request",
  "user",
  "Could I speak with a person about this delivery?",
);

var SOL = message(
  "sol-reply",
  "assistant",
  "I\u2019ll bring someone from support into the conversation.",
  {
    id: "sol",
    name: "Sol",
  },
);

var RINA = message(
  "rina-reply",
  "user",
  "I\u2019m here. I\u2019ll review the delivery details with you.",
  {
    id: "rina",
    name: "Rina Hart",
  },
);

```

## API reference

Marker properties

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| variant | 'note' \| 'separator' \| 'status' | kind === 'status' ? 'status' : 'separator' | Selects appearance. Explicit `note` omits the decorative rules. |
| kind | 'note' \| 'status' \| 'time' \| 'date' \| 'last-conversation' \| 'last-read' \| 'unread' \| 'person-joined' \| 'agent-joined' \| 'person-left' \| 'agent-left' \| 'handoff' \| 'conversation-started' \| 'conversation-ended' | 'note' (or 'date'/'status' for explicit separator/status variant) | Preserves caller-owned event meaning. |
| label | string | — | Sets `aria-label` when supplied. |
| children | ReactNode | — | Caller-owned content. Empty and whitespace-only content renders nothing; numeric zero remains visible. |
| native div props and ref | HTMLDivElement attributes + ref | — | Forwarded to the root. The caller's `role` overrides the default `status` role for kind `status`. |
| MarkerContent | span props + ref | — | Wraps content automatically; use explicitly for span attributes or a ref. |
