Message
Chat turn layout with roles, avatar, bubble content and an actions toolbar (copy, regenerate, feedback).
pnpm dlx @glinui/cli@latest add messageQ3 revenue review
Glin assistant, 3 sources
Installation
pnpm dlx @glinui/cli@latest add messagePrefer the package?
Usage
Variants
Every vocabulary variant on the default tone. Omit variant to follow the ambient design style.
import { Message, MessageContent } from "@glinui/ui"
export function MessageVariantsDemo() { return ( <div className="grid gap-2 md:grid-cols-2"> <Message variant="glinr"><MessageContent>glinr bubble</MessageContent></Message> <Message variant="solid"><MessageContent>solid bubble</MessageContent></Message> <Message variant="plain"><MessageContent>plain bubble</MessageContent></Message> <Message variant="soft"><MessageContent>soft bubble</MessageContent></Message> <Message variant="outline"><MessageContent>outline bubble</MessageContent></Message> <Message variant="ghost"><MessageContent>ghost bubble</MessageContent></Message> <Message variant="gradient"><MessageContent>gradient bubble</MessageContent></Message> </div> )}Glass (opt-in)
Glass is opt-in and needs a backdrop behind it. Switch the preview stage to Vivid or Photo to see the frosted surface.
import { Message, MessageAvatar, MessageContent } from "@glinui/ui"
export function Demo() { return ( <div className="w-full max-w-lg"> <Message variant="glass"><MessageAvatar fallback="G" /><MessageContent>First line</MessageContent></Message> <Message variant="glass" grouped><MessageAvatar fallback="G" /><MessageContent>Second line, grouped</MessageContent></Message> </div> )}Accessibility
- Pure presentation: roles are conveyed through layout, so place messages inside MessageScroller (role="log").
- Action buttons always have an aria-label; toggles expose aria-pressed.
- Copy confirmation is announced through a polite status region.
- Layout uses logical properties, so it mirrors correctly in RTL.
Keyboard Interactions
| Key | Action |
|---|---|
| Tab | Move through the actions toolbar buttons. |
| Enter / Space | Activate the focused action. |
ARIA Attributes
- `role="toolbar"` with `aria-label="Message actions"`
- `aria-pressed` on toggle actions
- `role="status"` copy confirmation
Reduced Motion
Only opacity and color transitions are used, and they are disabled under reduced motion.
Affected properties
opacitybackground-colorAPI Reference
Message
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
role | "user" | "assistant" | "system" | - | assistant | Sender. User messages align to the end with the accent bubble, system messages render as a centered pill. |
variant | "glinr" | "solid" | "plain" | "soft" | "outline" | "ghost" | "gradient" | "glass" | - | ambient (glinr) | Surface variant. Omit to follow the ambient design style (glinr by default, plain for minimal, glass for glass). |
grouped | boolean | - | false | Consecutive message from the same sender: tight spacing, hidden avatar, squared corners. |
label | string | Yes | "Copy message" | Accessible name, also used as the native tooltip. |
pressed | boolean | No | - | Toggle state for stateful actions such as thumbs up. |
MessageContent
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
bare | boolean | - | false | Render prose without a bubble. |
actions | ReactNode | - | - | Slot under the bubble, usually MessageActions. |
variant / tail | BubbleProps | - | - | Override the bubble derived from the role. |
label | string | Yes | "Copy message" | Accessible name, also used as the native tooltip. |
pressed | boolean | No | - | Toggle state for stateful actions such as thumbs up. |
MessageAction / MessageCopyAction
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
label | string | Yes | "Copy message" | Required accessible name and tooltip (MessageAction). |
pressed | boolean | No | - | Sets aria-pressed for toggles such as thumbs up. |
value | string | - | - | Text written to the clipboard (MessageCopyAction). |
onCopy | (value: string) => void | - | - | Fires after a successful copy. |
Source
Import directly from the package or browse the source on GitHub. Click any file to view it.
Import
import { Message } from "@glinui/ui"Source Files
Dependencies
@glinui/ui@phosphor-icons/reactGenerated API Snapshot
Beta
Generated API Snapshot
BetaAuto-extracted from TypeScript source in packages/ui/src/components/message.tsx. This section is in beta and may lag behind hand-curated docs. Regenerate with pnpm --filter @glinui/docs api:generate.
Generated: 2026-10-08T01:41:21.546Z · Full index: /docs/api-metadata
Primary Props Type
MessageProps
MessageActionProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
label | string | Yes | "Copy message" | Accessible name, also used as the native tooltip. |
pressed | boolean | No | - | Toggle state for stateful actions such as thumbs up. |
MessageAvatarProps
No explicit fields extracted for this props type.
MessageContentProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
actions | React.ReactNode | No | - | Rendered under the bubble, typically `MessageActions`. |
bare | boolean | No | false | Render children without a bubble (plain assistant prose). |
MessageCopyActionProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
label | string | No | "Copy message" | - |
onCopy | (value: string) => void | No | - | - |
pressed | boolean | No | - | Toggle state for stateful actions such as thumbs up. |
resetAfter | number | No | 1500 | How long the success state shows, in ms. |
value | string | Yes | - | - |
MessageProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
grouped | boolean | No | false | Stacked message from the same sender: tighter spacing and corners. |
role | MessageRole | No | "assistant" | - |
variant | BubbleVariant | No | - | Surface treatment passed down to the assistant bubble. Omit for the ambient design style (glinr by default). Vocabulary: glinr, solid, plain, soft, outline, ghost, gradient, glass. User messages stay solid accent unless a bubble sets its own variant. |