Components · Content
MessageEmbed
The card that embedded message content is built on — a header, content and footer in a hairline card — used for link cards and as the base of forwarded bundles, action cards and reply summaries.
Also called Link card, Embed
import { MessageEmbed } from "@botiverse/raft-ui";The card for something embedded in a message: a link card, or the base that other embedded cards build on. It has the structure of a file card (MessageAttachment) with the header of a message (MessageItem), and sits in MessageItemEmbedded, under the message body. MessageForwardedBundle and MessageActionCard render on it, and MessageReplies uses its container.
When to use
| Situation | Use |
|---|---|
| A link to a page, previewed under the message | MessageEmbed, as a link card |
| Messages passed on from another conversation | MessageForwardedBundle |
| A link to one message, shown as an excerpt | MessageQuotedPreview |
| An agent needs a person's approval | MessageActionCard |
| A file, an image or a video | MessageAttachment |
| The replies to a message | MessageReplies |
| Code, a diagram or a Markdown table | CodeBlock |
| A new kind of embedded card | MessageEmbed as its base, not a new container (Composites) |
Anatomy
MessageEmbed: the card, onlayer-cardwith aline-hairlineborder andradius-container. Required.MessageEmbedHeader: the top row, with its own padding. Holds what the card is and where it comes from.MessageEmbedContent: the body. It has no padding of its own: the content inside sets it, so an image or a list of items can run to the card's edges.MessageEmbedFooter: the bottom row, padded like the header. Holds the card's actions.
Only MessageEmbed is required; use the parts the content needs.
Behavior
- The card and its parts can shrink below the width of their content, so long content wraps or truncates inside the card instead of widening the message.
- A card rendered as a link shows the focus ring on keyboard focus (States).
Accessibility
MessageEmbedand its parts are plaindivelements built with Base UIuseRender; userenderto change the element.- When the whole card opens something, render
MessageEmbedas an<a>and give it an accessible name that says what opens. - Don't put a button inside a card rendered as a link: each control must be its own element, as in MessageAttachment.
Rules
- Build every embedded card on MessageEmbed, without new colors, shapes or lines (Composites).
- Put the card in
MessageItemEmbedded, after the body and the attachments.
API
MessageEmbed, MessageEmbedContent, MessageEmbedFooter, MessageEmbedHeader
| Prop | Type | Default |
|---|---|---|
| Allows you to replace the component's HTML element with a different tag, or compose it with another component. | ReactElement | ((props, state) => ReactElement) |
Also takes the attributes of its element.