组件

Marker

The pencil line between two days of a conversation, the red one where you stopped reading, and the quiet note that someone joined. A separator, a border or a plain line of small print.

安装

terminal
npx shadcn@latest add @wobko/marker

第一次使用?先把 registry 加进 components.json。 如何安装

示例

Day separators

A ruled pencil line on each side of the day, written in the script font. The lines run level and stop just short of the words.

Where you stopped reading

tone="new" pulls the lines in red pencil and lays a highlighter swipe under the words, with a red asterisk in the margin. As a button it jumps to the first unread message.

Borders and events

A border marker heads a section with one line under it (pencil or a red wavy one). The default variant is small print with an icon: someone joined, a call started.

In a conversation

shadcn's `marker-demo`: a note with an icon, a running status with a spinner (`role="status"`, pulsing), a labeled separator and another note. The original's `shimmer` utility is not shipped, so the pulse here is Tailwind's `motion-safe:animate-pulse`.

Variants

shadcn's `marker-variants`: `default` is a line of small print, `separator` writes its words between two pencil lines, `border` draws one line under the row.

Status

shadcn's `marker-status`: `role="status"` makes a marker a live region, so a screen reader hears "Compacting conversation" when it appears. A Spinner in MarkerIcon shows that something is running.

Shimmer

shadcn's `marker-shimmer`: a status line that breathes while it is streaming. shadcn ships a `shimmer` utility for this; Wobko does not have one yet, so the example uses `motion-safe:animate-pulse`, which stops for readers who ask for less motion.

Separator

shadcn's `marker-separator`: a labeled divider for a date or a turn of the conversation. The words are ordinary content (no `role="separator"`), so they are read out.

Border

shadcn's `marker-border`: a row with an icon that keeps the default alignment and closes with a line under it, to set it off from the row below.

With icon

shadcn's `marker-icon`: MarkerIcon in front of the words in a plain marker, in a separator (the icon sits in the middle with the lines on both sides), and stacked above the words with `flex-col`. `book-open-check` is not drawn yet, so the last one uses `book-open`.

Links and buttons

shadcn's `marker-link-button`: `asChild` makes the marker a real `<a>` or `<button>`, so it is focusable and announced as one. The button here says so with a toast. `rotate-ccw` is not drawn yet; the revert button wears `undo-2`.

API 参考

Marker

A flex row. `separator` pulls a pencil line on each side of the words; `border` pulls one under them; `default` is small print. The lines are aria-hidden drawings, so they never affect layout or the reading order.

属性类型默认值说明
variant"default" | "separator" | "border""default"Where the line goes.
tone"default" | "new""default"`new` pulls the lines in red pencil, sets the words bold on a highlighter swipe and reddens a MarkerIcon: the unread marker.
rule"line" | "wavy""line"How a `border` marker's line is drawn.
asChildbooleanfalseRender your own element (a button that jumps to the first unread message, say).
seedstring | number-Pins the hand of the lines.

无障碍

  • Markers are plain divs (as upstream). Inside a `role="log"` transcript a separator is announced as its words: 'Today', 'New messages'.
  • Nothing is conveyed by the drawing alone: the unread state is the words, and color is backed by the asterisk and the highlighter swipe.
  • Use `asChild` with a `button` to make 'New messages' a control; the drawn focus ring is the button's own.
  • Difference from upstream: `markerVariants` gives the layout only. The lines of `separator` and `border` are drawn parts of `Marker` (a pseudo-element cannot hold a drawing), so applying the variants to your own element draws no line.
  • Ink lines are 3:1 or more against paper; the words are muted text at 8.9:1 (ink on the highlighter swipe 12:1).

源码

CLI 会复制进你项目的文件。

正在加载源码