shadcn.io is not affiliated with official shadcn/ui
Chatbot-Style FAQ Block for React
An FAQ you ask like a chat, for a local council: a chat window with six question chips that posts your choice, shows a typing indicator and replies with the FAQ's own answer.
Installation
Overview
A chatbot-style FAQ for React with Base UI. A header with an honest note sits at the start, and at the end a chat window on a card in card that follows your theme: a title bar with a status dot and a Start over button, the six question chips and a transcript. The window greets you and says it isn't a person. Choosing a chip posts the full question as your message, shows a typing indicator for a moment, and replies with that question's answer from the FAQ, word for word, with the name of the entry it came from. Nothing is generated: the chips are the only questions it knows, and it says so. It's built from Message, Bubble, Avatar, Typing Indicator Text, Status, Button and Guides, with CSS transitions for the entrance and your theme's tokens for every colour. For help pages where visitors would rather ask than scan.
FAQ
Is there a real chatbot behind it?
No, and the window says so. QUESTIONS holds six questions with a short label for the chip, the full question that's posted as your message and the answer that comes back, so every reply is text you wrote. There is no model, no free typing and no network request. To connect a real assistant, add a text field and replace ask with a call to it; keep the line that says what it is.
How does it work for a screen reader?
The transcript is a named log, role="log" with an accessible name, so each new message is announced politely as it's added: your question, then the typing indicator's "Looking through the FAQ", then the answer. The window keeps a fixed height and scrolls inside it; because it scrolls, it takes a Tab stop with a visible focus ring, so keyboard users can scroll it with the arrow keys.
Can I ask the same question twice, or while it's typing?
You can ask the same chip again: it's posted as a new message and answered again. While a reply is on its way, extra clicks are ignored, so the answers never arrive out of order. THINKING sets the wait in milliseconds; with reduced motion the dots hold still but the wait stays.
What does Start over do?
It clears the transcript back to the greeting and returns focus to the first chip. It's disabled while the window is already empty.
Related
- Pro
Answer Finder FAQ
SearchAn answer finder for a team writing tool on a card in card: describe a problem and the closest help article opens, quoted word for word, with two ranked articles to try.
- Pro
Live Search FAQ
SearchA searchable FAQ for a notes app: a start-aligned header, a band with a full-width search field and a live count, and ten questions that filter as you type, open every match and mark the matched words.
- Pro
FAQ with Contact Card
Contact and signupAn FAQ beside a contact card for an energy supplier: seven questions in an accordion, and behind a split divider a sticky card in card with email, live chat status, phone hours and a Shine Button.
- Pro
Split Layout Chat Skeleton Hero
Product windowsA split hero for an AI assistant: a headline, a Shine Button and a second action beside a chat app sketched in skeleton bars that runs off a tinted panel, closed by a band of three feature cells.
- Pro
Bubble Chat Testimonials
Chats and postsA reverse split on drafting lines: a group chat of five dispatchers in a hairline frame, alternating message bubbles with a name, role and relative time above each, beside a header and one Shine Button.
- Pro
Newsletter FAQ
Contact and signupA subscribe form in a side header, for a weekly newsletter of product notes: a labelled email field, the Shine Button and a confirmation beside six questions about the newsletter.