shadcn.io is not affiliated with official shadcn/ui
FAQ with Contact Card Block for React
An 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.
Installation
Overview
An FAQ with a contact card for React with Base UI. The start column holds the title, one sentence and seven questions in hairline rows under a rule with + marks; the end column, behind a split divider that runs from the page's top rule to the block's end, holds a card in card that follows your theme (a tinted shell with + marks on its corners, a raised panel). The card lists three ways to reach a person, an email address, live chat with a status dot and its reply time, and a phone number with its hours, and ends in the block's one Shine Button. The card stays in view while the questions scroll; on a phone it follows the last question. It's built from Accordion, Item, Status, Guides and Shine Button, with CSS transitions for the entrance and your theme's tokens for every colour. For support pages where most visitors find their answer and the rest need to know how to reach someone.
FAQ
How do I change the questions and the contact details?
Edit QUESTIONS at the top of the file: each entry is an id, the question and its answer, one to three sentences. OPEN_QUESTION names the one that's open on load. The three contact rows are written in the markup under the card: change the address in the mailto: link, the number in the tel: link and the hours beside it. The live chat line is plain text with a green dot, so it says "Online" whether or not anyone is; connect it to your chat provider's status, or remove the row, before you ship.
How does the card stay in view?
From the lg breakpoint the card's box is position: sticky with a small offset, so it holds still while the questions scroll past and stops at the end of the block. Sticky stops working if a parent of the block has overflow set to hidden or auto, so don't wrap the section in one (overflow-x: clip on the section is fine). Below lg it isn't sticky: it sits after the last question.
Are the closed answers in the page's markup?
Yes. The Accordion takes hiddenUntilFound, so every closed answer stays in the markup as hidden="until-found", and the browser's find in page opens the answer that holds a match.
How does it work with a keyboard and a screen reader?
Each question is a button inside its own h3 under the section's h2, and the card's title is an h3 too. Tab moves from question to question, then through the email, chat and phone rows and on to the button; Enter or Space opens and closes a question, and the button says whether it's expanded. The three contact rows are a real list.
Tab alone moves between questions on this library: its accordion doesn't take arrow keys.
Where do the buttons and links go?
Start a chat is the block's one Shine Button, a link (href="#"): point it at your chat page or open your widget from it. The email and phone rows are plain links (mailto: and tel:), and the phone number keeps its digits in order in right-to-left pages.
The button renders the link it's given with render, with nativeButton={false}.
Related
- Pro
Accordion FAQ
Accordion listsA side-header FAQ for a web analytics tool: the title, one sentence and a contact prompt beside seven questions in an accordion, behind a split divider.
- Pro
Chatbot-Style FAQ
Contact and signupAn 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.
- Pro
Support Ticket FAQ
Contact and signupA ticket form that tries to make itself unnecessary, for a form builder: common questions at the start, and at the end a form on a card in card whose subject finds matching answers as you type.
- Pro
Reverse Split Dot Grid Map Hero
Diagrams and mapsA reverse split contact hero on solid rails: an abstract dot map with a pulsing marker per office fills the first half up to a divider, beside a headline, a Shine Button and three offices as ruled rows.
- Pro
Two Column FAQ
Accordion listsA reading-layout FAQ for a bakery-supplies wholesaler: the title, a sentence and a contact link stay in view at the start while ten questions scroll past in an accordion at the end.
- 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.