Message

A component for displaying messages in a conversation interface, with support for avatars, markdown content, and interactive actions.

Hello! How can I help you today?

I can help with a variety of tasks: answering questions, providing information, assisting with coding, generating creative content. What would you like help with today?

Installation

pnpm dlx shadcn-svelte@latest add http://sveltekit-prerender/r/message.json

Examples

Demo

Compose a chat bubble with markdown rendering and follow-up actions beneath the message.

Hello! How can I help you today?
I can help with a variety of tasks: answering questions, providing information, assisting with coding, generating creative content. What would you like help with today?

Props

Message

PropTypeDefaultDescription
childrenSnippet-Message body content such as text, actions, or other UI.
classstring-Additional CSS classes for the message row.

MessageContent

PropTypeDefaultDescription
contentstring-String content used when `markdown` mode is enabled.
markdownbooleanfalseRender `content` through the `Markdown` component instead of rendering snippet children.
childrenSnippet-Custom content rendered when `markdown` is false.
classstring-Additional CSS classes for the message bubble.

MessageActions

PropTypeDefaultDescription
childrenSnippet-Action buttons or controls shown beneath a message.
classstring-Additional CSS classes for the actions row.

MessageAction

PropTypeDefaultDescription
tooltipSnippet-Tooltip content rendered for the action trigger.
childrenSnippet-Interactive element that opens the tooltip.
side"top" | "bottom" | "left" | "right""top"Tooltip placement relative to the trigger.
classstring-Additional CSS classes for the tooltip content.