Raft Design System

Components · Overlays

PreviewCard

The read-only card that appears when people hover over or focus a mention, a name or an app link, showing who someone is or what an app's item is, with up to two small buttons.

StableAlso called Profile card, Hover card, Item card
import { PreviewCard } from "@botiverse/raft-ui";

A preview card is the read-only card that appears when people hover over or focus something in the text, so they can see what it is without leaving the conversation. It has two uses: the profile card of a person or an agent, on a mention or a name such as @Bugen, with the avatar, the name and a status line; and the item card of an app link, such as a pull request a message links to, with its title and the details the app supplies. Either holds up to two small buttons. Raft Chat's profile card has no buttons (Raft Chat).

preview-card/preview-card-mention

When to use

SituationUse
A person or an agent, on hoverPreviewCard, as a profile card
An item an app links to, on hover over its chipPreviewCard, as an item card (Item card)
One sentence about something, on hoverTooltip
A choice or a field, on clickPopover
The full profile, kept openThe profile page or side panel

Which overlay fits which job is in Choosing a component.

Anatomy

  • PreviewCard: the root. Required.
  • PreviewCardTrigger: the mention, name or chip that opens the card, usually a link to what it names. Required.
  • PreviewCardContent: the card, portaled and positioned under the trigger: 300px wide for a profile, and 400px with size="item" for an item card, which has a title, a state and buttons to fit. Choose by what the card shows, not by its parts: a card that shows an item (its title, with a state or details) is size="item"; a card that asks for one step, such as connecting an account, keeps the default 300px, even when it uses PreviewCardBody for its sentence; it then takes the body's 12px inset and its title the card title's size, like the item card it leads to. Required.
  • PreviewCardHeader: the large Avatar and, beside it, the name and the line under it.
  • PreviewCardTitle: the name, on one line; in PreviewCardBody, an item's title, the title of a card in a message, which wraps.
  • PreviewCardSeparator: the hairline under the header.
  • PreviewCardSubtitle: the status line, data about the subject, one line, truncated. It was PreviewCardDescription.
  • PreviewCardArrow: an optional pointer toward the trigger, on whichever side the card opens, like PopoverArrow. The card clips what overflows it, so a card with an arrow lets it overflow (overflow-visible).
  • PreviewCardPortal and PreviewCardPopup: lower-level parts. PreviewCardPopup is the card surface without positioning.

The item card adds these parts, experimental and exported from @botiverse/raft-ui/wip until the design is approved:

  • PreviewCardBody: the block with the id line, the title and the details row, 12px from the card's edges. The card is a column of its parts capped at the room it has (--available-height); past that the body scrolls, faded at its cut edges, while the header, the actions and the footer keep their height, as PopoverBody does. Its parts, the actions and the footer are a card's in a message (Cards in messages), so the hover card and the block card (AppLinkCard) stay alike.
  • PreviewCardEyebrow: the id line above the title, in foreground-muted Space Mono, one line, truncated.
  • PreviewCardMeta: the row under the title: the state, in a neutral Badge or in the app's color when it sends one, then a muted line of details. It wraps when it runs out of room.
  • PreviewCardActions: one row of up to two buttons at the card's end, 12px from its edges as in a card in a message: the confirm button last. A third action goes in a More menu (⋯) the app's card supplies; a status line beside the buttons wraps onto its own line before they do (Buttons).
  • PreviewCardFooter: a caption under a hairline at the bottom: the app and the host.

Item card

The card an app link opens on hover (App links). The app supplies its words and which details it has; Raft sets their order and their colors. Its parts follow the questions a reader asks, in order:

  1. Which item is it? PreviewCardEyebrow: the app's id for it, such as botiverse/slock#10449. Optional.
  2. What is it about? PreviewCardTitle: the app's title in ink, up to 2 lines, cut off with an ellipsis; only when it is cut off, the app wraps it in a Tooltip that shows it whole on hover (not a native title); PreviewCardTitle doesn't add one itself. Always in ink, not in foreground-link. On desktop and phone web the card is not a link itself, its buttons and the chip are; in the iOS and Android apps the title opens the item, because there the card covers the chip (App links).
  3. Where does it stand? PreviewCardMeta: one state chip in the app's words, such as Merged, in the app's color when it sends one, then one muted line of details, such as "Martin · +803 −498". Separate the details on one line with "·", but put none next to the state chip: the chip is set apart by its own fill.
  4. What can I do? PreviewCardActions: up to two buttons the app provides, on one line at the card's end:
    • The app's action buttons (Approve), the first two in the app's order. With none, the first link (Open in Stamp ↗) takes the row instead. In the iOS and Android apps, where the title opens the item, the link to the item goes in ⋯ and never takes the row (App links).
    • Frameless buttons first, the bordered one last, at the right end.
    • Everything else, such as Refresh, further links and any further action, goes in a More menu (⋯) to the left of them, in the app's order, never wrapped onto a second line and never dropped. A link in the menu is a link item with the leaving mark (↗). The menu opens aligned to its button's end (align="end"), so it stays over the card.
    • While one of the app's actions runs, the row's buttons and the menu's items are disabled; the More button stays enabled, so people can still see what is in it. A status line with a Spinner says so, placed beside the buttons as in Cards in messages. Raft writes it, not the app, and in words that aren't a task status: "Working…", never In progress, since nothing on an item card carries a task's meaning (Rules). A menu item the app has disabled shows the app's reason as its second line, since a menu item has no tooltip (DropdownMenu).
    • An action that asks to be confirmed opens a Dialog at size="sm" outside the card: a hover card closes when the pointer leaves it, so the confirmation can't live inside it. What the confirmation says and how its button is colored is in Feedback; what Raft adds for an app it hasn't reviewed is in AppLinkCard.
    • This is how the web app behaves, with no example here yet: slock's packages/web/src/components/message/LinkCardActions.tsx draws the status line (LinkCardActions), the disabled item's reason (LinkCardMenuItem) and the confirmation (LinkCardConfirmDialog). Two parts of it don't match this page yet: the confirmation is still an AlertDialog, and the status line says "In progress" while an action executes.
  5. Who says so? PreviewCardFooter: the app's name and the link's host, "Stamp · stamp.build". In the iOS and Android apps the name is led by the app's 16px icon, the chip's, 4px before it: there the card covers the chip that shows the icon on desktop.
preview-card/preview-card-app-item

Before the reader has allowed the app, the chip stays gray with its address and has no card: a card is read-only, and its buttons can't be reached by keyboard or touch. Clicking, tapping or pressing Enter on the chip opens a Popover that asks instead, the same on every device: a question as the title, a sentence on what allowing it does, Open link to go without previews, and Show previews. It is a popover about the item (size="item", Popover): 400px, with the item card's 12px inset and title, so the question looks like the card it leads to (stdrc, 2026-11-10). A profile card is about a person, not an item, and keeps its 16px.

preview-card/preview-card-app-prompt

Behavior

  • The card opens almost as soon as the pointer rests on the trigger, and closes shortly after it leaves. The delays are shorter than Base UI's, so dense messages full of mentions don't feel slow.
  • It also opens when the trigger takes keyboard focus.
  • It opens under the trigger, aligned to its start edge, and moves or flips at the window edge (Elevation).
  • It keeps clear of the frame insets: where a shell keeps part of the window for itself (--raft-frame-inset-top, --raft-frame-inset-start, --raft-frame-inset-end), it stops 8px from that part, not from the window's edge. The start and end insets are the corners of the top band, so they count only when its trigger is in the band; under it, it keeps its own padding from the window's edge (Page structure). The web sets none.

Content

  • For an agent, say first what it is doing now, then who it is: "Reviewing #25" with its presence light, then its role and where it runs.
  • For a person, show their role and their local time.
  • On an item card, show the app's words as it sends them; leave out a part the app doesn't send rather than filling it with Raft's own.
  • Use sentence case on the buttons: Message, View profile, Open in Stamp.

Accessibility

  • PreviewCard wraps the Base UI PreviewCard. It opens on hover and on focus of the trigger, and closes on Esc.
  • On desktop and phone web the card is supplementary and doesn't open on touch, and its buttons can't be reached from the keyboard: focus moves on from the trigger, and the card closes. Make the trigger a real link, to the profile or to the app's item, so everything on the card is reachable another way: a button on an item card is a shortcut to something on the page the link opens, such as View changes on a pull request. The iOS and Android apps open an app link's card on a tap instead (App links).

Rules

  • Keep the card read-only: no fields, no choices. Something people fill in is a Popover.
  • Put at most two small buttons on it, on one row: never pink, the confirm button in ink-border (variant="outline") and the other frameless, as in a card in a message (Cards in messages).
  • Show the item's state once, in the app's own words, in a neutral Badge (appearance="soft"): none of Raft's status colors and no status light. Which states an item has, and what they mean, is the app's concept, not Raft's; Raft's status colors and the status light mean task and presence states (Status), so mapping an app's "Merged" onto a task's "done" would put Raft's reading on the app's word.
  • When the app sends a color for the state, the badge takes it: AppLinkCardBadge with fill and surface="popover", the same badge and the same rules as on the app's card in a message (AppLinkCard). The color is the app's own word for its state, and the card says whose it is in its footer. An app that only sends hover cards, as Stamp does for a pull request, would otherwise have no place to show the color at all: until 2026-11-14 only the card in a message took it, and no Stamp link showed one (#proj-apps:#51).
  • A line the app marks as a warning (tone: "warning", such as "2 checks failing") reads in warning-strong, as raft-ui's own warning lines do. This is Raft's color for a warning, not the app's for a state: the state's Badge takes only the app's own color, and nothing else on the card is colored.
  • Put no other colors of the app's on an item card: no brand color, no colored header. The app's icon, on the chip and in the apps' footer, and the fill of its state badge are the only marks of its own.

API

PreviewCard

PropTypeDefault
actionsRefA ref to imperative actions. - `unmount`: Ends the closing phase of the preview card after an externally controlled closing animation finishes. Call `preventUnmountOnClose()` in `onOpenChange` first, otherwise the preview card completes closing on its own. Whether it leaves the DOM is decided by `keepMounted` on the portal. - `close`: Closes the preview card imperatively when called.RefObject<PreviewCardRootActions | null>
childrenThe content of the preview card. This can be a regular React node or a render function that receives the `payload` of the active trigger.ReactNode | PayloadChildRenderFunction<unknown>
defaultOpenWhether the preview card is initially open.booleanfalse
defaultTriggerIdID of the trigger that the preview card is associated with. This is useful in conjunction with the `defaultOpen` prop to create an initially open preview card.string
handleA handle to associate the preview card with a trigger. If specified, allows external triggers to control the card's open state. Can be created with the PreviewCard.createHandle() method.BasePreviewCard.Handle<unknown>
onOpenChangeEvent handler called when the preview card is opened or closed.(open: boolean, eventDetails: BasePreviewCard.Root.ChangeEventDetails) => void
onOpenChangeCompleteEvent handler called after any animations complete when the preview card is opened or closed.(open: boolean) => void
openWhether the preview card is currently open.boolean
triggerIdID of the trigger that the preview card is associated with. This is useful in conjunction with the `open` prop to create a controlled preview card. There's no need to specify this prop when the preview card is uncontrolled (that is, when the `open` prop is not set).string

PreviewCardArrow

PropTypeDefault
renderAllows 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.

PreviewCardContent

PropTypeDefault
portalPropsPreviewCardPortalProps
size`item` for an app's item card (a title, a state and buttons): 400px instead of a profile's 300px. Choose it by what the card shows, not by its parts."item" | "profile""profile"
alignHow to align the popup relative to the specified side.Align"start"
alignOffsetAdditional offset along the alignment axis in pixels. Also accepts a function that returns the offset to read the dimensions of the anchor and positioner elements, along with its side and alignment.number | OffsetFunction0
anchorAn element to position the popup against. By default, the popup will be positioned against the trigger.Element | VirtualElement | RefObject<Element | null> | (() => Element | VirtualElement | null)
arrowPaddingMinimum distance to maintain between the arrow and the edges of the popup.number5
collisionAvoidanceDetermines how to handle collisions when positioning the popup.CollisionAvoidance
collisionBoundaryAn element or a rectangle that delimits the area that the popup is confined to.Boundary'clipping-ancestors'
collisionPaddingAdditional space to maintain from the edge of the collision boundary.Padding5
disableAnchorTrackingWhether to disable the popup from tracking any layout shift of its positioning anchor.booleanfalse
positionMethodDetermines which CSS `position` property to use."fixed" | "absolute""fixed"
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)
sideWhich side of the anchor element to align the popup against. May automatically change to avoid collisions.Side"bottom"
sideOffsetDistance between the anchor and the popup in pixels. Also accepts a function that returns the distance to read the dimensions of the anchor and positioner elements, along with its side and alignment.number | OffsetFunction6
stickyWhether to maintain the popup in the viewport after the anchor element was scrolled out of view.booleanfalse

Also takes the attributes of its element.

PreviewCardSubtitle, PreviewCardHeader, PreviewCardPopup

Takes the attributes of its element.

PreviewCardPortal

PropTypeDefault
containerA parent element to render the portal element into.HTMLElement | ShadowRoot | RefObject<HTMLElement | ShadowRoot | null>
keepMountedWhether to keep the portal mounted in the DOM while the popup is hidden.booleanfalse
renderAllows 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.

PreviewCardSeparator, PreviewCardTitle

Takes the attributes of its element.

PreviewCardTrigger

PropTypeDefault
closeDelayHow long to wait before closing the preview card. Specified in milliseconds.number40
delayHow long to wait before the preview card opens. Specified in milliseconds.number80
handleA handle to associate the trigger with a preview card.BasePreviewCard.Handle<unknown>
payloadA payload to pass to the preview card when it is opened.{}
renderAllows 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.

PreviewCardActions

ExperimentalThe row of at most two buttons.

Takes the attributes of its element.

PreviewCardBody

ExperimentalThe item card's block: the id line, the title and the details row, in that order. Its parts are a card's in a message (AppLinkCard), so the two read the same. It scrolls when the card runs out of room (the popup is a flex column capped at `--available-height`): a ScrollArea that shrinks while the actions and the footer keep their height, with its edges faded. `className` is the content's, as before it scrolled; `scrollClassName`, `ref` and the native props are the scroller's.
PropTypeDefault
scrollClassNameClasses for the scroller around the body's content (`className` is the content's).string

Also takes the attributes of its element.

PreviewCardEyebrow, PreviewCardFooter, PreviewCardMeta

ExperimentalThe muted line above the title that identifies the item, such as its id. One line, truncated.

Takes the attributes of its element.

Changes

  • 0.106.0 · Design SystemLong menus and popovers scroll inside the room they have ([DropdownMenu › Long menus](https://raft-design.botiverse.build/components/dropdown-menu/#long-menus), [Popover › A long popover](https://raft-design.botiverse.build/components/popover/#a-long-popover), [Elevation › Popups](https://raft-design.botiverse.build/foundations/elevation/#popups)): a popup is capped at the space left between its trigger and the window's edge, and what doesn't fit scrolls inside it, never clipped. The highlighted item of a menu stays in view and clear of the fade; the cut edges fade over up to 24px; an action on the whole list stays below the items (DropdownMenuPinnedFooter); a popover keeps its header and buttons and scrolls its body. Changed in this release: DropdownMenuContent, ContextMenuContent, PopoverContent, PopoverBody, PreviewCardContent, PreviewCardBody.
  • 0.106.0 · ChangedPopoverContent, PreviewCardContent: the panel is a flex column (flex flex-col), and PopoverHeader, PopoverSeparator, PopoverActions, PreviewCardHeader, PreviewCardSeparator, PreviewCardSubtitle, PreviewCardActions and PreviewCardFooter don't shrink. PopoverBody and PreviewCardBody are a ScrollArea (min-h-0, faded edges, overscroll="contain"): they scroll when the panel is capped, and are a tab stop while they overflow.
  • 0.103.4 · FixedFrame insets (Popover, DropdownMenu, ContextMenu, Select, Combobox, ComboboxSelect, Tooltip, PreviewCard, CoachMark, NotificationCenter, MobileNavServerPopover, ToastPositioner, ComposerSuggestionList): --raft-frame-inset-start and --raft-frame-inset-end are the corners of the window's top band (--raft-frame-inset-top), not columns down its sides. A popup anchored under the band keeps its own padding from the window's edge; only one anchored in the band (a title-bar control, or a context menu opened in the bar) keeps 8px clear of a corner.
  • 0.103.3 · FixedFrame insets (useFrameInsets, frameCollisionBoundary): opening a positioned popup (Popover, DropdownMenu, Select, Combobox, ComboboxSelect, ContextMenu, Tooltip, PreviewCard, NotificationCenter, MobileNavServerPopover, ComposerSuggestionList) no longer stalls the main thread when --raft-frame-inset-* holds a calc() or env(titlebar-area-*) expression on an overlay title bar.
  • 0.103.0 · Breaking ChangesData parts named for what they hold: SearchEntityResultDescription → SearchEntityResultSubtitle, PreviewCardDescription → PreviewCardSubtitle, TaskCardDescription → TaskCardSubtitle, MobileNavServerPopoverRowDescription → MobileNavServerPopoverRowSubtitle (and their …Props types), and Step's description prop → subtitle. Their look and data-slot values are unchanged.
  • 0.102.0 · FixedPopoverArrow and PreviewCardArrow point at their trigger on every side ([Popover › Anatomy](https://raft-design.botiverse.build/components/popover/#anatomy)). They sat at the panel's top whichever side it opened on, so they pointed the right way only for a panel below its trigger; they now sit on the edge facing the trigger, with the seam on their two outer edges, and inline-start and inline-end follow the writing direction.
  • 0.102.0 · FixedOn inline-start and inline-end, PopoverArrow and PreviewCardArrow follow the direction Base UI placed the panel by ([Popover › Anatomy](https://raft-design.botiverse.build/components/popover/#anatomy)). They set data-dir from Base UI's DirectionProvider (ltr without one) and draw by it, not by the page's dir: on a dir="rtl" page with no provider, Base UI puts an inline-end panel on the right, and the arrow drawn by the page's direction faced away from the trigger. A panel with an arrow still clips it unless the panel has overflow-visible.
  • 0.99.0 · AddedAppLinkCardBadge takes surface="popover" for the hover card an app link opens ([AppLinkCard › The app's color](https://raft-design.botiverse.build/components/app-link-card/#the-apps-color), [PreviewCard › Item card](https://raft-design.botiverse.build/components/preview-card/#item-card)). The app's color for an item's state is now drawn on the hover card too: put <AppLinkCardBadge fill={color} surface="popover"> in its PreviewCardMeta. surface only chooses the surface the hairline ring is decided against (layer-popover in place of layer-card, which differ in dark mode); the default, card, is the card in a message.