shadcn.io is not affiliated with official shadcn/ui
Share Popover FAQ Block for React
A FAQ for an event ticketing platform whose open answer ends in a Share button: a popover with a copy-link button, an email and a QR code of the answer's link.
Installation
Overview
A shareable FAQ for React with Base UI. Six questions sit in hairline rows that run from rail to rail while their text keeps to a centred column, each marked by a ringed chevron that turns over when the row opens. The open answer ends in a Share button; it opens a small popover with the answer's link in a copy button, an email with the answer quoted, and, on a screen wide enough to have a phone nearby, a QR code that opens the answer on one. The page's rails and top rule come from the Guides spine, so the block lines up with its neighbours in a stack. It's built from Accordion, Popover, Copy Button, QR Code, Button and Guides, with CSS transitions for the entrance and your theme's tokens for every colour. For ticketing, support and help pages where an answer is worth forwarding.
FAQ
What does the Share popover offer?
Three things, none of them a brand's button. Copy link puts the answer's address on the clipboard and says "Link copied" to screen readers. Email opens the visitor's mail app with the question as the subject and the answer and its link as the body. The QR code is drawn in the browser from the same address, with nothing sent anywhere, and says to scan it to open the answer on a phone. It's hidden on a phone, where there's no other screen to scan from.
Where do the links point?
answerUrl builds https://gatehouse.example/help/<question id> for each question. Change its host and path to your own pages; the copy button, the email and the QR code all read it. mailto builds the email, encoding the question and the answer for the address.
How does the popover behave with a keyboard and a screen reader?
The Share button opens the popover and moves focus into it; Tab walks through Copy link and Email, and Escape or a click outside closes it and returns focus to the button. The popover has a title, "Share this answer", and the QR code is a named image. Each question is a button inside its own h3, with the ringed chevron hidden from assistive technology.
How is Email wired?
It's a link with a mailto: address, so it works in any mail app.
The button renders the link it's given with render, with nativeButton={false}.
Does the QR code follow the theme?
No, on purpose: a QR code needs dark modules on a light ground to scan, so it stays black on white in every theme, with a hairline ring to set it off in dark mode. Everything else in the popover takes your theme's tokens.
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": search engines see all of them, and the browser's find in page opens the answer that holds a match.
How does it fit on a phone?
The rows keep their hairlines from rail to rail and the text fills the screen with a 24 pixel margin. The popover is as wide as the screen allows, up to 20 rem, without the QR code, and nothing scrolls sideways at 320 pixels. Pressing Share inside an open answer never moves the rows.
Related
- Pro
Anchor Link FAQ
Reading and sharingA FAQ for a documentation host with a # link on every question that copies its address, and deep links that open and ring the matching answer on load.
- Pro
Copy Reply FAQ
Reading and sharingA support playbook FAQ for a help desk: each situation opens on the team's advice and a reply to send, with its length in characters and a Copy reply button.
- Pro
Bookmarks FAQ
Reading and sharingA side-header FAQ for a music-lessons platform: a star on every row, a framed Saved questions panel, and an All and Saved filter that shows only the rows you kept.
- 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
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
Multi-Language FAQ
Reading and sharingAn FAQ in English, Spanish and Arabic for a relocation service: a language switcher swaps the title, questions and answers, and sets lang and dir so Arabic lays the block out from its end.