Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(quill): add ThreadItem chat primitives and subtle-foreground token (#67680)

Adam Leith2ce699e91cbd
diff --git a/packages/quill/apps/storybook/stories/colors.stories.tsx b/packages/quill/apps/storybook/stories/colors.stories.tsx
index 071a8f5aac6e..d72930a050e7 100644
--- a/packages/quill/apps/storybook/stories/colors.stories.tsx
+++ b/packages/quill/apps/storybook/stories/colors.stories.tsx
@@ -138,8 +138,14 @@ export const AllColors: Story = {
tailwindClass: 'text-muted-foreground',
value: semanticColors['muted-foreground'][0],
},
+ {
+ className: 'text-subtle-foreground',
+ name: 'subtle-foreground',
+ tailwindClass: 'text-subtle-foreground',
+ value: semanticColors['subtle-foreground'][0],
+ },
]}
- usages={['Muted background of the app']}
+ usages={['Muted background of the app', 'Subtle: tertiary meta text, one step below muted']}
/>
<ColorSwatch
diff --git a/packages/quill/packages/primitives/AGENTS.md b/packages/quill/packages/primitives/AGENTS.md
index 5b36af57cb9e..41f540ed0544 100644
--- a/packages/quill/packages/primitives/AGENTS.md
+++ b/packages/quill/packages/primitives/AGENTS.md
@@ -142,7 +142,7 @@ Don't hand-roll `<p className="text-xs text-muted-foreground">` when `<Text size
| SkeletonText | — | — | lines, minWidth, maxWidth |
| Progress | — | — | value: 0-100 |
| Slider | — | — | value, min, max |
-| Avatar | — | default, sm, xs | Compose `Avatar > AvatarImage + AvatarFallback`; image errors fall back to initials/icon |
+| Avatar | — | lg, default, sm, xs | Compose `Avatar > AvatarImage + AvatarFallback`; image errors fall back to initials/icon |
| AvatarGroup | — | default, sm, xs | Row of Avatars; `stacked` overlaps + spreads on hover (no reflow), `reverse` spreads left; `size` forwards to children |
---
@@ -683,7 +683,7 @@ Item sizes: default, sm, xs
### Avatar
-Compose `Avatar > AvatarImage + AvatarFallback`. The fallback (initials or a bare lucide icon — don't `size-*` it) shows when there's no image or the image errors. `size="xs"` (1.25rem), `"sm"` (1.5rem), or default (2rem).
+Compose `Avatar > AvatarImage + AvatarFallback`. The fallback (initials or a bare lucide icon — don't `size-*` it) shows when there's no image or the image errors. `size="xs"` (1.25rem), `"sm"` (1.5rem), default (2rem), or `"lg"` (2.35rem). For a clickable profile avatar, pass `render={<a href="…" />}` (or `<button />`) — the avatar renders as that element and gains pointer + focus ring; the `AvatarImage` `alt` becomes the link's accessible name, so keep it meaningful.
```tsx
<Avatar>
@@ -705,6 +705,63 @@ Compose `Avatar > AvatarImage + AvatarFallback`. The fallback (initials or a bar
</AvatarGroup>
```
+### Thread item (chat feed row)
+
+A feed-style message row — Slack-like channel surfaces where every message aligns start. Use `ChatBubble`/`ChatMessage` for conversational back-and-forth instead. The row highlights on hover/focus-within and reveals `ThreadItemActions` (a `role="toolbar"`, hidden with opacity so its buttons stay tabbable). The toolbar is a Base UI Toolbar — one tab stop, arrow keys rove between actions. Fill it with `ThreadItemAction` — a Button wrapped in a Tooltip where `label` is both the `aria-label` and the tooltip content (one source of truth); it forwards all Button props including `render` (`render={<a href="…" />}` for a link action) and forwards its ref, so it also works as a render target (`DropdownMenuTrigger render={<ThreadItemAction …/>}`). `ThreadItemActions` carries its own `TooltipProvider`, so the tooltips work without app-root setup; a `ThreadItemAction` used outside the toolbar (e.g. an add-reaction button in `ThreadItemReactions`) needs a `TooltipProvider` ancestor. Don't hand-roll `Tooltip > Button` pairs inside the toolbar. `ThreadItemReaction` is a Base UI Toggle (`pressed`/`onPressedChange`); give it an `aria-label` with the emoji name + count and wrap the glyph in `ThreadItemReactionEmoji` (aria-hidden). `ThreadItemAuthor` and `ThreadItemReplies` accept `render` (author as profile link/button via `render={<a href="…" />}` — it keeps the foreground name color with underline on hover, never link-tinted; replies as link); `ThreadItemReplies` is a Button (variant `default`) stretched to the content column. On continuation rows (same author), drop the header and put a `ThreadItemTimestamp` in the gutter — it shows only while the row is hovered/focused — and start the body with an `sr-only` author span so screen readers still hear who is speaking.
+
+`ThreadItemHeader` is an open flex row — put author meta (a `Badge`, a bot tag) between the author and timestamp. Inside `ThreadItemBody`, use `ThreadItemMention` for @mentions (a tinted pill; `render={<button />}` to open a profile) and `ThreadItemLink` for inline links. For image/file previews, use `ThreadItemAttachment` (a Base UI Collapsible, open by default) > `ThreadItemAttachmentTrigger` (the filename + rotating chevron, `aria-expanded` built in) + `ThreadItemAttachmentContent` > `ThreadItemAttachmentImage` (framed `img` — `alt` is required by the type).
+
+```tsx
+<ThreadItemBody>
+ <ThreadItemMention render={<button type="button" />}>@Adam L</ThreadItemMention> why this checkbox? See{' '}
+ <ThreadItemLink href="/docs">the docs</ThreadItemLink>.
+</ThreadItemBody>
+<ThreadItemAttachment>
+ <ThreadItemAttachmentTrigger>image.png</ThreadItemAttachmentTrigger>
+ <ThreadItemAttachmentContent>
+ <ThreadItemAttachmentImage src={url} alt="Screenshot of the setting" />
+ </ThreadItemAttachmentContent>
+</ThreadItemAttachment>
+```
+
+```tsx
+<ThreadItemGroup>
+ <ThreadItem>
+ <ThreadItemGutter>
+ <Avatar>…</Avatar>
+ </ThreadItemGutter>
+ <ThreadItemContent>
+ <ThreadItemHeader>
+ <ThreadItemAuthor>Adam L</ThreadItemAuthor>
+ <ThreadItemTimestamp dateTime="2026-07-01T16:23:00">4:23 PM</ThreadItemTimestamp>
+ </ThreadItemHeader>
+ <ThreadItemBody>Message text…</ThreadItemBody>
+ <ThreadItemReactions>
+ <ThreadItemReaction pressed={pressed} onPressedChange={setPressed} aria-label="Victory hand, 1 reaction">
+ <ThreadItemReactionEmoji>✌️</ThreadItemReactionEmoji>1
+ </ThreadItemReaction>
+ <ThreadItemAction label="Add reaction" className="rounded-full">
+ <SmilePlusIcon />
+ </ThreadItemAction>
+ </ThreadItemReactions>
+ <ThreadItemReplies onClick={openThread}>
+ <AvatarGroup size="xs">…</AvatarGroup>
+ <ThreadItemRepliesLabel>1 reply</ThreadItemRepliesLabel>
+ <ThreadItemRepliesMeta>Today at 4:40 PM</ThreadItemRepliesMeta>
+ </ThreadItemReplies>
+ </ThreadItemContent>
+ <ThreadItemActions>
+ <ThreadItemAction label="Add reaction">
+ <SmilePlusIcon />
+ </ThreadItemAction>
+ <ThreadItemAction label="More actions">
+ <EllipsisVerticalIcon />
+ </ThreadItemAction>
+ </ThreadItemActions>
+ </ThreadItem>
+</ThreadItemGroup>
+```
+
### Keyboard Shortcuts
```tsx
diff --git a/packages/quill/packages/primitives/src/autocomplete.stories.tsx b/packages/quill/packages/primitives/src/autocomplete.stories.tsx
index 57402edaa8bc..ca7e776bb10c 100644
--- a/packages/quill/packages/primitives/src/autocomplete.stories.tsx
+++ b/packages/quill/packages/primitives/src/autocomplete.stories.tsx
@@ -258,7 +258,7 @@ export const CommandPalette: Story = {
>
{cmd.icon}
{cmd.label}
- <span className="font-mono ml-auto text-xs text-muted-foreground/80">
+ <span className="font-mono ml-auto text-xs text-subtle-foreground">
2 days ago
</span>
@@ -348,7 +348,7 @@ export const CommandPaletteCustomEmpty: Story = {
>
{cmd.icon}
{cmd.label}
- <span className="font-mono ml-auto text-xs text-muted-foreground/80">
+ <span className="font-mono ml-auto text-xs text-subtle-foreground">
2 days ago
</span>
diff --git a/packages/quill/packages/primitives/src/avatar.css b/packages/quill/packages/primitives/src/avatar.css
index 48cc1f224e4d..14bf1a436fbe 100644
--- a/packages/quill/packages/primitives/src/avatar.css
+++ b/packages/quill/packages/primitives/src/avatar.css
@@ -20,7 +20,25 @@
color: var(--muted-foreground);
user-select: none;
background-color: var(--muted);
- border-radius: 9999px;
+ border-radius: var(--radius-sm);
+ }
+
+ /* Avatar as a profile trigger (render={<a />} / <button />): pointer + focus ring. */
+ a.quill-avatar,
+ button.quill-avatar {
+ cursor: pointer;
+ }
+
+ a.quill-avatar:focus-visible,
+ button.quill-avatar:focus-visible {
+ outline: none;
+ box-shadow: 0 0 0 2px color-mix(in oklab, var(--ring) 30%, transparent);
+ }
+
+ .quill-avatar[data-size='xs'] {
+ --avatar-size: 1.25rem;
+
+ font-size: var(--text-xxs, 0.625rem);
}
.quill-avatar[data-size='sm'] {
@@ -29,8 +47,8 @@
font-size: var(--text-xxs, 0.625rem);
}
- .quill-avatar[data-size='xs'] {
- --avatar-size: 1.25rem;
+ .quill-avatar[data-size='lg'] {
+ --avatar-size: 2.35rem;
font-size: var(--text-xxs, 0.625rem);
}
@@ -66,7 +84,7 @@
--avatar-overlap: 0.625rem;
/* Gap between avatars when inline, and the gap the stack spreads back to. */
- --avatar-gap: 0.5rem;
+ --avatar-gap: 0.25rem;
position: relative;
display: inline-flex;
diff --git a/packages/quill/packages/primitives/src/avatar.stories.tsx b/packages/quill/packages/primitives/src/avatar.stories.tsx
index 57ddf31b9f2d..1221d219860f 100644
--- a/packages/quill/packages/primitives/src/avatar.stories.tsx
+++ b/packages/quill/packages/primitives/src/avatar.stories.tsx
@@ -49,6 +49,10 @@ export const Sizes: Story = {
<AvatarImage src={FACES[1]} alt="Grace Hopper" />
<AvatarFallback>GH</AvatarFallback>
</Avatar>
+ <Avatar size="lg">
+ <AvatarImage src={FACES[1]} alt="Grace Hopper" />
+ <AvatarFallback>GH</AvatarFallback>
+ </Avatar>
</div>
),
} satisfies Story
diff --git a/packages/quill/packages/primitives/src/avatar.tsx b/packages/quill/packages/primitives/src/avatar.tsx
index 1d04d0928c1e..555f2ab7f4ff 100644
--- a/packages/quill/packages/primitives/src/avatar.tsx
+++ b/packages/quill/packages/primitives/src/avatar.tsx
@@ -5,7 +5,7 @@ import * as React from 'react'
import { cn } from './lib/utils'
-type AvatarSize = 'default' | 'sm' | 'xs'
+type AvatarSize = 'lg' | 'default' | 'sm' | 'xs'
const Avatar = React.forwardRef<
HTMLSpanElement,
diff --git a/packages/quill/packages/primitives/src/chat/thread-item.css b/packages/quill/packages/primitives/src/chat/thread-item.css
new file mode 100644
index 000000000000..35a0e0803a53
--- /dev/null
+++ b/packages/quill/packages/primitives/src/chat/thread-item.css
@@ -0,0 +1,319 @@
+@layer components {
+ /*
+ * Feed-style message row. The row highlights on hover/focus-within and reveals the actions
+ * toolbar; a timestamp placed in the gutter (continuation rows) follows the same reveal.
+ */
+ .quill-thread-item-group {
+ display: flex;
+ flex-direction: column;
+ min-width: 0;
+ }
+
+ .quill-thread-item {
+ position: relative;
+ display: flex;
+ gap: 0.5rem;
+ width: 100%;
+ min-width: 0;
+ padding-block: 0.375rem;
+ padding-inline: 0.5rem;
+ border-radius: 0.5rem;
+ }
+
+ .quill-thread-item:hover,
+ .quill-thread-item:focus-within {
+ background-color: var(--fill-hover);
+ }
+
+ .quill-thread-item__gutter {
+ display: flex;
+ flex-shrink: 0;
+ justify-content: flex-end;
+ width: 2.5rem;
+ padding-block-start: 0.125rem;
+ }
+
+ /* Continuation rows: a timestamp in the gutter only shows while the row is hovered/focused. */
+ .quill-thread-item__gutter > [data-slot='thread-item-timestamp'] {
+ opacity: 0;
+ transition: opacity 100ms ease-out;
+ }
+
+ .quill-thread-item:hover .quill-thread-item__gutter > [data-slot='thread-item-timestamp'],
+ .quill-thread-item:focus-within .quill-thread-item__gutter > [data-slot='thread-item-timestamp'] {
+ opacity: 1;
+ }
+
+ .quill-thread-item__content {
+ display: flex;
+ flex: 1;
+ flex-direction: column;
+ gap: 0;
+ min-width: 0;
+ overflow-wrap: break-word;
+ }
+
+ .quill-thread-item__header {
+ display: flex;
+ gap: 0.375rem;
+ align-items: baseline;
+ min-width: 0;
+ }
+
+ .quill-thread-item__author {
+ font-size: var(--text-sm, 0.875rem);
+ font-weight: 600;
+ color: var(--foreground);
+ }
+
+ /*
+ * Author as a profile trigger (render={<button />} / <a />): pointer + hover underline, but it
+ * keeps the name's foreground color and rests without an underline — it's a person, not a
+ * body-copy link, so app-level anchor styling must not tint it.
+ */
+ button.quill-thread-item__author,
+ a.quill-thread-item__author {
+ color: var(--foreground);
+ text-decoration: none;
+ text-underline-offset: 4px;
+ cursor: pointer;
+ }
+
+ button.quill-thread-item__author:hover,
+ a.quill-thread-item__author:hover {
+ text-decoration: underline;
+ }
+
+ .quill-thread-item__timestamp {
+ font-size: var(--text-xs, 0.75rem);
+ color: var(--muted-foreground);
+ white-space: nowrap;
+ }
+
+ .quill-thread-item__body {
+ min-width: 0;
+ font-size: var(--text-sm, 0.875rem);
+ line-height: 1.5;
+ color: var(--foreground);
+ overflow-wrap: break-word;
+ }
+
+ .quill-thread-item__mention {
+ padding-inline: 0.25rem;
+ font-weight: 500;
+ color: var(--primary);
+ background-color: color-mix(in oklab, var(--primary) 10%, transparent);
+ border-radius: 0.25rem;
+ }
+
+ /* Mention as a profile trigger (render={<button />} / <a />). */
+ button.quill-thread-item__mention,
+ a.quill-thread-item__mention {
+ cursor: pointer;
+ }
+
+ button.quill-thread-item__mention:hover,
+ a.quill-thread-item__mention:hover {
+ background-color: color-mix(in oklab, var(--primary) 18%, transparent);
+ }
+
+ button.quill-thread-item__mention:focus-visible,
+ a.quill-thread-item__mention:focus-visible {
+ outline: none;
+ box-shadow: 0 0 0 2px color-mix(in oklab, var(--ring) 30%, transparent);
+ }
+
+ .quill-thread-item__link {
+ color: var(--primary);
+ text-underline-offset: 4px;
+ cursor: pointer;
+ }
+
+ .quill-thread-item__link:hover {
+ text-decoration: underline;
+ }
+
+ /* Attachment — collapsible filename row + framed preview. */
+ .quill-thread-item__attachment {
+ display: flex;
+ flex-direction: column;
+ gap: 0.25rem;
+ align-items: flex-start;
+ min-width: 0;
+ padding-block-start: 0.125rem;
+ }
+
+ .quill-thread-item__attachment-trigger {
+ display: inline-flex;
+ gap: 0.25rem;
+ align-items: center;
+ padding: 0;
+ font-size: var(--text-xs, 0.75rem);
+ color: var(--subtle-foreground, var(--muted-foreground));
+ cursor: pointer;
+ background: none;
+ border: none;
+ border-radius: 0.25rem;
+ }
+
+ .quill-thread-item__attachment-trigger:hover {
+ color: var(--foreground);
+ }
+
+ .quill-thread-item__attachment-trigger:focus-visible {
+ outline: none;
+ box-shadow: 0 0 0 2px color-mix(in oklab, var(--ring) 30%, transparent);
+ }
+
+ .quill-thread-item__attachment-trigger svg[data-chevron] {
+ width: 0.875rem;
+ height: 0.875rem;
+
+ /* Optical nudge: centers the chevron against the filename's x-height. */
+ margin-block-start: 0.125rem;
+ transition: rotate 150ms ease;
+ }
+
+ /* Closed: chevron points into reading direction (mirrored in RTL); open: down. */
+ .quill-thread-item__attachment-trigger:not([data-panel-open]) svg[data-chevron] {
+ rotate: -90deg;
+ }
+
+ [dir='rtl'] .quill-thread-item__attachment-trigger:not([data-panel-open]) svg[data-chevron] {
+ rotate: 90deg;
+ }
+
+ .quill-thread-item__attachment-panel {
+ min-width: 0;
+ max-width: 100%;
+ height: var(--collapsible-panel-height);
+ overflow: hidden;
+ transition: height 200ms ease-out;
+ }
+
+ .quill-thread-item__attachment-panel[data-starting-style],
+ .quill-thread-item__attachment-panel[data-ending-style] {
+ height: 0;
+ }
+
+ .quill-thread-item__attachment-panel-content {
+ min-width: 0;
+ padding-block: 0.125rem;
+ }
+
+ .quill-thread-item__attachment-image {
+ display: block;
+ max-width: 100%;
+ max-height: 22.5rem;
+ border: 1px solid var(--border);
+ border-radius: 0.5rem;
+ }
+
+ .quill-thread-item__reactions {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.25rem;
+ align-items: center;
+ padding-block-start: 0.125rem;
+ }
+
+ .quill-thread-item__reaction {
+ display: inline-flex;
+ gap: 0.25rem;
+ align-items: center;
+ height: 1.5rem;
+ padding-inline: 0.5rem;
+ font-size: var(--text-xs, 0.75rem);
+ font-weight: 500;
+ color: var(--foreground);
+ cursor: pointer;
+ background-color: var(--muted);
+ border: 1px solid transparent;
+ border-radius: 9999px;
+ }
+
+ .quill-thread-item__reaction:hover {
+ background-color: var(--background);
+ border-color: var(--border);
+ }
+
+ .quill-thread-item__reaction[data-pressed] {
+ color: var(--primary);
+ background-color: color-mix(in oklab, var(--primary) 10%, transparent);
+ border-color: color-mix(in oklab, var(--primary) 40%, transparent);
+ }
+
+ .quill-thread-item__reaction:disabled,
+ .quill-thread-item__reaction[aria-disabled='true'] {
+ pointer-events: none;
+ opacity: 0.5;
+ }
+
+ .quill-thread-item__reaction:focus-visible {
+ border-color: var(--ring);
+ outline: none;
+ box-shadow: 0 0 0 2px color-mix(in oklab, var(--ring) 30%, transparent);
+ }
+
+ .quill-thread-item__reaction-emoji {
+ font-size: 0.875rem;
+ line-height: 1;
+ }
+
+ /*
+ * Actions toolbar — floats over the row's top end corner. Hidden with opacity + pointer-events
+ * (never display: none) so buttons stay in the tab order; :focus-within reveals it for keyboard.
+ */
+ .quill-thread-item__actions {
+ position: absolute;
+ inset-block-start: -0.75rem;
+ inset-inline-end: 0.5rem;
+ z-index: 10;
+ display: flex;
+ gap: 0.125rem;
+ align-items: center;
+ padding: 0.125rem;
+ pointer-events: none;
+ background-color: var(--background);
+ border: 1px solid var(--border);
+ border-radius: 0.5rem;
+ box-shadow: var(--shadow-sm);
+ opacity: 0;
+ transition: opacity 100ms ease-out;
+ }
+
+ .quill-thread-item:hover .quill-thread-item__actions,
+ .quill-thread-item:focus-within .quill-thread-item__actions {
+ pointer-events: auto;
+ opacity: 1;
+ }
+
+ /*
+ * Reply summary — a Button (variant default), so rest/hover/focus chrome is Button's.
+ * Only the row shape is ours: stretch to the content column so the hover target matches
+ * Slack-style thread bars. Optical alignment: tighten Button's inline padding and pull the
+ * hover box outward by the same amount, so the label sits flush with the body text while the
+ * fill still wraps it. Doubled class outranks Button's size padding regardless of which CSS
+ * file the bundler emits first.
+ */
+ .quill-thread-item__replies.quill-thread-item__replies {
+ gap: 0.375rem;
+ align-self: stretch;
+ min-width: 0;
+ padding-inline: 0.25rem;
+ margin-inline: -0.25rem -0.125rem;
+ }
+
+ .quill-thread-item__replies-label {
+ font-weight: 500;
+ color: var(--primary);
+ white-space: nowrap;
+ }
+
+ .quill-thread-item__replies-meta {
+ overflow: hidden;
+ color: var(--subtle-foreground, var(--muted-foreground));
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+}
diff --git a/packages/quill/packages/primitives/src/chat/thread-item.stories.tsx b/packages/quill/packages/primitives/src/chat/thread-item.stories.tsx
new file mode 100644
index 000000000000..0c017330ff84
--- /dev/null
+++ b/packages/quill/packages/primitives/src/chat/thread-item.stories.tsx
@@ -0,0 +1,395 @@
+import type { Meta, StoryObj } from '@storybook/react'
+import {
+ BookmarkIcon,
+ EllipsisVerticalIcon,
+ ExternalLinkIcon,
+ ForwardIcon,
+ MessageSquareTextIcon,
+ SmilePlusIcon,
+} from 'lucide-react'
+import * as React from 'react'
+
+import { Avatar, AvatarFallback, AvatarGroup, AvatarImage } from '../avatar'
+import { Badge } from '../badge'
+import { TooltipProvider } from '../tooltip'
+import {
+ ThreadItem,
+ ThreadItemAction,
+ ThreadItemActions,
+ ThreadItemAttachment,
+ ThreadItemAttachmentContent,
+ ThreadItemAttachmentImage,
+ ThreadItemAttachmentTrigger,
+ ThreadItemAuthor,
+ ThreadItemBody,
+ ThreadItemContent,
+ ThreadItemGroup,
+ ThreadItemGutter,
+ ThreadItemHeader,
+ ThreadItemLink,
+ ThreadItemMention,
+ ThreadItemReaction,
+ ThreadItemReactionEmoji,
+ ThreadItemReactions,
+ ThreadItemReplies,
+ ThreadItemRepliesLabel,
+ ThreadItemRepliesMeta,
+ ThreadItemTimestamp,
+} from './thread-item'
+
+const meta = {
+ title: 'Primitives/Chat/ThreadItem',
+ component: ThreadItem,
+ tags: ['autodocs'],
+ // ThreadItemActions ships its own TooltipProvider; this root one covers ThreadItemAction
+ // used elsewhere (the add-reaction button in the reactions row).
+ decorators: [
+ (Story): React.ReactElement => (
+ <TooltipProvider>
+ <Story />
+ </TooltipProvider>
+ ),
+ ],
+} satisfies Meta<typeof ThreadItem>
+
+export default meta
+type Story = StoryObj<typeof meta>
+
+const MEMBERS = [
+ { src: 'https://i.pravatar.cc/96?img=12', name: 'Adam L', initials: 'AL' },
+ { src: 'https://i.pravatar.cc/96?img=32', name: 'Grace Hopper', initials: 'GH' },
+ { src: 'https://i.pravatar.cc/96?img=45', name: 'Alan Turing', initials: 'AT' },
+]
+
+function MemberAvatar({ index, href }: { index: number; href?: string }): React.ReactElement {
+ const member = MEMBERS[index]
+ return (
+ <Avatar
+ size="lg"
+ render={
+ href != null ? (
+ // eslint-disable-next-line react/forbid-elements
+ <a href={href} />
+ ) : undefined
+ }
+ >
+ <AvatarImage src={member.src} alt={member.name} />
+ <AvatarFallback>{member.initials}</AvatarFallback>
+ </Avatar>
+ )
+}
+
+/** Minimal anatomy: gutter avatar, author + timestamp header, body. */
+export const Basic = {
+ render: () => (
+ <div className="w-[480px]">
+ <ThreadItem>
+ <ThreadItemGutter>
+ <MemberAvatar index={0} />
+ </ThreadItemGutter>
+ <ThreadItemContent>
+ <ThreadItemHeader>
+ <ThreadItemAuthor>Adam L</ThreadItemAuthor>
+ <ThreadItemTimestamp dateTime="2026-07-01T16:23:00">4:23 PM</ThreadItemTimestamp>
+ </ThreadItemHeader>
+ <ThreadItemBody>Deploy is out — watching the dashboards for the next hour.</ThreadItemBody>
+ </ThreadItemContent>
+ </ThreadItem>
+ </div>
+ ),
+} satisfies Story
+
+/** The full anatomy: reactions, reply summary, and the hover/focus-revealed actions toolbar. */
+export const Complete = {
+ render: function CompleteStory(): React.ReactElement {
+ const [reactions, setReactions] = React.useState({ victory: true, facepalm: false })
+ return (
+ <div className="w-[520px] py-4">
+ <ThreadItem>
+ <ThreadItemGutter>
+ <MemberAvatar index={0} />
+ </ThreadItemGutter>
+ <ThreadItemContent>
+ <ThreadItemHeader>
+ <ThreadItemAuthor render={<button type="button" />}>Adam L</ThreadItemAuthor>
+ <ThreadItemTimestamp dateTime="2026-07-01T16:23:00">4:23 PM</ThreadItemTimestamp>
+ </ThreadItemHeader>
+ <ThreadItemBody>
+ PHEW: flight is actually at 7:15pm, I was correct originally. For some reason unbeknownst to
+ me, my wallet boarding pass says 5:50pm. Good to hang out with yall! Excited to build this.
+ Byeeeeee
+ </ThreadItemBody>
+ <ThreadItemReactions>
+ <ThreadItemReaction
+ pressed={reactions.victory}
+ onPressedChange={(pressed) => setReactions((r) => ({ ...r, victory: pressed }))}
+ aria-label={`Victory hand, ${reactions.victory ? 1 : 0} reactions`}
+ >
+ <ThreadItemReactionEmoji>✌️</ThreadItemReactionEmoji>
+ {reactions.victory ? 1 : 0}
+ </ThreadItemReaction>
+ <ThreadItemReaction
+ pressed={reactions.facepalm}
+ onPressedChange={(pressed) => setReactions((r) => ({ ...r, facepalm: pressed }))}
+ aria-label={`Facepalm, ${reactions.facepalm ? 2 : 1} reactions`}
+ >
+ <ThreadItemReactionEmoji>🤦‍♀️</ThreadItemReactionEmoji>
+ {reactions.facepalm ? 2 : 1}
+ </ThreadItemReaction>
+ <ThreadItemAction label="Add reaction" className="rounded-full">
+ <SmilePlusIcon />
+ </ThreadItemAction>
+ </ThreadItemReactions>
+ <ThreadItemReplies>
+ <AvatarGroup size="xs">
+ <Avatar>
+ <AvatarImage src={MEMBERS[1].src} alt={MEMBERS[1].name} />
+ <AvatarFallback>{MEMBERS[1].initials}</AvatarFallback>
+ </Avatar>
+ </AvatarGroup>
+ <ThreadItemRepliesLabel>1 reply</ThreadItemRepliesLabel>
+ <ThreadItemRepliesMeta>Today at 4:40 PM</ThreadItemRepliesMeta>
+ </ThreadItemReplies>
+ </ThreadItemContent>
+ <ThreadItemActions>
+ <ThreadItemAction label="Add reaction">
+ <SmilePlusIcon />
+ </ThreadItemAction>
+ <ThreadItemAction label="Reply in thread">
+ <MessageSquareTextIcon />
+ </ThreadItemAction>
+ <ThreadItemAction label="Forward message">
+ <ForwardIcon />
+ </ThreadItemAction>
+ <ThreadItemAction label="Save for later">
+ <BookmarkIcon />
+ </ThreadItemAction>
+ <ThreadItemAction label="More actions">
+ <EllipsisVerticalIcon />
+ </ThreadItemAction>
+ </ThreadItemActions>
+ </ThreadItem>
+ </div>
+ )
+ },
+} satisfies Story
+
+/**
+ * A feed of items. Authors and gutter avatars render as profile links (the avatar image's alt
+ * names the link; authors stay foreground-colored, underline on hover).
+ * Continuation rows (same author) drop the header and avatar; a gutter timestamp appears when the
+ * row is hovered or focused.
+ */
+export const Feed = {
+ render: () => (
+ <div className="w-[520px]">
+ <ThreadItemGroup>
+ <ThreadItem>
+ <ThreadItemGutter>
+ <MemberAvatar index={1} href="#profile-grace" />
+ </ThreadItemGutter>
+ <ThreadItemContent>
+ <ThreadItemHeader>
+ <ThreadItemAuthor
+ render={
+ // eslint-disable-next-line react/forbid-elements
+ <a href="#profile-grace" />
+ }
+ >
+ Grace Hopper
+ </ThreadItemAuthor>
+ <ThreadItemTimestamp dateTime="2026-07-01T16:10:00">4:10 PM</ThreadItemTimestamp>
+ </ThreadItemHeader>
+ <ThreadItemBody>Nanoseconds matter. Shipping the fix now.</ThreadItemBody>
+ </ThreadItemContent>
+ <ThreadItemActions>
+ <ThreadItemAction label="Add reaction">
+ <SmilePlusIcon />
+ </ThreadItemAction>
+ <ThreadItemAction label="More actions">
+ <EllipsisVerticalIcon />
+ </ThreadItemAction>
+ </ThreadItemActions>
+ </ThreadItem>
+
+ <ThreadItem>
+ <ThreadItemGutter>
+ <ThreadItemTimestamp dateTime="2026-07-01T16:11:00">4:11</ThreadItemTimestamp>
+ </ThreadItemGutter>
+ <ThreadItemContent>
+ <ThreadItemBody>
+ {/* Continuation rows hide the visible header — keep the author for screen readers. */}
+ <span className="sr-only">Grace Hopper: </span>
+ …and merged. CI is green.
+ </ThreadItemBody>
+ <ThreadItemReactions>
+ <ThreadItemReaction defaultPressed aria-label="Rocket, 3 reactions">
+ <ThreadItemReactionEmoji>🚀</ThreadItemReactionEmoji>3
+ </ThreadItemReaction>
+ </ThreadItemReactions>
+ </ThreadItemContent>
+ <ThreadItemActions>
+ <ThreadItemAction label="Add reaction">
+ <SmilePlusIcon />
+ </ThreadItemAction>
+ <ThreadItemAction label="More actions">
+ <EllipsisVerticalIcon />
+ </ThreadItemAction>
+ </ThreadItemActions>
+ </ThreadItem>
+
+ <ThreadItem>
+ <ThreadItemGutter>
+ <MemberAvatar index={2} href="#profile-alan" />
+ </ThreadItemGutter>
+ <ThreadItemContent>
+ <ThreadItemHeader>
+ <ThreadItemAuthor
+ render={
+ // eslint-disable-next-line react/forbid-elements
+ <a href="#profile-alan" />
+ }
+ >
+ Alan Turing
+ </ThreadItemAuthor>
+ <ThreadItemTimestamp dateTime="2026-07-01T16:15:00">4:15 PM</ThreadItemTimestamp>
+ </ThreadItemHeader>
+ <ThreadItemBody>Can we compute? Yes. Should we? Also yes.</ThreadItemBody>
+ <ThreadItemReplies>
+ <AvatarGroup size="xs">
+ <Avatar>
+ <AvatarImage src={MEMBERS[0].src} alt={MEMBERS[0].name} />
+ <AvatarFallback>{MEMBERS[0].initials}</AvatarFallback>
+ </Avatar>
+ <Avatar>
+ <AvatarImage src={MEMBERS[1].src} alt={MEMBERS[1].name} />
+ <AvatarFallback>{MEMBERS[1].initials}</AvatarFallback>
+ </Avatar>
+ </AvatarGroup>
+ <ThreadItemRepliesLabel>2 replies</ThreadItemRepliesLabel>
+ <ThreadItemRepliesMeta>Last reply today at 4:40 PM</ThreadItemRepliesMeta>
+ </ThreadItemReplies>
+ </ThreadItemContent>
+ <ThreadItemActions>
+ <ThreadItemAction label="Add reaction">
+ <SmilePlusIcon />
+ </ThreadItemAction>
+ <ThreadItemAction label="More actions">
+ <EllipsisVerticalIcon />
+ </ThreadItemAction>
+ </ThreadItemActions>
+ </ThreadItem>
+ </ThreadItemGroup>
+ </div>
+ ),
+} satisfies Story
+
+/**
+ * Rich content: a badge next to the author (header is an open flex row — drop any meta in),
+ * an @mention and a link in the body, and a collapsible image attachment.
+ */
+export const RichContent = {
+ render: () => (
+ <div className="w-[560px]">
+ <ThreadItem>
+ <ThreadItemGutter>
+ <MemberAvatar index={1} />
+ </ThreadItemGutter>
+ <ThreadItemContent>
+ <ThreadItemHeader>
+ <ThreadItemAuthor render={<button type="button" />}>Raquel Smith</ThreadItemAuthor>
+ <Badge>VIP</Badge>
+ <ThreadItemTimestamp dateTime="2026-07-01T16:56:00">4:56 PM</ThreadItemTimestamp>
+ </ThreadItemHeader>
+ <ThreadItemBody>
+ <ThreadItemMention render={<button type="button" />}>@Adam L</ThreadItemMention> why this
+ checkbox? Context in <ThreadItemLink href="#docs">the scaffold docs</ThreadItemLink>.
+ </ThreadItemBody>
+ <ThreadItemAttachment>
+ <ThreadItemAttachmentTrigger>image.png</ThreadItemAttachmentTrigger>
+ <ThreadItemAttachmentContent>
+ <ThreadItemAttachmentImage
+ src="https://picsum.photos/seed/quill-thread/640/280"
+ alt="Screenshot of the scaffold checkbox setting"
+ width={640}
+ height={280}
+ />
+ </ThreadItemAttachmentContent>
+ </ThreadItemAttachment>
+ <ThreadItemReplies>
+ <AvatarGroup size="xs">
+ <Avatar>
+ <AvatarImage src={MEMBERS[0].src} alt={MEMBERS[0].name} />
+ <AvatarFallback>{MEMBERS[0].initials}</AvatarFallback>
+ </Avatar>
+ <Avatar>
+ <AvatarImage src={MEMBERS[2].src} alt={MEMBERS[2].name} />
+ <AvatarFallback>{MEMBERS[2].initials}</AvatarFallback>
+ </Avatar>
+ </AvatarGroup>
+ <ThreadItemRepliesLabel>3 replies</ThreadItemRepliesLabel>
+ <ThreadItemRepliesMeta>Last reply 1 day ago</ThreadItemRepliesMeta>
+ </ThreadItemReplies>
+ </ThreadItemContent>
+ <ThreadItemActions>
+ <ThreadItemAction label="Add reaction">
+ <SmilePlusIcon />
+ </ThreadItemAction>
+ <ThreadItemAction label="Reply in thread">
+ <MessageSquareTextIcon />
+ </ThreadItemAction>
+ <ThreadItemAction label="Forward message">
+ <ForwardIcon />
+ </ThreadItemAction>
+ <ThreadItemAction label="Save for later">
+ <BookmarkIcon />
+ </ThreadItemAction>
+ <ThreadItemAction
+ label="Open thread in new tab"
+ render={
+ // eslint-disable-next-line react/forbid-elements
+ <a href="#thread" target="_blank" rel="noreferrer" />
+ }
+ >
+ <ExternalLinkIcon />
+ </ThreadItemAction>
+ </ThreadItemActions>
+ </ThreadItem>
+ </div>
+ ),
+} satisfies Story
+
+/** Reply summary rendered as a link instead of a button. */
+export const RepliesAsLink = {
+ render: () => (
+ <div className="w-[480px]">
+ <ThreadItem>
+ <ThreadItemGutter>
+ <MemberAvatar index={0} />
+ </ThreadItemGutter>
+ <ThreadItemContent>
+ <ThreadItemHeader>
+ <ThreadItemAuthor>Adam L</ThreadItemAuthor>
+ <ThreadItemTimestamp dateTime="2026-07-01T16:23:00">4:23 PM</ThreadItemTimestamp>
+ </ThreadItemHeader>
+ <ThreadItemBody>Thread summary can navigate instead of toggling a panel.</ThreadItemBody>
+ <ThreadItemReplies
+ render={
+ // eslint-disable-next-line react/forbid-elements
+ <a href="#thread" />
+ }
+ >
+ <AvatarGroup size="xs">
+ <Avatar>
+ <AvatarImage src={MEMBERS[2].src} alt={MEMBERS[2].name} />
+ <AvatarFallback>{MEMBERS[2].initials}</AvatarFallback>
+ </Avatar>
+ </AvatarGroup>
+ <ThreadItemRepliesLabel>1 reply</ThreadItemRepliesLabel>
+ <ThreadItemRepliesMeta>Today at 4:40 PM</ThreadItemRepliesMeta>
+ </ThreadItemReplies>
+ </ThreadItemContent>
+ </ThreadItem>
+ </div>
+ ),
+} satisfies Story
diff --git a/packages/quill/packages/primitives/src/chat/thread-item.tsx b/packages/quill/packages/primitives/src/chat/thread-item.tsx
new file mode 100644
index 000000000000..6881741eb175
--- /dev/null
+++ b/packages/quill/packages/primitives/src/chat/thread-item.tsx
@@ -0,0 +1,355 @@
+import './thread-item.css'
+
+import { Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible'
+import { mergeProps } from '@base-ui/react/merge-props'
+import { Toggle as TogglePrimitive } from '@base-ui/react/toggle'
+import { Toolbar as ToolbarPrimitive } from '@base-ui/react/toolbar'
+import { useRender } from '@base-ui/react/use-render'
+import { ChevronDownIcon } from 'lucide-react'
+import * as React from 'react'
+
+import { Button, type ButtonProps } from '../button'
+import { cn } from '../lib/utils'
+import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../tooltip'
+
+/**
+ * Thread item primitives — a feed-style message row (avatar gutter, author + timestamp header,
+ * body, reaction pills, reply summary, hover-revealed actions toolbar). Complements the bubble
+ * primitives in {@link ./chat-bubble}: bubbles for conversational back-and-forth, thread items
+ * for channel/feed surfaces where every message aligns start and actions appear on hover.
+ *
+ * Anatomy:
+ * ThreadItemGroup
+ * ThreadItem (article)
+ * ThreadItemGutter > Avatar (or ThreadItemTimestamp on continuation rows — shown on hover)
+ * ThreadItemContent
+ * ThreadItemHeader > ThreadItemAuthor + [Badge/meta] + ThreadItemTimestamp
+ * ThreadItemBody > text + ThreadItemMention + ThreadItemLink
+ * ThreadItemAttachment > ThreadItemAttachmentTrigger + ThreadItemAttachmentContent > ThreadItemAttachmentImage
+ * ThreadItemReactions > ThreadItemReaction > ThreadItemReactionEmoji + count
+ * ThreadItemReplies > AvatarGroup + ThreadItemRepliesLabel + ThreadItemRepliesMeta
+ * ThreadItemActions > ThreadItemAction(...)
+ */
+function ThreadItemGroup({ className, ...props }: React.ComponentProps<'div'>): React.ReactElement {
+ return (
+ <div data-quill data-slot="thread-item-group" className={cn('quill-thread-item-group', className)} {...props} />
+ )
+}
+
+function ThreadItem({ className, ...props }: React.ComponentProps<'article'>): React.ReactElement {
+ return <article data-quill data-slot="thread-item" className={cn('quill-thread-item', className)} {...props} />
+}
+
+function ThreadItemGutter({ className, ...props }: React.ComponentProps<'div'>): React.ReactElement {
+ return <div data-slot="thread-item-gutter" className={cn('quill-thread-item__gutter', className)} {...props} />
+}
+
+function ThreadItemContent({ className, ...props }: React.ComponentProps<'div'>): React.ReactElement {
+ return <div data-slot="thread-item-content" className={cn('quill-thread-item__content', className)} {...props} />
+}
+
+function ThreadItemHeader({ className, ...props }: React.ComponentProps<'div'>): React.ReactElement {
+ return <div data-slot="thread-item-header" className={cn('quill-thread-item__header', className)} {...props} />
+}
+
+/** Author name. Renders a `span` by default; pass `render={<button />}` to make it a profile trigger. */
+function ThreadItemAuthor({ className, render, ...props }: useRender.ComponentProps<'span'>): React.ReactElement {
+ return useRender({
+ defaultTagName: 'span',
+ props: mergeProps<'span'>(
+ {
+ 'data-slot': 'thread-item-author',
+ className: cn('quill-thread-item__author', className),
+ } as Omit<React.ComponentProps<'span'>, 'ref'>,
+ props
+ ),
+ render,
+ state: {
+ slot: 'thread-item-author',
+ },
+ })
+}
+
+/** Semantic `<time>` — pass `dateTime` so assistive tech gets the machine-readable value. */
+function ThreadItemTimestamp({ className, ...props }: React.ComponentProps<'time'>): React.ReactElement {
+ return (
+ <time data-slot="thread-item-timestamp" className={cn('quill-thread-item__timestamp', className)} {...props} />
+ )
+}
+
+function ThreadItemBody({ className, ...props }: React.ComponentProps<'div'>): React.ReactElement {
+ return <div data-slot="thread-item-body" className={cn('quill-thread-item__body', className)} {...props} />
+}
+
+/**
+ * Inline @mention pill inside {@link ThreadItemBody}. Renders a `span` by default; pass
+ * `render={<button type="button" />}` (or `<a />`) when clicking it should open a profile.
+ */
+function ThreadItemMention({ className, render, ...props }: useRender.ComponentProps<'span'>): React.ReactElement {
+ return useRender({
+ defaultTagName: 'span',
+ props: mergeProps<'span'>(
+ {
+ 'data-slot': 'thread-item-mention',
+ className: cn('quill-thread-item__mention', className),
+ } as Omit<React.ComponentProps<'span'>, 'ref'>,
+ props
+ ),
+ render,
+ state: {
+ slot: 'thread-item-mention',
+ },
+ })
+}
+
+/** Inline link inside {@link ThreadItemBody} — primary color, underline on hover. */
+function ThreadItemLink({ className, render, ...props }: useRender.ComponentProps<'a'>): React.ReactElement {
+ return useRender({
+ defaultTagName: 'a',
+ props: mergeProps<'a'>(
+ {
+ 'data-slot': 'thread-item-link',
+ className: cn('quill-thread-item__link', className),
+ } as Omit<React.ComponentProps<'a'>, 'ref'>,
+ props
+ ),
+ render,
+ state: {
+ slot: 'thread-item-link',
+ },
+ })
+}
+
+/**
+ * Collapsible attachment (image/file preview) — a Base UI Collapsible, open by default. The
+ * trigger carries the filename and a rotating chevron; keyboard/AT get `aria-expanded` for free.
+ */
+function ThreadItemAttachment({
+ className,
+ defaultOpen = true,
+ ...props
+}: CollapsiblePrimitive.Root.Props): React.ReactElement {
+ return (
+ <CollapsiblePrimitive.Root
+ data-quill
+ data-slot="thread-item-attachment"
+ defaultOpen={defaultOpen}
+ className={cn('quill-thread-item__attachment', className)}
+ {...props}
+ />
+ )
+}
+
+/** Filename row that toggles the attachment preview. Children become the visible label. */
+function ThreadItemAttachmentTrigger({
+ children,
+ className,
+ ...props
+}: CollapsiblePrimitive.Trigger.Props): React.ReactElement {
+ return (
+ <CollapsiblePrimitive.Trigger
+ data-slot="thread-item-attachment-trigger"
+ className={cn('quill-thread-item__attachment-trigger', className)}
+ {...props}
+ >
+ {children}
+ <ChevronDownIcon data-chevron="down" className="pointer-events-none shrink-0" />
+ </CollapsiblePrimitive.Trigger>
+ )
+}
+
+function ThreadItemAttachmentContent({
+ children,
+ className,
+ ...props
+}: CollapsiblePrimitive.Panel.Props): React.ReactElement {
+ return (
+ <CollapsiblePrimitive.Panel
+ data-slot="thread-item-attachment-content"
+ className="quill-thread-item__attachment-panel"
+ {...props}
+ >
+ <div className={cn('quill-thread-item__attachment-panel-content', className)}>{children}</div>
+ </CollapsiblePrimitive.Panel>
+ )
+}
+
+/** Framed image preview. `alt` is required — describe the image (empty `alt=""` only if purely decorative). */
+function ThreadItemAttachmentImage({
+ className,
+ alt,
+ ...props
+}: React.ComponentProps<'img'> & { alt: string }): React.ReactElement {
+ return (
+ <img
+ alt={alt}
+ data-slot="thread-item-attachment-image"
+ className={cn('quill-thread-item__attachment-image', className)}
+ {...props}
+ />
+ )
+}
+
+function ThreadItemReactions({
+ className,
+ 'aria-label': ariaLabel = 'Reactions',
+ ...props
+}: React.ComponentProps<'div'>): React.ReactElement {
+ return (
+ <div
+ role="group"
+ aria-label={ariaLabel}
+ data-slot="thread-item-reactions"
+ className={cn('quill-thread-item__reactions', className)}
+ {...props}
+ />
+ )
+}
+
+/**
+ * A reaction pill — a Base UI Toggle, so `pressed`/`onPressedChange` and `aria-pressed` come for
+ * free. Give it an `aria-label` naming the emoji and count ("victory hand, 1 reaction"); wrap the
+ * emoji glyph in {@link ThreadItemReactionEmoji} so it stays out of the accessible name.
+ */
+const ThreadItemReaction = React.forwardRef<HTMLButtonElement, TogglePrimitive.Props>(function ThreadItemReaction(
+ { className, ...props },
+ ref
+) {
+ return (
+ <TogglePrimitive
+ ref={ref}
+ data-quill
+ data-slot="thread-item-reaction"
+ className={cn('quill-thread-item__reaction', className)}
+ {...props}
+ />
+ )
+})
+
+/** Decorative emoji glyph inside a reaction — hidden from the accessible name. */
+function ThreadItemReactionEmoji({ className, ...props }: React.ComponentProps<'span'>): React.ReactElement {
+ return (
+ <span
+ aria-hidden="true"
+ data-slot="thread-item-reaction-emoji"
+ className={cn('quill-thread-item__reaction-emoji', className)}
+ {...props}
+ />
+ )
+}
+
+const ThreadItemActionsContext = React.createContext(false)
+
+/**
+ * Hover-revealed actions toolbar, anchored to the item's top end corner. A Base UI Toolbar, so it
+ * is one tab stop with arrow-key roving focus between actions. Hidden with opacity (not
+ * `display: none`) so it stays keyboard-reachable — focus reveals it via `:focus-within`. Carries
+ * its own `TooltipProvider`, so {@link ThreadItemAction} tooltips work without app-root setup and
+ * moving between adjacent actions shares the provider's warm-up delay.
+ */
+function ThreadItemActions({
+ className,
+ 'aria-label': ariaLabel = 'Message actions',
+ ...props
+}: ToolbarPrimitive.Root.Props): React.ReactElement {
+ return (
+ <ThreadItemActionsContext.Provider value={true}>
+ <TooltipProvider>
+ <ToolbarPrimitive.Root
+ aria-label={ariaLabel}
+ data-slot="thread-item-actions"
+ className={cn('quill-thread-item__actions', className)}
+ {...props}
+ />
+ </TooltipProvider>
+ </ThreadItemActionsContext.Provider>
+ )
+}
+
+/**
+ * One icon action: a Button wrapped in a Tooltip. `label` is both the accessible name
+ * (`aria-label`) and the tooltip content — one source of truth, so the tooltip can never drift
+ * from what screen readers announce. Forwards all Button props, including `render`
+ * (`render={<a href="…" />}` for a link action), and its ref reaches the underlying button — so it
+ * works as a `render` target itself (e.g. `DropdownMenuTrigger render={<ThreadItemAction …/>}`).
+ * Inside {@link ThreadItemActions} it joins the toolbar's roving focus and the tooltip provider is
+ * built in; anywhere else (e.g. a reactions row) it needs a `TooltipProvider` ancestor.
+ */
+const ThreadItemAction = React.forwardRef<
+ HTMLButtonElement,
+ ButtonProps & {
+ label: string
+ tooltipSide?: React.ComponentProps<typeof TooltipContent>['side']
+ }
+>(function ThreadItemAction({ label, tooltipSide = 'top', size = 'icon-sm', children, ...props }, ref) {
+ const inToolbar = React.useContext(ThreadItemActionsContext)
+ const button = <Button ref={ref} data-slot="thread-item-action" size={size} aria-label={label} {...props} />
+ return (
+ <Tooltip>
+ <TooltipTrigger render={inToolbar ? <ToolbarPrimitive.Button render={button} /> : button}>
+ {children}
+ </TooltipTrigger>
+ <TooltipContent side={tooltipSide}>{label}</TooltipContent>
+ </Tooltip>
+ )
+})
+
+/**
+ * Reply summary row — a Button (variant `default`: transparent at rest, fill on hover), stretched
+ * to the content column. Opens the thread on click; pass `render={<a />}` for a link.
+ */
+function ThreadItemReplies({ className, ...props }: ButtonProps): React.ReactElement {
+ return (
+ <Button
+ data-slot="thread-item-replies"
+ left
+ className={cn('quill-thread-item__replies', className)}
+ {...props}
+ />
+ )
+}
+
+function ThreadItemRepliesLabel({ className, ...props }: React.ComponentProps<'span'>): React.ReactElement {
+ return (
+ <span
+ data-slot="thread-item-replies-label"
+ className={cn('quill-thread-item__replies-label', className)}
+ {...props}
+ />
+ )
+}
+
+function ThreadItemRepliesMeta({ className, ...props }: React.ComponentProps<'span'>): React.ReactElement {
+ return (
+ <span
+ data-slot="thread-item-replies-meta"
+ className={cn('quill-thread-item__replies-meta', className)}
+ {...props}
+ />
+ )
+}
+
+export {
+ ThreadItemGroup,
+ ThreadItem,
+ ThreadItemGutter,
+ ThreadItemContent,
+ ThreadItemHeader,
+ ThreadItemAuthor,
+ ThreadItemTimestamp,
+ ThreadItemBody,
+ ThreadItemMention,
+ ThreadItemLink,
+ ThreadItemAttachment,
+ ThreadItemAttachmentTrigger,
+ ThreadItemAttachmentContent,
+ ThreadItemAttachmentImage,
+ ThreadItemReactions,
+ ThreadItemReaction,
+ ThreadItemReactionEmoji,
+ ThreadItemActions,
+ ThreadItemAction,
+ ThreadItemReplies,
+ ThreadItemRepliesLabel,
+ ThreadItemRepliesMeta,
+}
diff --git a/packages/quill/packages/primitives/src/index.ts b/packages/quill/packages/primitives/src/index.ts
index 3f1659da68e4..e9bbd6b6038c 100644
--- a/packages/quill/packages/primitives/src/index.ts
+++ b/packages/quill/packages/primitives/src/index.ts
@@ -54,6 +54,30 @@ export {
useChatMessageScrollerScrollable,
useChatMessageScrollerVisibility,
} from './chat/chat-message-scroller'
+export {
+ ThreadItemGroup,
+ ThreadItem,
+ ThreadItemGutter,
+ ThreadItemContent,
+ ThreadItemHeader,
+ ThreadItemAuthor,
+ ThreadItemTimestamp,
+ ThreadItemBody,
+ ThreadItemMention,
+ ThreadItemLink,
+ ThreadItemAttachment,
+ ThreadItemAttachmentTrigger,
+ ThreadItemAttachmentContent,
+ ThreadItemAttachmentImage,
+ ThreadItemReactions,
+ ThreadItemReaction,
+ ThreadItemReactionEmoji,
+ ThreadItemActions,
+ ThreadItemAction,
+ ThreadItemReplies,
+ ThreadItemRepliesLabel,
+ ThreadItemRepliesMeta,
+} from './chat/thread-item'
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants } from './button-group'
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } from './card'
export { CardGroup } from './card-group'
diff --git a/packages/quill/packages/primitives/src/menu-label.css b/packages/quill/packages/primitives/src/menu-label.css
index 9306e4205392..d95811e6d182 100644
--- a/packages/quill/packages/primitives/src/menu-label.css
+++ b/packages/quill/packages/primitives/src/menu-label.css
@@ -11,6 +11,6 @@
}
:is(.dark, [theme='dark']) .quill-menu-label {
- color: color-mix(in oklab, var(--muted-foreground) 80%, transparent);
+ color: var(--subtle-foreground, var(--muted-foreground));
}
}
diff --git a/packages/quill/packages/tokens/src/colors.ts b/packages/quill/packages/tokens/src/colors.ts
index 9a2ade42695c..d33f8a20e8af 100644
--- a/packages/quill/packages/tokens/src/colors.ts
+++ b/packages/quill/packages/tokens/src/colors.ts
@@ -100,6 +100,13 @@ export function buildSemanticColors(): Record<string, ColorTuple> {
// list rows): light hsl(70 16% 93%), dark hsl(240 8% 10%), in OKLCH.
muted: [surface(0.953, 1.28, 'light'), surface(0.209, 1.33, 'dark'), 'bg-muted'],
'muted-foreground': [oklch(0.446, 0.03, 257), oklch(0.709, 0, 0), 'text-muted-foreground'],
+ // One step quieter than muted-foreground — tertiary meta text (attachment
+ // filenames, reply meta). Derived from muted-foreground so it tracks it.
+ 'subtle-foreground': [
+ 'color-mix(in oklab, var(--muted-foreground) 80%, transparent)',
+ 'color-mix(in oklab, var(--muted-foreground) 80%, transparent)',
+ 'text-subtle-foreground',
+ ],
// Chrome — UI furniture surface (toolbars, menubars, nav). Matched to
// PostHog app's --color-bg-surface-tertiary: light hsl(77 13% 89%),