Skip to content

ComponentsMessaging

SourceSource

Message Group

A grouped chat message with author, timestamp, reply preview, reactions and an ephemeral state.

A grouped chat message with author, timestamp, reply preview, reactions and an ephemeral state. Compose it from the exported registry parts so local content and behaviour stay in the application while the visual contract stays token-driven.

Root class newt-message-group
import { Avatar } from "@/registry/bases/newt/ui/avatar"
import {
  MessageGroup,
  MessageGroupAuthor,
  MessageGroupAvatar,
  MessageGroupBody,
  MessageGroupBotTag,
  MessageGroupContent,
  MessageGroupEphemeralAction,
  MessageGroupEphemeralNotice,
  MessageGroupHeader,
  MessageGroupReactions,
  MessageGroupReply,
  MessageGroupTime,
} from "@/registry/bases/newt/ui/message-group"
import { Reaction } from "@/registry/bases/newt/ui/reaction"
import {
  ReplyPreview,
  ReplyPreviewAuthor,
  ReplyPreviewText,
} from "@/registry/bases/newt/ui/reply-preview"
import {
  StatusDot,
  StatusIndicator,
} from "@/registry/bases/newt/ui/status-indicator"

export default function MessageGroupDemo() {
  return (
    <div className="flex w-full max-w-md flex-col gap-2">
      <MessageGroup withReply>
        <MessageGroupReply>
          <ReplyPreview>
            <ReplyPreviewAuthor>@someone</ReplyPreviewAuthor>
            <ReplyPreviewText>original message text</ReplyPreviewText>
          </ReplyPreview>
        </MessageGroupReply>
        <MessageGroupAvatar>
          <StatusIndicator>
            <Avatar>U</Avatar>
            <StatusDot status="online" label="Online" />
          </StatusIndicator>
        </MessageGroupAvatar>
        <MessageGroupBody>
          <MessageGroupHeader>
            <MessageGroupAuthor>username</MessageGroupAuthor>
            <MessageGroupBotTag verified />
            <MessageGroupTime dateTime="2026-09-04T14:23:00.000Z">
              Today at 14:23
            </MessageGroupTime>
          </MessageGroupHeader>
          <MessageGroupContent>Message content goes here.</MessageGroupContent>
          <MessageGroupReactions>
            <Reaction emoji="👍" count={1} />
          </MessageGroupReactions>
        </MessageGroupBody>
      </MessageGroup>
      <MessageGroup ephemeral>
        <MessageGroupAvatar>
          <Avatar>B</Avatar>
        </MessageGroupAvatar>
        <MessageGroupBody>
          <MessageGroupHeader>
            <MessageGroupAuthor>botname</MessageGroupAuthor>
            <MessageGroupBotTag>APP</MessageGroupBotTag>
          </MessageGroupHeader>
          <MessageGroupContent>Command ran successfully.</MessageGroupContent>
          <MessageGroupEphemeralNotice>
            Only you can see this •
            <MessageGroupEphemeralAction>
              Dismiss message
            </MessageGroupEphemeralAction>
          </MessageGroupEphemeralNotice>
        </MessageGroupBody>
      </MessageGroup>
    </div>
  )
}
<script setup lang="ts">
import { Avatar } from "~~/registry/bases/newt/ui/avatar"
import {
  MessageGroup,
  MessageGroupAuthor,
  MessageGroupAvatar,
  MessageGroupBody,
  MessageGroupBotTag,
  MessageGroupContent,
  MessageGroupEphemeralAction,
  MessageGroupEphemeralNotice,
  MessageGroupHeader,
  MessageGroupReactions,
  MessageGroupReply,
  MessageGroupTime,
} from "~~/registry/bases/newt/ui/message-group"
import { Reaction } from "~~/registry/bases/newt/ui/reaction"
import {
  ReplyPreview,
  ReplyPreviewAuthor,
  ReplyPreviewText,
} from "~~/registry/bases/newt/ui/reply-preview"
import {
  StatusDot,
  StatusIndicator,
} from "~~/registry/bases/newt/ui/status-indicator"
</script>

<template>
  <div class="flex w-full max-w-md flex-col gap-2">
    <MessageGroup with-reply>
      <MessageGroupReply>
        <ReplyPreview>
          <ReplyPreviewAuthor>@someone</ReplyPreviewAuthor>
          <ReplyPreviewText>original message text</ReplyPreviewText>
        </ReplyPreview>
      </MessageGroupReply>
      <MessageGroupAvatar>
        <StatusIndicator>
          <Avatar>U</Avatar>
          <StatusDot status="online" label="Online" />
        </StatusIndicator>
      </MessageGroupAvatar>
      <MessageGroupBody>
        <MessageGroupHeader>
          <MessageGroupAuthor>username</MessageGroupAuthor>
          <MessageGroupBotTag verified />
          <MessageGroupTime datetime="2026-09-04T14:23:00.000Z">
            Today at 14:23
          </MessageGroupTime>
        </MessageGroupHeader>
        <MessageGroupContent>Message content goes here.</MessageGroupContent>
        <MessageGroupReactions>
          <Reaction emoji="👍" :count="1" />
        </MessageGroupReactions>
      </MessageGroupBody>
    </MessageGroup>
    <MessageGroup ephemeral>
      <MessageGroupAvatar>
        <Avatar>B</Avatar>
      </MessageGroupAvatar>
      <MessageGroupBody>
        <MessageGroupHeader>
          <MessageGroupAuthor>botname</MessageGroupAuthor>
          <MessageGroupBotTag>APP</MessageGroupBotTag>
        </MessageGroupHeader>
        <MessageGroupContent>Command ran successfully.</MessageGroupContent>
        <MessageGroupEphemeralNotice>
          Only you can see this •
          <MessageGroupEphemeralAction>
            Dismiss message
          </MessageGroupEphemeralAction>
        </MessageGroupEphemeralNotice>
      </MessageGroupBody>
    </MessageGroup>
  </div>
</template>

Installation

npx newtui@latest add message-groupnpx shadcn@latest add @newtui/message-groupnpx shadcn-vue@latest add @newtui/message-grouppnpm dlx newtui@latest add message-grouppnpm dlx shadcn@latest add @newtui/message-grouppnpm dlx shadcn-vue@latest add @newtui/message-groupyarn dlx newtui@latest add message-groupyarn dlx shadcn@latest add @newtui/message-groupyarn dlx shadcn-vue@latest add @newtui/message-groupbunx newtui@latest add message-groupbunx shadcn@latest add @newtui/message-groupbunx shadcn-vue@latest add @newtui/message-groupdeno run -A npm:newtui@latest add message-groupdeno run -A npm:shadcn@latest add @newtui/message-groupdeno run -A npm:shadcn-vue@latest add @newtui/message-groupvlx newtui@latest add message-groupvlx shadcn@latest add @newtui/message-groupvlx shadcn-vue@latest add @newtui/message-groupvp dlx newtui@latest add message-groupvp dlx shadcn@latest add @newtui/message-groupvp dlx shadcn-vue@latest add @newtui/message-groupnubx newtui@latest add message-groupnubx shadcn@latest add @newtui/message-groupnubx shadcn-vue@latest add @newtui/message-groupnlx newtui@latest add message-groupnlx shadcn@latest add @newtui/message-groupnlx shadcn-vue@latest add @newtui/message-groupupx newtui@latest add message-groupupx shadcn@latest add @newtui/message-groupupx shadcn-vue@latest add @newtui/message-group

The shadcn CLI needs the @newtui registry in your components.json. Set it up.

Add the components it builds on

Copy the source into your project

import * as React from "react"

import { cn } from "@/lib/utils"

export interface MessageGroupProps extends React.HTMLAttributes<HTMLElement> {
  /**
   * The element to render. `div` by default; `article` when each message is a
   * self-contained post, `li` inside a list of messages.
   */
  as?: React.ElementType
  /**
   * Lay the row out as a 2x2 grid so a `MessageGroupReply` can hook over the
   * avatar, the way the client stacks a reply above the message it answers.
   */
  withReply?: boolean
  /** Tint the row as an ephemeral (visible-to-you-only) response. */
  ephemeral?: boolean
}

const MessageGroup = React.forwardRef<HTMLElement, MessageGroupProps>(
  (
    {
      as: Tag = "div",
      className,
      withReply = false,
      ephemeral = false,
      ...props
    },
    ref
  ) => (
    <Tag
      ref={ref}
      data-slot="message-row"
      data-ephemeral={ephemeral || undefined}
      className={cn(
        /*
         * The size of the avatar and the gap beside it. A reply preview in the
         * row reads both, so its spine starts above the centre of the avatar.
         * Set them when the row holds an avatar of another size.
         */
        "gap-x-[var(--newt-message-group-gap)] py-1 [--newt-message-group-avatar-size:40px] [--newt-message-group-gap:16px]",
        /*
         * The colour of the message text is on the row and the content
         * inherits it, so a colour class on the row reaches the content. The
         * fallback keeps a project without `--newt-text-message` on the
         * colour it had.
         */
        "text-[color:var(--newt-text-message,var(--newt-text-secondary))]",
        withReply
          ? "grid grid-cols-[auto_minmax(0,1fr)] grid-rows-[auto_auto] items-start gap-y-0.5 [&>[data-slot=message-avatar]]:col-start-1 [&>[data-slot=message-avatar]]:row-start-2 [&>[data-slot=message-body]]:col-start-2 [&>[data-slot=message-body]]:row-start-2 [&>[data-slot=message-reply]]:col-start-2 [&>[data-slot=message-reply]]:row-start-1"
          : "flex",
        ephemeral
          ? "border-s-2 border-[color-mix(in_srgb,var(--newt-text-link)_40%,transparent)] bg-[color-mix(in_srgb,var(--newt-text-link)_10%,transparent)] hover:bg-[color-mix(in_srgb,var(--newt-text-link)_15%,transparent)]"
          : "hover:bg-newt-bg-message-hover",
        className
      )}
      {...props}
    />
  )
)
MessageGroup.displayName = "MessageGroup"

const MessageGroupAvatar = React.forwardRef<
  HTMLDivElement,
  React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
  <div
    ref={ref}
    data-slot="message-avatar"
    className={cn("shrink-0", className)}
    {...props}
  />
))
MessageGroupAvatar.displayName = "MessageGroupAvatar"

const MessageGroupReply = React.forwardRef<
  HTMLDivElement,
  React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
  <div
    ref={ref}
    data-slot="message-reply"
    className={cn("min-w-0", className)}
    {...props}
  />
))
MessageGroupReply.displayName = "MessageGroupReply"

const MessageGroupBody = React.forwardRef<
  HTMLDivElement,
  React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
  <div
    ref={ref}
    data-slot="message-body"
    className={cn("min-w-0 flex-1", className)}
    {...props}
  />
))
MessageGroupBody.displayName = "MessageGroupBody"

const MessageGroupHeader = React.forwardRef<
  HTMLDivElement,
  React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
  <div
    ref={ref}
    className={cn("mb-1 flex items-baseline gap-2", className)}
    {...props}
  />
))
MessageGroupHeader.displayName = "MessageGroupHeader"

const MessageGroupAuthor = React.forwardRef<
  HTMLSpanElement,
  React.HTMLAttributes<HTMLSpanElement>
>(({ className, ...props }, ref) => (
  <span
    ref={ref}
    className={cn(
      "text-[15px] font-semibold text-newt-text-primary",
      className
    )}
    {...props}
  />
))
MessageGroupAuthor.displayName = "MessageGroupAuthor"

export interface MessageGroupBotTagProps extends React.HTMLAttributes<HTMLSpanElement> {
  /** Add the check Discord puts on verified applications. */
  verified?: boolean
  /** Accessible name of the tag. `aria-label` still wins. */
  label?: string
  /** Accessible name with `verified`. `aria-label` still wins. */
  verifiedLabel?: string
  /** Fixed accessible name. Wins over `label` and `verifiedLabel`. */
  "aria-label"?: string
}

const MessageGroupBotTag = React.forwardRef<
  HTMLSpanElement,
  MessageGroupBotTagProps
>(
  (
    {
      className,
      verified = false,
      label = "Application",
      verifiedLabel = "Verified application",
      children = "BOT",
      "aria-label": ariaLabel,
      ...props
    },
    ref
  ) => (
    <span
      ref={ref}
      role="img"
      aria-label={ariaLabel ?? (verified ? verifiedLabel : label)}
      className={cn(
        "inline-flex items-center gap-0.5 rounded-[3px] bg-newt-brand px-1 py-px text-[10px] font-semibold uppercase tracking-[0.02em] text-newt-on-accent",
        className
      )}
      {...props}
    >
      {verified ? (
        <svg
          viewBox="0 0 24 24"
          aria-hidden="true"
          focusable="false"
          className="h-2.5 w-2.5"
        >
          <path
            fill="currentColor"
            d="M9.55 17.6 4.4 12.45l1.4-1.4 3.75 3.75 8.65-8.65 1.4 1.4z"
          />
        </svg>
      ) : null}
      {children}
    </span>
  )
)
MessageGroupBotTag.displayName = "MessageGroupBotTag"

/* A real `<time>`: the timestamp is machine-readable, not just small text. */
const MessageGroupTime = React.forwardRef<
  HTMLTimeElement,
  React.ComponentProps<"time">
>(({ className, ...props }, ref) => (
  <time
    ref={ref}
    className={cn("text-[11px] text-newt-text-muted", className)}
    {...props}
  />
))
MessageGroupTime.displayName = "MessageGroupTime"

/* No colour of its own: the content takes the colour of the row. */
const MessageGroupContent = React.forwardRef<
  HTMLDivElement,
  React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
  <div
    ref={ref}
    className={cn("text-[15px] leading-[1.5]", className)}
    {...props}
  />
))
MessageGroupContent.displayName = "MessageGroupContent"

const MessageGroupReactions = React.forwardRef<
  HTMLDivElement,
  React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
  <div
    ref={ref}
    className={cn("mt-1.5 flex flex-wrap gap-1", className)}
    {...props}
  />
))
MessageGroupReactions.displayName = "MessageGroupReactions"

/*
 * The "only you can see this" footer Discord shows under an ephemeral reply.
 * Children replace the default copy; the dismiss control is the caller's.
 */
const MessageGroupEphemeralNotice = React.forwardRef<
  HTMLDivElement,
  React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
  <div
    ref={ref}
    role="status"
    className={cn(
      "mt-1.5 flex items-center gap-1 text-[13px] text-newt-text-muted",
      className
    )}
    {...props}
  />
))
MessageGroupEphemeralNotice.displayName = "MessageGroupEphemeralNotice"

const MessageGroupEphemeralAction = React.forwardRef<
  HTMLButtonElement,
  React.ComponentProps<"button">
>(({ className, type = "button", ...props }, ref) => (
  <button
    ref={ref}
    type={type}
    className={cn(
      "cursor-pointer border-0 bg-transparent p-0 font-[inherit] text-newt-text-link hover:underline",
      className
    )}
    {...props}
  />
))
MessageGroupEphemeralAction.displayName = "MessageGroupEphemeralAction"

export {
  MessageGroup,
  MessageGroupAvatar,
  MessageGroupReply,
  MessageGroupBody,
  MessageGroupHeader,
  MessageGroupAuthor,
  MessageGroupBotTag,
  MessageGroupTime,
  MessageGroupContent,
  MessageGroupReactions,
  MessageGroupEphemeralNotice,
  MessageGroupEphemeralAction,
}
<script setup lang="ts">
import type { Component, HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

const props = withDefaults(
  defineProps<{
    class?: HTMLAttributes["class"]
    /**
     * The element to render. `div` by default; `article` when each message is a
     * self-contained post, `li` inside a list of messages.
     */
    as?: string | Component
    /**
     * Lay the row out as a 2x2 grid so a `MessageGroupReply` can hook over the
     * avatar, the way the client stacks a reply above the message it answers.
     */
    withReply?: boolean
    /** Tint the row as an ephemeral (visible-to-you-only) response. */
    ephemeral?: boolean
  }>(),
  { as: "div" }
)
</script>

<template>
  <component
    :is="props.as"
    data-slot="message-row"
    :data-ephemeral="props.ephemeral || undefined"
    :class="
      cn(
        // The size of the avatar and the gap beside it. A reply preview in the
        // row reads both, so its spine starts above the centre of the avatar.
        // Set them when the row holds an avatar of another size.
        'gap-x-[var(--newt-message-group-gap)] py-1 [--newt-message-group-avatar-size:40px] [--newt-message-group-gap:16px]',
        // The colour of the message text is on the row and the content
        // inherits it, so a colour class on the row reaches the content. The
        // fallback keeps a project without `--newt-text-message` on the
        // colour it had.
        'text-[color:var(--newt-text-message,var(--newt-text-secondary))]',
        props.withReply
          ? 'grid grid-cols-[auto_minmax(0,1fr)] grid-rows-[auto_auto] items-start gap-y-0.5 [&>[data-slot=message-avatar]]:col-start-1 [&>[data-slot=message-avatar]]:row-start-2 [&>[data-slot=message-body]]:col-start-2 [&>[data-slot=message-body]]:row-start-2 [&>[data-slot=message-reply]]:col-start-2 [&>[data-slot=message-reply]]:row-start-1'
          : 'flex',
        props.ephemeral
          ? 'border-s-2 border-[color-mix(in_srgb,var(--newt-text-link)_40%,transparent)] bg-[color-mix(in_srgb,var(--newt-text-link)_10%,transparent)] hover:bg-[color-mix(in_srgb,var(--newt-text-link)_15%,transparent)]'
          : 'hover:bg-newt-bg-message-hover',
        props.class
      )
    "
  >
    <slot />
  </component>
</template>
<script setup lang="ts">
import type { HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>

<template>
  <div data-slot="message-avatar" :class="cn('shrink-0', props.class)">
    <slot />
  </div>
</template>
<script setup lang="ts">
import type { HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>

<template>
  <div data-slot="message-reply" :class="cn('min-w-0', props.class)">
    <slot />
  </div>
</template>
<script setup lang="ts">
import type { HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>

<template>
  <div data-slot="message-body" :class="cn('min-w-0 flex-1', props.class)">
    <slot />
  </div>
</template>
<script setup lang="ts">
import type { HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>

<template>
  <div :class="cn('mb-1 flex items-baseline gap-2', props.class)">
    <slot />
  </div>
</template>
<script setup lang="ts">
import type { HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>

<template>
  <span
    :class="cn('text-[15px] font-semibold text-newt-text-primary', props.class)"
  >
    <slot />
  </span>
</template>
<script setup lang="ts">
import type { HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

const props = withDefaults(
  defineProps<{
    class?: HTMLAttributes["class"]
    /** Add the check Discord puts on verified applications. */
    verified?: boolean
    /** Accessible name of the tag. `aria-label` still wins. */
    label?: string
    /** Accessible name with `verified`. `aria-label` still wins. */
    verifiedLabel?: string
    /** Fixed accessible name. Wins over `label` and `verifiedLabel`. */
    ariaLabel?: string
  }>(),
  { label: "Application", verifiedLabel: "Verified application" }
)
</script>

<template>
  <span
    role="img"
    :aria-label="
      props.ariaLabel ?? (props.verified ? props.verifiedLabel : props.label)
    "
    :class="
      cn(
        'inline-flex items-center gap-0.5 rounded-[3px] bg-newt-brand px-1 py-px text-[10px] font-semibold uppercase tracking-[0.02em] text-newt-on-accent',
        props.class
      )
    "
  >
    <svg
      v-if="props.verified"
      viewBox="0 0 24 24"
      aria-hidden="true"
      focusable="false"
      class="h-2.5 w-2.5"
    >
      <path
        fill="currentColor"
        d="M9.55 17.6 4.4 12.45l1.4-1.4 3.75 3.75 8.65-8.65 1.4 1.4z"
      />
    </svg>
    <slot>BOT</slot>
  </span>
</template>
<script setup lang="ts">
import type { HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

const props = defineProps<{
  class?: HTMLAttributes["class"]
  /** Machine-readable timestamp for the `datetime` attribute. */
  datetime?: string
}>()
</script>

<!-- A real `<time>`: the timestamp is machine-readable, not just small text. -->
<template>
  <time
    :datetime="props.datetime"
    :class="cn('text-[11px] text-newt-text-muted', props.class)"
  >
    <slot />
  </time>
</template>
<script setup lang="ts">
import type { HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>

<!-- No colour of its own: the content takes the colour of the row. -->
<template>
  <div :class="cn('text-[15px] leading-[1.5]', props.class)">
    <slot />
  </div>
</template>
<script setup lang="ts">
import type { HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>

<template>
  <div :class="cn('mt-1.5 flex flex-wrap gap-1', props.class)">
    <slot />
  </div>
</template>
<script setup lang="ts">
import type { HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>

<!--
  The "only you can see this" footer Discord shows under an ephemeral reply.
  Slot content replaces the copy; the dismiss control is the caller's.
-->
<template>
  <div
    role="status"
    :class="
      cn(
        'mt-1.5 flex items-center gap-1 text-[13px] text-newt-text-muted',
        props.class
      )
    "
  >
    <slot />
  </div>
</template>
<script setup lang="ts">
import type { ButtonHTMLAttributes, HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

const props = withDefaults(
  defineProps<{
    class?: HTMLAttributes["class"]
    type?: ButtonHTMLAttributes["type"]
  }>(),
  { type: "button" }
)
</script>

<template>
  <button
    :type="props.type"
    :class="
      cn(
        'cursor-pointer border-0 bg-transparent p-0 font-[inherit] text-newt-text-link hover:underline',
        props.class
      )
    "
  >
    <slot />
  </button>
</template>
export { default as MessageGroup } from "./MessageGroup.vue"
export { default as MessageGroupAvatar } from "./MessageGroupAvatar.vue"
export { default as MessageGroupReply } from "./MessageGroupReply.vue"
export { default as MessageGroupBody } from "./MessageGroupBody.vue"
export { default as MessageGroupHeader } from "./MessageGroupHeader.vue"
export { default as MessageGroupAuthor } from "./MessageGroupAuthor.vue"
export { default as MessageGroupBotTag } from "./MessageGroupBotTag.vue"
export { default as MessageGroupTime } from "./MessageGroupTime.vue"
export { default as MessageGroupContent } from "./MessageGroupContent.vue"
export { default as MessageGroupReactions } from "./MessageGroupReactions.vue"
export { default as MessageGroupEphemeralNotice } from "./MessageGroupEphemeralNotice.vue"
export { default as MessageGroupEphemeralAction } from "./MessageGroupEphemeralAction.vue"

Update the import paths

The files import @/lib/utils and sibling components through the aliases in your components.json. Point them at wherever those live in your project.

No CLI, no components.json: paste this into Claude, Cursor, Copilot or any coding assistant and it adds Message Group to your React project by hand. The prompt carries the source of every file the CLI would write — this component's and those of the components it builds on — with the imports already pointed at the default aliases.

No CLI, no components.json: paste this into Claude, Cursor, Copilot or any coding assistant and it adds Message Group to your Vue project by hand. The prompt carries the source of every file the CLI would write — this component's and those of the components it builds on — with the imports already pointed at the default aliases.

Usage

import { MessageGroup } from "@/components/ui/message-group"

export function Example() {
  return <MessageGroup />
}
<script setup lang="ts">
import { MessageGroup, MessageGroupAvatar, MessageGroupReply, MessageGroupBody, MessageGroupHeader, MessageGroupAuthor, MessageGroupBotTag, MessageGroupTime, MessageGroupContent, MessageGroupReactions, MessageGroupEphemeralNotice, MessageGroupEphemeralAction } from "@/components/ui/message-group"
</script>

<template>
  <MessageGroup />
</template>

Examples

Message list

Set as="li" to render each row as an item of the list that holds the channel, so assistive technology announces how many messages there are.

Root class newt-message-group
import { Avatar } from "@/registry/bases/newt/ui/avatar"
import {
  MessageGroup,
  MessageGroupAuthor,
  MessageGroupAvatar,
  MessageGroupBody,
  MessageGroupContent,
  MessageGroupHeader,
  MessageGroupTime,
} from "@/registry/bases/newt/ui/message-group"

const MESSAGES = [
  {
    author: "rowan",
    initial: "R",
    dateTime: "2026-09-04T14:23:00.000Z",
    time: "Today at 14:23",
    content: "Is the raid still on for Friday?",
  },
  {
    author: "juniper",
    initial: "J",
    dateTime: "2026-09-04T14:25:00.000Z",
    time: "Today at 14:25",
    content: "Yes, same time as last week.",
  },
  {
    author: "sorrel",
    initial: "S",
    dateTime: "2026-09-04T14:31:00.000Z",
    time: "Today at 14:31",
    content: "I can bring a healer this time.",
  },
]

/* `as="li"` makes each row an item of the list that holds the channel. */
export default function MessageGroupListDemo() {
  return (
    <ol
      aria-label="Messages in raid-planning"
      className="m-0 flex w-full max-w-md list-none flex-col p-0"
    >
      {MESSAGES.map((message) => (
        <MessageGroup key={message.dateTime} as="li">
          <MessageGroupAvatar>
            <Avatar>{message.initial}</Avatar>
          </MessageGroupAvatar>
          <MessageGroupBody>
            <MessageGroupHeader>
              <MessageGroupAuthor>{message.author}</MessageGroupAuthor>
              <MessageGroupTime dateTime={message.dateTime}>
                {message.time}
              </MessageGroupTime>
            </MessageGroupHeader>
            <MessageGroupContent>{message.content}</MessageGroupContent>
          </MessageGroupBody>
        </MessageGroup>
      ))}
    </ol>
  )
}
<script setup lang="ts">
import { Avatar } from "~~/registry/bases/newt/ui/avatar"
import {
  MessageGroup,
  MessageGroupAuthor,
  MessageGroupAvatar,
  MessageGroupBody,
  MessageGroupContent,
  MessageGroupHeader,
  MessageGroupTime,
} from "~~/registry/bases/newt/ui/message-group"

/* `as="li"` makes each row an item of the list that holds the channel. */
const messages = [
  {
    author: "rowan",
    initial: "R",
    dateTime: "2026-09-04T14:23:00.000Z",
    time: "Today at 14:23",
    content: "Is the raid still on for Friday?",
  },
  {
    author: "juniper",
    initial: "J",
    dateTime: "2026-09-04T14:25:00.000Z",
    time: "Today at 14:25",
    content: "Yes, same time as last week.",
  },
  {
    author: "sorrel",
    initial: "S",
    dateTime: "2026-09-04T14:31:00.000Z",
    time: "Today at 14:31",
    content: "I can bring a healer this time.",
  },
]
</script>

<template>
  <ol
    aria-label="Messages in raid-planning"
    class="m-0 flex w-full max-w-md list-none flex-col p-0"
  >
    <MessageGroup v-for="message in messages" :key="message.dateTime" as="li">
      <MessageGroupAvatar>
        <Avatar>{{ message.initial }}</Avatar>
      </MessageGroupAvatar>
      <MessageGroupBody>
        <MessageGroupHeader>
          <MessageGroupAuthor>{{ message.author }}</MessageGroupAuthor>
          <MessageGroupTime :datetime="message.dateTime">
            {{ message.time }}
          </MessageGroupTime>
        </MessageGroupHeader>
        <MessageGroupContent>{{ message.content }}</MessageGroupContent>
      </MessageGroupBody>
    </MessageGroup>
  </ol>
</template>

App tags

MessageGroupBotTag marks an author as an application. On its own it reads “BOT”, verified adds a check, and its content and aria-label replace the label and the accessible name.

Root class newt-message-group
import { Avatar } from "@/registry/bases/newt/ui/avatar"
import {
  MessageGroup,
  MessageGroupAuthor,
  MessageGroupAvatar,
  MessageGroupBody,
  MessageGroupBotTag,
  MessageGroupContent,
  MessageGroupHeader,
  MessageGroupTime,
} from "@/registry/bases/newt/ui/message-group"

/* The tag's three forms: the default, a verified app, and a label of your own. */
export default function MessageGroupAppDemo() {
  return (
    <div className="flex w-full max-w-md flex-col">
      <MessageGroup>
        <MessageGroupAvatar>
          <Avatar>W</Avatar>
        </MessageGroupAvatar>
        <MessageGroupBody>
          <MessageGroupHeader>
            <MessageGroupAuthor>welcomer</MessageGroupAuthor>
            <MessageGroupBotTag />
            <MessageGroupTime dateTime="2026-09-04T09:02:00.000Z">
              Today at 09:02
            </MessageGroupTime>
          </MessageGroupHeader>
          <MessageGroupContent>
            Say hello to our newest member.
          </MessageGroupContent>
        </MessageGroupBody>
      </MessageGroup>
      <MessageGroup>
        <MessageGroupAvatar>
          <Avatar>M</Avatar>
        </MessageGroupAvatar>
        <MessageGroupBody>
          <MessageGroupHeader>
            <MessageGroupAuthor>modlog</MessageGroupAuthor>
            <MessageGroupBotTag verified />
            <MessageGroupTime dateTime="2026-09-04T09:10:00.000Z">
              Today at 09:10
            </MessageGroupTime>
          </MessageGroupHeader>
          <MessageGroupContent>
            Slow mode is on in this channel.
          </MessageGroupContent>
        </MessageGroupBody>
      </MessageGroup>
      <MessageGroup>
        <MessageGroupAvatar>
          <Avatar>N</Avatar>
        </MessageGroupAvatar>
        <MessageGroupBody>
          <MessageGroupHeader>
            <MessageGroupAuthor>news feed</MessageGroupAuthor>
            <MessageGroupBotTag aria-label="Webhook">HOOK</MessageGroupBotTag>
            <MessageGroupTime dateTime="2026-09-04T09:15:00.000Z">
              Today at 09:15
            </MessageGroupTime>
          </MessageGroupHeader>
          <MessageGroupContent>Patch 2.4 notes are out.</MessageGroupContent>
        </MessageGroupBody>
      </MessageGroup>
    </div>
  )
}
<script setup lang="ts">
import { Avatar } from "~~/registry/bases/newt/ui/avatar"
import {
  MessageGroup,
  MessageGroupAuthor,
  MessageGroupAvatar,
  MessageGroupBody,
  MessageGroupBotTag,
  MessageGroupContent,
  MessageGroupHeader,
  MessageGroupTime,
} from "~~/registry/bases/newt/ui/message-group"

/* The tag's three forms: the default, a verified app, and a label of your own. */
</script>

<template>
  <div class="flex w-full max-w-md flex-col">
    <MessageGroup>
      <MessageGroupAvatar>
        <Avatar>W</Avatar>
      </MessageGroupAvatar>
      <MessageGroupBody>
        <MessageGroupHeader>
          <MessageGroupAuthor>welcomer</MessageGroupAuthor>
          <MessageGroupBotTag />
          <MessageGroupTime datetime="2026-09-04T09:02:00.000Z">
            Today at 09:02
          </MessageGroupTime>
        </MessageGroupHeader>
        <MessageGroupContent
          >Say hello to our newest member.</MessageGroupContent
        >
      </MessageGroupBody>
    </MessageGroup>
    <MessageGroup>
      <MessageGroupAvatar>
        <Avatar>M</Avatar>
      </MessageGroupAvatar>
      <MessageGroupBody>
        <MessageGroupHeader>
          <MessageGroupAuthor>modlog</MessageGroupAuthor>
          <MessageGroupBotTag verified />
          <MessageGroupTime datetime="2026-09-04T09:10:00.000Z">
            Today at 09:10
          </MessageGroupTime>
        </MessageGroupHeader>
        <MessageGroupContent
          >Slow mode is on in this channel.</MessageGroupContent
        >
      </MessageGroupBody>
    </MessageGroup>
    <MessageGroup>
      <MessageGroupAvatar>
        <Avatar>N</Avatar>
      </MessageGroupAvatar>
      <MessageGroupBody>
        <MessageGroupHeader>
          <MessageGroupAuthor>news feed</MessageGroupAuthor>
          <MessageGroupBotTag aria-label="Webhook">HOOK</MessageGroupBotTag>
          <MessageGroupTime datetime="2026-09-04T09:15:00.000Z">
            Today at 09:15
          </MessageGroupTime>
        </MessageGroupHeader>
        <MessageGroupContent>Patch 2.4 notes are out.</MessageGroupContent>
      </MessageGroupBody>
    </MessageGroup>
  </div>
</template>

Reply

With withReply, the preview in MessageGroupReply sits 2px above the body. Its spine starts above the centre of the avatar and stops before the preview. The second row holds a smaller avatar, so it sets the two custom properties of the row.

Root class newt-message-group
import { Avatar } from "@/registry/bases/newt/ui/avatar"
import {
  MessageGroup,
  MessageGroupAuthor,
  MessageGroupAvatar,
  MessageGroupBody,
  MessageGroupBotTag,
  MessageGroupContent,
  MessageGroupHeader,
  MessageGroupReply,
  MessageGroupTime,
} from "@/registry/bases/newt/ui/message-group"
import {
  ReplyPreview,
  ReplyPreviewAction,
  ReplyPreviewAuthor,
  ReplyPreviewCommand,
  ReplyPreviewText,
} from "@/registry/bases/newt/ui/reply-preview"

/*
 * The spine of the preview starts above the centre of the avatar. The second
 * row holds a smaller avatar, so it states the size and the gap it uses.
 */
export default function MessageGroupReplyDemo() {
  return (
    <div className="flex w-full max-w-md flex-col gap-2">
      <MessageGroup withReply>
        <MessageGroupReply>
          <ReplyPreview>
            <ReplyPreviewAuthor>@rowan</ReplyPreviewAuthor>
            <ReplyPreviewText>
              Is the raid still on for Friday?
            </ReplyPreviewText>
          </ReplyPreview>
        </MessageGroupReply>
        <MessageGroupAvatar>
          <Avatar>J</Avatar>
        </MessageGroupAvatar>
        <MessageGroupBody>
          <MessageGroupHeader>
            <MessageGroupAuthor>juniper</MessageGroupAuthor>
            <MessageGroupTime dateTime="2026-09-04T14:25:00.000Z">
              Today at 14:25
            </MessageGroupTime>
          </MessageGroupHeader>
          <MessageGroupContent>
            Yes, same time as last week.
          </MessageGroupContent>
        </MessageGroupBody>
      </MessageGroup>
      <MessageGroup
        withReply
        className="[--newt-message-group-avatar-size:24px] [--newt-message-group-gap:12px]"
      >
        <MessageGroupReply>
          <ReplyPreview>
            <ReplyPreviewAuthor>@sorrel</ReplyPreviewAuthor>
            <ReplyPreviewAction>used</ReplyPreviewAction>
            <ReplyPreviewCommand>/roll</ReplyPreviewCommand>
          </ReplyPreview>
        </MessageGroupReply>
        <MessageGroupAvatar>
          <Avatar size="sm">D</Avatar>
        </MessageGroupAvatar>
        <MessageGroupBody>
          <MessageGroupHeader>
            <MessageGroupAuthor>dicebot</MessageGroupAuthor>
            <MessageGroupBotTag />
            <MessageGroupTime dateTime="2026-09-04T14:31:00.000Z">
              Today at 14:31
            </MessageGroupTime>
          </MessageGroupHeader>
          <MessageGroupContent>Sorrel rolled a 17.</MessageGroupContent>
        </MessageGroupBody>
      </MessageGroup>
    </div>
  )
}
<script setup lang="ts">
import { Avatar } from "~~/registry/bases/newt/ui/avatar"
import {
  MessageGroup,
  MessageGroupAuthor,
  MessageGroupAvatar,
  MessageGroupBody,
  MessageGroupBotTag,
  MessageGroupContent,
  MessageGroupHeader,
  MessageGroupReply,
  MessageGroupTime,
} from "~~/registry/bases/newt/ui/message-group"
import {
  ReplyPreview,
  ReplyPreviewAction,
  ReplyPreviewAuthor,
  ReplyPreviewCommand,
  ReplyPreviewText,
} from "~~/registry/bases/newt/ui/reply-preview"
</script>

<!--
  The spine of the preview starts above the centre of the avatar. The second
  row holds a smaller avatar, so it states the size and the gap it uses.
-->
<template>
  <div class="flex w-full max-w-md flex-col gap-2">
    <MessageGroup with-reply>
      <MessageGroupReply>
        <ReplyPreview>
          <ReplyPreviewAuthor>@rowan</ReplyPreviewAuthor>
          <ReplyPreviewText>Is the raid still on for Friday?</ReplyPreviewText>
        </ReplyPreview>
      </MessageGroupReply>
      <MessageGroupAvatar>
        <Avatar>J</Avatar>
      </MessageGroupAvatar>
      <MessageGroupBody>
        <MessageGroupHeader>
          <MessageGroupAuthor>juniper</MessageGroupAuthor>
          <MessageGroupTime datetime="2026-09-04T14:25:00.000Z">
            Today at 14:25
          </MessageGroupTime>
        </MessageGroupHeader>
        <MessageGroupContent>Yes, same time as last week.</MessageGroupContent>
      </MessageGroupBody>
    </MessageGroup>
    <MessageGroup
      with-reply
      class="[--newt-message-group-avatar-size:24px] [--newt-message-group-gap:12px]"
    >
      <MessageGroupReply>
        <ReplyPreview>
          <ReplyPreviewAuthor>@sorrel</ReplyPreviewAuthor>
          <ReplyPreviewAction>used</ReplyPreviewAction>
          <ReplyPreviewCommand>/roll</ReplyPreviewCommand>
        </ReplyPreview>
      </MessageGroupReply>
      <MessageGroupAvatar>
        <Avatar size="sm">D</Avatar>
      </MessageGroupAvatar>
      <MessageGroupBody>
        <MessageGroupHeader>
          <MessageGroupAuthor>dicebot</MessageGroupAuthor>
          <MessageGroupBotTag />
          <MessageGroupTime datetime="2026-09-04T14:31:00.000Z">
            Today at 14:31
          </MessageGroupTime>
        </MessageGroupHeader>
        <MessageGroupContent>Sorrel rolled a 17.</MessageGroupContent>
      </MessageGroupBody>
    </MessageGroup>
  </div>
</template>

API reference

MessageGroup

PropType
as?React.ElementType (React) / string | Component (Vue)

The element to render: `article` when each message is a self-contained post, `li` inside a list.

TypeReact.ElementType (React) / string | Component (Vue)
Default"div"
withReply?boolean | undefined

Lay the row out as a 2x2 grid so a `MessageGroupReply` can hook over the avatar, the way the client stacks a reply above the message it answers.

Typeboolean | undefined
ephemeral?boolean | undefined

Tint the row as an ephemeral (visible-to-you-only) response.

Typeboolean | undefined

MessageGroupBotTag

PropType
verified?boolean | undefined

Add the check Discord puts on verified applications.

Typeboolean | undefined
aria-label (React) / ariaLabel (Vue)?string | undefined

Accessible name of the tag. Pass a translation here.

Typestring | undefined
Default"Application" or "Verified application"
label?string

Accessible name of the tag. `aria-label` still wins.

Typestring
Default"Application"
verifiedLabel?string

Accessible name with `verified`. `aria-label` still wins.

Typestring
Default"Verified application"

The registry exports MessageGroup, MessageGroupAvatar, MessageGroupReply, MessageGroupBody, MessageGroupHeader, MessageGroupAuthor, MessageGroupBotTag, MessageGroupTime, MessageGroupContent, MessageGroupReactions, MessageGroupEphemeralNotice, MessageGroupEphemeralAction. Parts without a table accept the native attributes for the element they render; React uses className, while Vue uses class and fallthrough attributes.

Custom properties

Set these on the row. Each one is optional. A reply preview in the row reads both to place its spine.

PropType
--newt-message-group-avatar-size?length

Width of the avatar in the row. Set it when the avatar has another size.

Typelength
Default40px
--newt-message-group-gap?length

Gap between the avatar and the body. Set it in place of a `gap-*` class, so the spine follows.

Typelength
Default16px

Message text colour

The row sets the colour of the message text from --newt-text-message. MessageGroupContent has no colour of its own, so it takes the colour of the row. To change the text colour of one message, put a colour class on MessageGroup. If your token file has no --newt-text-message, the row uses --newt-text-secondary.

Accessibility

Preserve the native semantics of the rendered elements and pass through ARIA attributes when the surrounding context needs a label or description. Any interactive child needs a visible focus indicator, and meaning must not rely on colour alone.

The bot tag’s name comes from label and verifiedLabel. Its visible BOT is the children or the default slot. Translating labels lists every English default.

Tokens

Message Group reads its colours, radii and motion from the --newt-* tokens installed with the library. Override a token and every component that reads it follows, including this one — see the token layer. In the plain HTML and CSS distribution the same component is newt-message-group.

  • --newt-text-message
  • --newt-text-secondary
  • --newt-bg-message-hover
  • --newt-text-link
  • --newt-text-primary
  • --newt-brand
  • --newt-on-accent
  • --newt-text-muted