Skip to content
Sign upPro
ComposerMultimodal trayMenu

Multimodal tray (Pro)

ProIncluded in $99

Camera, screen, file, voice and a sketch pad in one tray that opens from the composer, with everything attached shown as previews above the text.

ProA café owner adds a counter photo, a voice note and a price list from one tray, then asks for the autumn board.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/multimodal-tray

Needs chatcn Pro

This command works with a Pro license, along with every Pro component.

Or start free: sign up and get three Pro components on us, with a new one every month.

Usage

tsx
import { MultimodalTray } from "@/components/ui/chatcn/pro/multimodal-tray"

<MultimodalTray
  items={items}
  onItemsChange={setItems}
  onPick={(kind) => capture(kind)}
  onFiles={(files) => upload(files)}
  onSubmit={({ text, items }) => send(text, items)}
/>

The + in the toolbar opens one tray for every way in, and turns into a close mark while it is open. Arrow keys move across the five inputs and 1 to 5 pick directly. Camera, screen and voice call onPick so your app captures with the APIs it already uses; File also opens the composer's file picker when onFiles is set; Sketch opens a pad inside the tray, so a quick diagram never leaves the composer, and attaches it as an SVG image in the pad's own colors. Everything attached sits above the text in one scrolling row: photos, screens and sketches as thumbnails, files as cards with upload progress and errors, voice notes with their waveform and a play button. Inputs that cannot work here (screen capture on a phone) stay visible, dimmed, with the reason. Attached items count as content, so Send works without text.

Examples

Sketch pad

ProThe tray open on its sketch pad. Draw, undo with Cmd Z, and attach the drawing as an image.

States

ProNothing attached, one of each kind, uploading and failed, an input unavailable on a phone, streaming and disabled.

Props

PropTypeNotes
items, defaultItems, onItemsChangeTrayAttachment[]{ id, kind, name, previewUrl?, size?, type?, duration?, peaks?, status?, progress?, error? }
kindsTrayKind[]Which inputs the tray offers, in order. Default all five
unavailablePartial<Record<TrayKind, string>>Inputs that cannot be used here, with the reason
onPick(kind: "camera" | "screen" | "file" | "voice") => voidCapture is yours; add the result to items
onSketch({ svg, url, width, height }) => voidA sketch was attached. Uncontrolled, it is added for you
defaultSketch[number, number][][]Strokes already on the pad
trayOpen, onTrayOpenChangebooleanThe tray, controlled
onSubmit({ text, items }) => void
value, defaultValue, onValueChangestringThe draft, controlled or not
status, onStop"idle" | "submitting" | "streaming", () => voidSend becomes Stop in the same footprint
disabledboolean
tools, actionsReactNodeAfter the +, and before Send
labelsPartial<MultimodalTrayLabels>Every string, for translation
...PromptInputPropsonFiles, accept, maxFiles and the rest pass through

Keyboard

KeyAction
Enter or Space on +Open the tray, focus on the first input
Left, Right, Home, EndMove between inputs
1 to 5Pick an input directly
Cmd Z or Ctrl ZUndo the last stroke on the sketch pad
EscapeClose the tray, focus back in the message

Accessibility

  • The inputs are a toolbar with one tab stop and roving focus; each has aria-keyshortcuts for its digit.
  • Unavailable inputs stay focusable with aria-disabled and the reason as their description.
  • The sketch pad is named with its stroke count; every pad action is a labelled button.
  • Voice notes play from a toggle button with aria-pressed; remove buttons name the item.

Motion

The tray opens from the + in 180 ms like every kit popover while the + turns 45 degrees into a close mark. New previews enter in 150 ms from 0.96 scale, removed ones leave in 140 ms. Reduced motion keeps the fades and drops the turn.