Skip to content

Feature/prompt input pasted content preview#352

Open
unclebay143 wants to merge 6 commits intovercel:mainfrom
unclebay143:feature/prompt-input-pasted-content-preview
Open

Feature/prompt input pasted content preview#352
unclebay143 wants to merge 6 commits intovercel:mainfrom
unclebay143:feature/prompt-input-pasted-content-preview

Conversation

@unclebay143
Copy link
Contributor

@unclebay143 unclebay143 commented Feb 2, 2026

Closes: #333

1. Convert pasted text content into file attachment

Before:

image

After:

image

Preview on click with copy and download options

image

2. Fix existing attachment alignment

Before:

image

After

image

@vercel
Copy link
Contributor

vercel bot commented Feb 2, 2026

@unclebay143 is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

<div
className={cn(
"flex items-start",
"flex items-start w-full p-3",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Full width for items-start to work, and spacing to avoid cards touching edges

Image

<DropdownMenuItem
{...props}
onSelect={(e) => {
onSelect={(e: Event) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type fix

onRemove: () => void;
}

export const PromptInputPastedContentCard = ({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pasted context card

Image

// Attachments display (files + pasted content cards)
// ============================================================================

export const PromptInputAttachmentsDisplay = ({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consolidate the existing attachment and the pasted content card attachment to benefit from the existing controls and context

@shloimy-wiesel
Copy link

The code doesn't just display pasted text as a file card - it actually converts the pasted text into a real file attachment that gets submitted with the message.

Is this actually better than just displaying it as a card? Converting to a real file has some effects on prompting and file handling.

@haydenbleasel
Copy link
Member

@unclebay143 this is awesome! curious your thoughts on @shloimy-wiesel's comment.

Also, PromptInputPastedContentCard is quite pre-composed - we'll likely want to let the user compose this.

@unclebay143
Copy link
Contributor Author

The code doesn't just display pasted text as a file card - it actually converts the pasted text into a real file attachment that gets submitted with the message.

Is this actually better than just displaying it as a card? Converting to a real file has some effects on prompting and file handling.

this approach is following the same pattern as Claude and v0 (pasted long text as an attachment, see screenshot for pasted-text.txt in attachments).

Claude
image

V0
image

whether that’s “better” depends on how the backend handles attachments vs inline text, so I don't think we should be changing that by default.

however, to support both options, we can keep it composable via a pasteLongTextAs prop: file (current behavor) or text (merge into message.text).

but with text, the message will get long, so the UI would need something like “show more” for very long prompts.

@unclebay143
Copy link
Contributor Author

unclebay143 commented Feb 3, 2026

@unclebay143 this is awesome! curious your thoughts on @shloimy-wiesel's comment.

thanks @haydenbleasel, shared my thought here: #352 (comment)

Also, PromptInputPastedContentCard is quite pre-composed - we'll likely want to let the user compose this.

yes, I'm looking at making it composable by splitting it into 5 subcomponents so users can assemble their own layout and actions:

  • PromptInputPastedContentCard
  • PromptInputPastedContentCardTrigger
  • PromptInputPastedContentCardModal
  • PromptInputPastedContentCardCopyButton
  • PromptInputPastedContentCardDownloadButton

…asted-content-preview

Compose/feature/prompt input pasted content preview
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

custom styles through composable API

Image

</Suggestions>
<div className="w-full px-4 pb-4">
<PromptInput globalDrop multiple onSubmit={handleSubmit}>
<PromptInputHeader>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix weird space due to rendering PromptInputHeader even when there's no attachment

Image

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestion:

Double-wrapped PromptInputHeader in example files causes nested headers after internal component change

Fix on Vercel

<div
className={cn(
"flex items-start",
"flex items-start w-full",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Full width for items-start to work, and spacing to avoid cards touching edges

Image

);
};

const AttachmentsHeader = () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PromptInputHeader returns empty div, need to render it dynamically

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add preview card with modal for pasted long content in PromptInput

3 participants