Marker
An inline line inside a conversation: a system note, a labeled divider such as New messages, or a status pill with icon and time.
pnpm dlx shadcn@latest add @haze/marker---
import { ArrowDown, Bot, CalendarDays, CircleCheck, CirclePause, CircleX, Clock, Info, TriangleAlert, UserMinus, UserPlus } from "@lucide/astro";
import { cn } from "../../../lib/haze/utils";
interface Props {
/** note is a quiet line of text, divider has rules either side of the label, status is a tinted pill. */
variant?: "note" | "divider" | "status";
/** The text, such as "Ana Ilić joined the channel", "Today" or "Agent paused". */
label?: string;
/** Named icon from a fixed set. A slot named icon overrides it. Status falls back to an icon for its tone. */
icon?: "join" | "leave" | "info" | "clock" | "pause" | "check" | "alert" | "error" | "bot" | "calendar" | "unread";
/** Colors the icon and text of a note or divider and the tint of a status. Never the only signal: the label always says it too. */
tone?: "default" | "info" | "success" | "warning" | "destructive";
/** Machine-readable time for the time element. Pass a fixed value, never the current time. */
time?: string;
/** Time as it reads, such as "09:41". Falls back to the ISO string. */
timeLabel?: string;
/** Renders the label as a link, for example to jump to the first unread message. */
href?: string;
/** Note only: center the line (default) or align it to the start. */
align?: "center" | "start";
class?: string;
[key: string]: unknown;
}
const {
variant = "note",
label = "Ana Ilić joined the channel",
icon,
tone = "default",
time,
timeLabel,
href,
align = "center",
class: className,
...rest
} = Astro.props;
const icons = {
join: UserPlus,
leave: UserMinus,
info: Info,
clock: Clock,
pause: CirclePause,
check: CircleCheck,
alert: TriangleAlert,
error: CircleX,
bot: Bot,
calendar: CalendarDays,
unread: ArrowDown,
};
const toneIcons = { default: Info, info: Info, success: CircleCheck, warning: TriangleAlert, destructive: CircleX };
const Icon = icon ? icons[icon] : variant === "status" ? toneIcons[tone] : undefined;
const hasIconSlot = Astro.slots.has("icon");
const text = {
default: "text-muted-foreground",
info: "text-brand",
success: "text-success",
warning: "text-warning",
destructive: "text-destructive",
};
const pills = {
default: "border-frame bg-muted text-foreground",
info: "border-frame-brand bg-brand/14 text-brand",
success: "border-frame-success bg-success/14 text-success",
warning: "border-frame-warning bg-warning/14 text-warning",
destructive: "border-frame-destructive bg-destructive/14 text-destructive",
};
const linkClass =
"rounded-sm underline decoration-muted-foreground underline-offset-4 hover:decoration-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring";
---
{
variant === "divider" ? (
<div class={cn("flex w-full items-center gap-3 text-xs/4 font-medium", text[tone], className)} {...rest}>
<span class="h-px flex-1 bg-border" aria-hidden="true" />
<span class="inline-flex min-w-0 items-center gap-1.5">
{hasIconSlot ? <slot name="icon" /> : Icon && <Icon aria-hidden="true" class="size-3.5 shrink-0" />}
{href ? <a href={href} class={linkClass}>{label}</a> : <span>{label}</span>}
{time && <time datetime={time} class="font-normal text-muted-foreground tabular-nums">{timeLabel ?? time}</time>}
</span>
<span class="h-px flex-1 bg-border" aria-hidden="true" />
</div>
) : variant === "status" ? (
<div class={cn("flex w-full justify-center", className)} {...rest}>
<p class={cn("inline-flex max-w-full items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs/4 font-medium", pills[tone])}>
{hasIconSlot ? <slot name="icon" /> : Icon && <Icon aria-hidden="true" class="size-3.5 shrink-0" />}
{href ? <a href={href} class={cn("min-w-0 wrap-anywhere", linkClass)}>{label}</a> : <span class="min-w-0 wrap-anywhere">{label}</span>}
{time && <time datetime={time} class="font-normal tabular-nums opacity-84">{timeLabel ?? time}</time>}
</p>
</div>
) : (
<p class={cn("flex w-full items-start gap-1.5 text-xs/4", align === "center" ? "justify-center text-center" : "justify-start", text[tone], className)} {...rest}>
{hasIconSlot ? <slot name="icon" /> : Icon && <Icon aria-hidden="true" class="mt-px size-3.5 shrink-0" />}
<span class="min-w-0 wrap-anywhere">
{href ? <a href={href} class={linkClass}>{label}</a> : label}
{time && <time datetime={time} class="ml-1.5 tabular-nums">{timeLabel ?? time}</time>}
</span>
</p>
)
}When to use
- A chat needs system lines such as someone joining or the agent pausing
- A thread should split by day or mark where unread messages begin, with an optional link
- An AI run shows its state between messages: paused, waiting for approval, failed
When not to use
- You only need a plain labeled line with no icon, time or link. Use separator.
- The entries are a dated history of events on their own. Use timeline.
Installation
Add the Haze registry to components.json once, then install Marker with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.
pnpm dlx shadcn@latest add @haze/markernpx shadcn@latest add @haze/markeryarn dlx shadcn@latest add @haze/markerbunx --bun shadcn@latest add @haze/markerFirst time? Registry and theme setup
1. Add to components.json:
{
"registries": {
"@haze": "http://localhost:4329/r/{name}.json"
}
}2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "note" | "divider" | "status" | "note" | Note is quiet text, divider has rules either side, status is a tinted pill. |
| label | string | "Ana Ilić joined the channel" | The text of the marker. |
| icon | "join" | "leave" | "info" | "clock" | "pause" | "check" | "alert" | "error" | "bot" | "calendar" | "unread" | – | Named icon from a fixed set. Status falls back to the icon of its tone. |
| tone | "default" | "info" | "success" | "warning" | "destructive" | "default" | Colors the icon and text, or the tint of a status pill. |
| time | string | – | ISO date-time for the time element. Pass a fixed value, never the current time. |
| timeLabel | string | – | Time as it reads, such as "09:12". |
| href | string | – | Turns the label into a link, for example to the first unread message. |
| align | "center" | "start" | "center" | Note only: where the line sits. |
| class | string | – | Extra classes on the root. |
| ...rest | HTML attributes | – | Passed to the root element; add role="status" for a marker inserted after load. |
| icon slot | slot | – | Replaces the named icon with your own SVG. |
Keyboard interactions
- Tab
- Move to the label when it is a link.
Accessibility
- A divider is a plain row: its label and time stay normal text in the reading order (browse mode reads them, unlike a separator whose name is often skipped), and only the two rule lines are hidden from assistive technology. With a link the label is a reachable link.
- Notes and status pills are ordinary text in the reading order. Add role="status" through the rest attributes on a marker inserted after load.
- Tone never carries meaning alone: the label says what happened, and every status shows an icon.
- Icons are decorative and hidden from assistive technology.
Notes for AI
Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.
Install and use
Install the Haze UI component "Marker" with `npx shadcn@latest add @haze/marker`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import Marker from "@/components/haze/ui/marker.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/marker.md
Customize with real content
Adapt the Haze marker ui for our product. Replace the demo values of these props with our real content: variant, label, icon, tone, time, timeLabel, href, align, class, ...rest, icon slot. Keep the layout, the heading level rules and these accessibility details: A divider is a plain row: its label and time stay normal text in the reading order (browse mode reads them, unlike a separator whose name is often skipped), and only the two rule lines are hidden from assistive technology. With a link the label is a reachable link. Notes and status pills are ordinary text in the reading order. Add role="status" through the rest attributes on a marker inserted after load. Tone never carries meaning alone: the label says what happened, and every status shows an icon. Icons are decorative and hidden from assistive technology. Do not add raw color classes; use the Haze tokens.
Choose the right block
Before using marker, check it fits: use it when a chat needs system lines such as someone joining or the agent pausing; a thread should split by day or mark where unread messages begin, with an optional link; an ai run shows its state between messages: paused, waiting for approval, failed. Avoid it when you only need a plain labeled line with no icon, time or link. use separator.; the entries are a dated history of events on their own. use timeline.. Alternatives: @haze/separator, @haze/timeline, @haze/message.
Dependencies
- npm: @lucide/astro
- @haze/utils
- @haze/theme (one-time setup)
Source · Original Haze UI work.