Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Direct Message Chat Block for React Aria

A one-to-one thread with a large avatar that opens a profile card on hover or focus, date pills that stick while their day scrolls, and a menu that copies a profile link or mutes the conversation.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Show a private conversation with this direct message chat for React with React Aria. A hairline frame with a plus mark on each corner holds a narrow window of fixed height for Nearholm, a messenger. The top bar has a large initials avatar that is a button: hovering or focusing it opens a Hover Card with the person's local time, shared groups and when they joined, and beside it sit the name and "Away, last active 12 min ago" with a hollow ring. At the end a Menu offers "Copy profile link", which writes a typed link to the clipboard, and "Mute for 8 hours", which draws a bell-off glyph and says so in the status line. The log is three days of Message and Bubble rows under date pills ("Fri 9 Oct", "Yesterday", "Today") that stick to the top while their day scrolls. The composer's Shine Button, the only colored control, sends, and a reply follows behind a Typing Indicator Text. The frame is ruled by Guides, and everything moves with CSS only. For a messenger, a marketplace inbox or any private thread with a person behind it.

FAQ

How does the profile card open?

The avatar is a real button, so the card opens on hover, on keyboard focus and, on a touch screen, on a press, and it closes on blur or Escape. Its contents (local time, shared groups, joined month) are typed in the file; fill them from your user record. There are no call or video buttons because nothing can be called in this demo.

What do the menu items do?

"Copy profile link" writes a typed link to the clipboard and the status line says whether it worked; if the browser refuses, it says so. "Mute for 8 hours" is local: it draws a bell-off glyph beside the name and changes the menu item to "Unmute", and nothing is silenced anywhere. In your app, save the mute against the conversation and its end time.

How do the date pills stick?

Each day is its own list holding its pill and its messages, and the pill is sticky inside that list, so it stays at the top while its day is on screen and is pushed away by the next day's pill. Dates are typed (including the ISO date on each time), so the thread reads the same on every visit.

What stays in the page, and how do I make it real?

Everything but the clipboard. The replies come from a short typed script, as the line under the composer says; nothing is sent and no model runs. To wire it for real, send each message to your server where the code says so, and add a pill when a message arrives on a new day.

How does the composer work?

Enter sends and Shift and Enter add a line, which the field's description says for a screen reader. The field grows with its content up to a limit, Send stays quiet while it is empty and says so if pressed, and focus stays in the field after sending.

How does it look on a phone?

The window is no wider than 28rem on every screen, so on a phone it fills the width unchanged: the card opens on a press, the pills still stick and the window keeps its height, with only the log scrolling.