# 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.

Source: https://raft-design.botiverse.build/components/message-embed. Generated from the current release; where it differs from what you remember, this page is right.

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](https://raft-design.botiverse.build/components/message-attachment.md)) with the header of a message ([MessageItem](https://raft-design.botiverse.build/components/message-item.md)), and sits in `MessageItemEmbedded`, under the message body. [MessageForwardedBundle](https://raft-design.botiverse.build/components/message-forwarded-bundle.md) and [MessageActionCard](https://raft-design.botiverse.build/components/message-action-card.md) render on it, and [MessageReplies](https://raft-design.botiverse.build/components/message-replies.md) 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](https://raft-design.botiverse.build/components/message-forwarded-bundle.md)                                                                        |
| A link to one message, shown as an excerpt    | [MessageQuotedPreview](https://raft-design.botiverse.build/components/message-quoted-preview.md)                                                                              |
| An agent needs a person's approval            | [MessageActionCard](https://raft-design.botiverse.build/components/message-action-card.md)                                                                                       |
| A file, an image or a video                   | [MessageAttachment](https://raft-design.botiverse.build/components/message-attachment.md)                                                                                         |
| The replies to a message                      | [MessageReplies](https://raft-design.botiverse.build/components/message-replies.md)                                                                                                  |
| Code, a diagram or a Markdown table           | [CodeBlock](https://raft-design.botiverse.build/components/code-block.md)                                                                                                                 |
| A new kind of embedded card                   | MessageEmbed as its base, not a new container ([Composites](https://raft-design.botiverse.build/patterns/composites.md#link-cards-forwarded-messages-quoted-previews)) |

## Anatomy

- `MessageEmbed`: the card, on `layer-card` with a `line-hairline` border and `radius-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](https://raft-design.botiverse.build/foundations/states.md#focus)).

## Accessibility

- `MessageEmbed` and its parts are plain `div` elements built with Base UI `useRender`; use `render` to change the element.
- When the whole card opens something, render `MessageEmbed` as 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](https://raft-design.botiverse.build/components/message-attachment.md#accessibility).

## Rules

- Build every embedded card on MessageEmbed, without new colors, shapes or lines ([Composites](https://raft-design.botiverse.build/patterns/composites.md)).
- Put the card in `MessageItemEmbedded`, after the body and the attachments.

## API

### MessageEmbed

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `render` | `ReactElement \| ((props, state) => ReactElement)` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component. |

Also takes the attributes of its element.

### MessageEmbedContent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `render` | `ReactElement \| ((props, state) => ReactElement)` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component. |

Also takes the attributes of its element.

### MessageEmbedFooter

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `render` | `ReactElement \| ((props, state) => ReactElement)` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component. |

Also takes the attributes of its element.

### MessageEmbedHeader

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `render` | `ReactElement \| ((props, state) => ReactElement)` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component. |

Also takes the attributes of its element.
