Quoted Message
The words a reply is about, kept to a short excerpt above it behind a rule on the start side, with who said them and a way to remove the quote.
Installation
npx shadcn@latest add "@aiellie/quoted-message"shadcn needs the @aiellie registry in components.json first. npx aiellie add quoted-message adds it on its first run, then installs the same way.
Quoted Message keeps the words a reply is about above it: a short excerpt behind a rule on the start side, with who said them. Above a message it can lead back to the original; in a composer it says what the message being written answers, and can be taken off again.
Getting started
Quote above a message
Render the content as a button or link when it should lead back to what it quotes.
components/reply-with-quote.tsximport { QuotedMessage, QuotedMessageContent, QuotedMessageText, } from "@/components/aiellie/quoted-message" export function ReplyQuote({ text, onJump }: { text: string; onJump: () => void }) { return ( <QuotedMessage> <QuotedMessageContent render={<button type="button" onClick={onJump} />} lines={1}> <QuotedMessageText>{text}</QuotedMessageText> </QuotedMessageContent> </QuotedMessage> ) }
Anatomy
<div data-slot="quoted-message">
<div data-slot="quoted-message-content"> {/* or a button or link */}
<span data-slot="quoted-message-author" />
<span data-slot="quoted-message-text" />
</div>
<button data-slot="quoted-message-dismiss" />
</div>The excerpt is cut after lines lines, two by default, so a long quote never pushes the reply down. The quote is in muted-foreground, set apart from the words that answer it by the rule and the ink rather than by a box.
Content rendered as a button or link takes the ring colour on its border when focused, and foreground on hover.
Examples
In the composer
Put the quote at the top of the composer with a way to take it off, and clear it once the message is sent.
API reference
QuotedMessageContent
| Prop | Type | Default | Description |
|---|---|---|---|
lines | 1 | 2 | 3 | 2 | How many lines of the excerpt show before it's cut. |
render | ReactElement | Renders it as another element, like a button or link. |
All other div props are forwarded.
QuotedMessageDismiss
| Prop | Type | Default | Description |
|---|---|---|---|
tooltip | string | "Remove quote" | Its name. |
All other TooltipIconButton props are forwarded.
QuotedMessage, QuotedMessageAuthor, QuotedMessageText
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | Merged onto the element. |
All other props of their element are forwarded.