Message
Shows one turn of a conversation, from the user or from the assistant, with its actions.
Configurations
Supported configurations for this component.
Default
Interaction states covered by the API and the style contract.
Configurations
3 examplesDefault
1 exampleAdd to your project
One command adds this component to your project.
Run the following command. New project? Run npx shadcn@latest init first to set up Tailwind and path aliases.
npx shadcn@latest add @aicanvas/••••••••••••Light and dark both come with the install and follow the dark class on <html>, the shadcn dark mode setup (next-themes with attribute="class").
Props
Every prop this component accepts. Any other prop is forwarded to the underlying element.
Message
| Prop | Type | Default | Description |
|---|---|---|---|
| fromreq | 'user'|'assistant' | - | Who spoke. user: bubble on the right sized to its words, mark on the right. assistant: full-width panel on the left, mark on the left. |
| busy | boolean | false | The answer is still arriving: sets aria-busy on the turn, and MessageActions renders nothing until it settles. |
| children | React.ReactNode | - | A MessageAvatar, a MessageContent and an optional MessageActions, in any order. |
| className | string | - | Additional CSS classes applied to the root element. |
| style | React.CSSProperties | - | Inline styles applied to the root element. |
MessageAvatar
| Prop | Type | Default | Description |
|---|---|---|---|
| childrenreq | React.ReactNode | - | user: an Avatar at size="md". assistant: an 18px glyph (tokens.iconSize.md), e.g. the product mark. |
| framed | boolean | - | Draw the 32px box around the child: a border.base hairline, text.secondary ink, the glyph centred. Defaults to true for the assistant and false for the user, whose Avatar brings its own frame. |
| className | string | - | Additional CSS classes applied to the root element. |
| style | React.CSSProperties | - | Inline styles applied to the root element. |
MessageContent
| Prop | Type | Default | Description |
|---|---|---|---|
| children | React.ReactNode | - | user: the words sent. assistant: the answer, any mix of prose, tables, artifacts, tool steps and suggestions, stacked spacing[3] apart. |
| className | string | - | Additional CSS classes applied to the root element. |
| style | React.CSSProperties | - | Inline styles applied to the root element. |
MessageActions
| Prop | Type | Default | Description |
|---|---|---|---|
| meta | React.ReactNode | - | Leading text, in text.muted: the time, or "time · duration", or "time · Stopped". |
| children | React.ReactNode | - | The actions: IconButtons at size="sm", variant="ghost". Pushed to the far end on an assistant turn, beside the meta on a user turn. |
| className | string | - | Additional CSS classes applied to the root element. |
| style | React.CSSProperties | - | Inline styles applied to the root element. |