Message Status
How far a message has got: sending, sent, delivered, read, or not sent with a retry.
Installation
npx shadcn@latest add "@aiellie/message-status"shadcn needs the @aiellie registry in components.json first. npx aiellie add message-status adds it on its first run, then installs the same way.
Message Status shows how far a message has got: a clock while sending, a tick once sent, a double tick when delivered, the same double tick in full ink once read, and a warning when it couldn't be sent. A failed message can offer "Try again".
It's an icon with its name kept for screen readers, or shown with showLabel.
Getting started
Put it under the message
components/sent-message.tsximport { Message, MessageContent, MessageFooter, MessagePart, } from "@/components/aiellie/message" import { MessageStatus, type MessageStatusValue, } from "@/components/aiellie/message-status" export function SentMessage({ text, status, onRetry, }: { text: string status: MessageStatusValue onRetry: () => void }) { return ( <Message align="end"> <MessageContent> <MessagePart>{text}</MessagePart> <MessageFooter> <MessageStatus status={status} onRetry={onRetry} /> </MessageFooter> </MessageContent> </Message> ) }
Anatomy
<span data-slot="message-status" data-status="read" role="status">
<svg />
<span /> {/* the label, screen readers only unless showLabel */}
<button /> {/* Try again, when failed */}
</span>It's a status region, so the new state is read out without interrupting. The clock pulses while sending, except under reduced motion.
Examples
Your words
labels renames any of the states.
API reference
MessageStatus
| Prop | Type | Default | Description |
|---|---|---|---|
status | "sending" | "sent" | "delivered" | "read" | "failed" | required | |
showLabel | boolean | false | Shows the name beside the icon. |
labels | Partial<Record<status, string>> | Your own names. | |
onRetry | () => void | Adds "Try again" when failed. |
All other span props are forwarded.