Components · Messages
MessageForwardedBundle
A card under a message that holds one or more messages forwarded from another conversation, with their authors, times and attachments, folded when it runs long.
Also called Forwarded message, Forwarded bundle
import { MessageForwardedBundle } from "@botiverse/raft-ui";A card with the messages someone forwarded: a Forwarded header with the count and where they came from, then each message with its author, time, text and attachments. It is built on MessageEmbed and sits in MessageItemEmbedded, under the body of the message that forwarded it (MessageItem). Long bundles fold on their own.
When to use
Anatomy
MessageForwardedBundle: the card. Required.MessageForwardedBundleHeader: the top row; it wraps on a narrow column. Required.MessageForwardedBundleHeaderContent, withMessageForwardedBundleHeaderLabel(an icon and Forwarded) andMessageForwardedBundleHeaderCount(in Space Mono,foreground-hint).- The source, at the end of the row:
MessageForwardedBundleSourcewhen it can be opened,MessageForwardedBundleSourceLabelwhen it can't. Optional.
MessageForwardedBundleItems: the list of messages, and the part that folds. Required.MessageForwardedBundleItem: one forwarded message. At least 1.MessageForwardedBundleItemMeta:MessageForwardedBundleItemAuthor, then the time in Space Mono.MessageForwardedBundleItemContent: the text. Required: the fold measures only this part.MessageForwardedBundleAttachments:MessageForwardedBundleAttachmentchips (MessageForwardedBundleAttachmentName,MessageForwardedBundleAttachmentMeta), andMessageForwardedBundleGallerywith aMessageForwardedBundleGalleryTileper image. Optional.
MessageForwardedBundleFooterwithMessageForwardedBundleFooterAction: the action that unfolds the list. Optional.
Variants
Behavior
- The card is a content card (
MessageEmbed size="content"): at most 560px wide, and narrower when the column is (Cards in messages). - By default the bundle folds itself: when the text of all items together runs past
foldLineLimitlines (8), the list is cut at that height and fades out at the bottom over the content fade, 48px, as a mask (mask-fade-b), so a row's fill fades with it; a fold under 60px fades over the edge fade, 24px, so one line stays readable (Edges fade). - The footer shows only while the list is folded. Its action unfolds the list and folds it again;
expandedContentis its label while unfolded. - The bundle measures again when content arrives or the width changes. Once the person has folded or unfolded it, it stays as they left it, unless the content no longer needs folding.
- Pass
collapsedtoMessageForwardedBundleItemsto control the fold yourself, as a detail view that shows everything does. The footer then always renders, and you label it. - To make the footer action open a detail view instead of unfolding, call
preventDefaultin itsonClick. MessageForwardedBundleGallerylays images in rows of 3, and 4 images as 2 rows of 2, at the sizes of a message's own gallery (MessageAttachment). Below 360px of the gallery's own width a row of 3 is 2 across, by the card's width rather than the window's (Switch on the region's width). Put it in a parent with a definite width (a block, a stretched flex or grid item, or a set width), not one that shrinks to its content (inline-block,w-fit, an absolutely positioned box or floating layer with no width, a flex item withflex-basis: autoand no width): as its own container it takes no width from what it holds and would collapse to nothing.
Content
- Label the header Forwarded, and give the count in Space Mono: "3 messages".
- Write the source as "from #launch-week", with "· thread" when it is a thread.
- Show a source only when the person may see it; leave it out for a direct message, a private channel or a missing source.
- Name each author by their display name, not a handle (Writing).
- Label the footer action with what it does, in sentence case: Show all 6 messages, then Collapse.
- Give each attachment chip its file name and type: "release-notes.md · markdown".
- An attachment chip takes 5.5px before its icon and 6.5px after its text, 12px in all as before: a file icon is drawn 1.75px inside its box, so its ink and the last letter both sit about 7.2px from the edges (Alignment).
Accessibility
- The parts are plain elements built with Base UI
useRender; eachMessageForwardedBundleItemis an<article>. MessageForwardedBundleSourceis a<button>. When it navigates, render it as an<a>with anaria-labelthat names the place: "Open source thread in #launch-week".- While the bundle owns the fold,
MessageForwardedBundleFooterActionsetsaria-expanded. Withcollapsed, set it yourself. - Put each item's time in a
<time>element with itsdateTime. interactiveonMessageForwardedBundleAttachmentonly adds the hover and focus look. Render the chip as a<button>or<a>that opens the file, with anaria-labelsuch as "Open release-notes.md".- Give gallery images an
altas in MessageAttachment.
Rules
- Wrap each item's text in
MessageForwardedBundleItemContent: text outside it isn't measured, and the bundle won't fold. - Don't render a bundle with no items.
API
MessageForwardedBundle
Also takes the attributes of its element.
MessageForwardedBundleAttachment
Also takes the attributes of its element.
MessageForwardedBundleAttachmentMeta, MessageForwardedBundleAttachmentName, MessageForwardedBundleAttachments, MessageForwardedBundleFooter, MessageForwardedBundleGallery, MessageForwardedBundleGalleryTile, MessageForwardedBundleHeader, MessageForwardedBundleHeaderContent, MessageForwardedBundleHeaderCount, MessageForwardedBundleHeaderLabel, MessageForwardedBundleItem, MessageForwardedBundleItemAuthor, MessageForwardedBundleItemContent, MessageForwardedBundleItemMeta
Also takes the attributes of its element.
MessageForwardedBundleItems
The items surface. Without a `collapsed` prop the fold is component-owned: the surface measures its item-content slots and collapses itself to `foldLineLimit` lines when the text renders beyond that many lines in total (eight by default). Passing `collapsed` switches to the controlled mode (the detail view pins everything open) and skips the measurement.
Also takes the attributes of its element.
MessageForwardedBundleSource, MessageForwardedBundleSourceLabel
Also takes the attributes of its element.
MessageForwardedBundleFooterAction
Also takes the attributes of its element.
Related
Changes
- 0.3.0 · Breaking ChangesRenamed
MessageForwardedBundleToggletoMessageForwardedBundleFooterAction, including its props type anddata-slot.