Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Apartment Hunt Chat Block for React

A lettings broker's thread with floor-plan listing cards, a Compare toggle on each, a side-by-side Compare pane with the better side marked in words, and a viewing request with three typed slots.

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 flat search as a conversation, with this apartment hunt chat for React with Base UI. A hairline frame holds a window of fixed height for Latchbury, a lettings agency: the broker, Iolanthe Brackwell, posts listing cards in the log with a drawn floor plan, the rent, the rooms, three amenity Badges, a Toggle to compare and a Request a viewing button that opens a Popover of three slots. Choosing two listings fills the Compare pane at the end with a side-by-side table, a word such as Cheaper or Larger on the better side of each row and one derived sentence for the difference; a third pick replaces the oldest. The composer's Shine Button is the only colored control. On a phone a Chat and Compare switch shows one pane at a time.

FAQ

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

Everything. The replies come from a short typed script in this file, picked by words in your message, then one fallback per message and a last line that says it was the last sample reply. Viewing requests, picks and the comparison live in state. Nothing is sent and no model runs, as the line under the composer says. To wire it for real, send the request from book to your lettings system and replace the LISTINGS array with your listings.

How does Compare choose and mark the better side?

Each listing has a Compare toggle. Two can be chosen at once and a third replaces the oldest. A pure helper builds each table row from the two listings: rent and rent per square metre are marked lower, area and bedrooms higher, and a tie gets no word. The sentence under the table is derived from the same two listings, so no number is typed twice.

What does Request a viewing do?

It opens a small popover of three typed slots. Choosing one posts a system line in the log, shows the slot on the card and says that nothing was booked. Asking again for the same listing replaces its slot.

How does the composer work?

Enter sends and Shift and Enter add a line, which the field's description says for a screen reader; Enter during text composition (an IME) is left alone. The field grows with its content up to a limit. Send stays quiet while the field is empty and says so if pressed, and focus stays in the field after sending.

Is it usable with a keyboard and a screen reader?

The log is a focusable region announced as a log, so new messages are read out once, and every message starts with a hidden name and time. The Compare table has a caption and row headers, the better side is a word and a check glyph, never a color, and Escape closes the slots popover. The avatars are hidden from assistive technology because the name is always in text.

How does it look on a phone?

Below the medium breakpoint the Compare pane hides and a Chat and Compare switch under the top bar shows one at a time, with the live count on the second. The window keeps its height and only the log and the pane scroll.