Message.
Who said it, and what you can do with it.
One turn in a conversation: an article named for its author, an optional avatar, the body, and a row of actions. User messages sit in a bubble on the right; assistant replies flow as plain text.
Make it yours
Preparing the example…
Composition
Anatomyvariant defaults from the author: contained for user, flat otherwise. Actions are a toolbar, so a long transcript costs one Tab stop per message.
Message.Root (from, variant) — article aria-label="You" | "Assistant"
├── Message.Avatar — decorative Avatar
├── Message.Content — bubble or flat text
└── Message.Actions — Base UI Toolbar
└── Message.Action (label) — IconButton + TooltipA place to start
UsageImport the stylesheet once at your application root. This complete example reflects the properties selected above.
Loading example…
Details that make a difference
Examples & statesVisual treatments
Emphasis changes presentation while the primitive keeps behavior.
Loading source…
The finer details
API referenceGenerated from Dixy’s local TypeScript interfaces. Native HTML attributes and refs are forwarded. The table covers Dixy’s own options.
MessageRoot
| Prop | Type / description | Default |
|---|---|---|
from* | "system" | "user" | "assistant"Who wrote it. Sets alignment, the default surface and the accessible name. | — |
variant | "flat" | "contained"How the body sits. "contained" is a bubble; "flat" is plain flowing text, the usual choice for long assistant replies. | contained for user, flat otherwise |
aria-label | stringAccessible name of the message, read when moving between messages. | "You" for user, "Assistant" for assistant, "System" for system |
MessageAvatar
| Prop | Type / description | Default |
|---|---|---|
src | stringImage URL. | — |
fallback | ReactNodeInitials or an icon while the image loads or when it is missing. | — |
MessageActions
| Prop | Type / description | Default |
|---|---|---|
aria-label | stringAccessible name of the toolbar. | Message actions |
MessageAction
| Prop | Type / description | Default |
|---|---|---|
label* | stringThe action's name: its accessible name and its tooltip. | — |
tooltip | booleanShow the label as a tooltip on hover and focus. | true |
aria-pressed | booleanThe pressed state for toggles such as "Good response". | — |
children* | ReactElement | ReactNode | — |
Built from the same foundations
Styling tokensChange Theme settings above to compare appearance, accent, neutral, radius, spacing density, motion and direction. Override component aliases on a Theme root so custom properties follow portaled content too. The wrapper merges className, style, refs and render composition with its owning primitive.
| Token | Purpose |
|---|---|
--dixy-color-background-action-primary-subtle | The component-specific starting point. |
--dixy-font-label-md | Control label font and line height; body roles remain readable in text inputs. |
--dixy-color-background-selected | Selected surfaces use semantic color across appearances. |
--dixy-color-border-focus | Focus indication remains visible independently of shadows. |
--dixy-spacing-inset-sm | Density-aware component padding. |
--dixy-motion-transition-feedback | Short state feedback, reduced by the inherited motion setting. |
Consider everyone
AccessibilityEach message is an article whose name says who wrote it, so screen reader users can move between turns. The avatar is hidden because the name already identifies the author. Every action has a label that is both its accessible name and its tooltip; toggles such as Good response use aria-pressed.
Target: WCAG 2.2 AA. Automated tests cover selected behavior; manual screen-reader, contrast, and zoom validation remain part of the release checklist.
Build it. Then understand it.
A Toolbar is the right container when the same set of actions repeats many times: roving focus keeps the Tab sequence short without hiding anything.
--dixy-color-background-action-primary-subtle