Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Book Recommendation Chat Block for Radix UI

A librarian's thread with book cards that show a drawn cover, a genre, a rating from readers, a line on why she picked it and an Add to reading list toggle, plus a Reading list button in the top bar that lists and removes books.

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 reading advice as a conversation, with this book recommendation chat for React with Radix UI. A hairline frame holds a window of fixed height for Shelfhaven, a public library: the librarian, Perpetua Wyndham, posts book cards with a cover drawn from shapes, the title, the author, a genre Badge, a read-only Rating such as 4.3 from 212 readers and a line on why she picked it for you. An Add to reading list Toggle on each card feeds the Reading list button in the top bar, which opens a Popover of what you added with a remove button on each. The composer's Shine Button is the only colored control.

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. The list lives in state and goes nowhere. The books and ratings are examples. Nothing is sent and no model runs, as the line under the composer says. To wire it for real, send the ids from add to your catalog's list endpoint and load BOOKS from it.

How does the reading list stay in step?

The toggles on the cards, the count on the top bar button and the popover's rows all read one array of ids, so adding on a card, removing in the popover and the count never disagree.

How are the covers drawn?

As small SVGs from a rounded rectangle, a spine stripe and the title's first letter, in foreground weights. They are decoration; the title and author are always in text.

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 rating is hidden from assistive technology and its score is in text, the toggle names its book, and Escape closes the list popover. The avatars are hidden from assistive technology because the name is always in text.

How does it look on a phone?

The same single column: the cover sits beside the facts, the reading list button keeps its count and the window keeps its height while only the log scrolls.