Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Print-Friendly FAQ Block for React

An FAQ you can take on the trail, for a park visitor service: eight accordion rows, a Print this FAQ button and real print styles that open every answer and drop the controls.

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

A print-friendly FAQ for React with Base UI. A start-aligned header carries a "Print this FAQ" button at its end, with a line under it saying what printing does; under it, eight accordion rows run from rail to rail under a rule with + marks, each with a plus in a small square that turns into a minus. On screen it reads like any accordion. On paper it changes: a plain list of every question with its answer replaces the accordion, the button and the lines are gone, text is black whatever your theme, entries never split across pages, and a line at the foot tells the reader to check for changes. It's built from Accordion, Guides and Button, with CSS transitions for the entrance and your theme's tokens for every colour. For visitor guides, policies and rules that people keep in a bag or on a fridge.

FAQ

How does the print layout work?

The button calls window.print(), and the page's print: styles do the rest. The accordion, the spine's lines, the band's rule, the button and its note are hidden; a plain list of every question with its answer, hidden on screen, appears in their place; each entry avoids breaking across pages; and a one-line footnote appears at the foot. Colours are set with three variables on the section (--foreground, --muted-foreground, --border), so a dark theme still prints black on white. Browsers leave out background colours by default, and nothing here relies on one.

Why is there a second list for printing?

Because it works the same on every library and can't be broken by how an accordion hides its closed answers: a closed panel is hidden by the browser's own hidden attribute, which a print style can't reliably undo. The list is a dl that's display: none on screen, so screen readers skip it and the page shows each answer once. It's built from the same QUESTIONS array as the rows, so the two can't drift apart. The rows also keep every closed answer in the markup as hidden="until-found" (hiddenUntilFound).

Does the note under the button stay true?

Yes. It counts the questions from the same QUESTIONS array the rows are built from, so adding or removing one updates "Prints all 8 answers". It doesn't promise a page count, because that depends on the browser, the paper and the reader's font size.

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 print button is a real button with its text. Tab moves between the print button and the questions; Enter or Space opens and closes a row, and the button says whether it's expanded. Tab alone moves between questions on this library: its accordion doesn't take arrow keys.

What does the button look like, and why isn't it a Shine Button?

It's an outline Button with a printer icon. Printing is a convenience, not the block's main call to action, so it keeps the primary colour for your own sign-up or booking button elsewhere on the page.

How does it fit on a phone?

Below the md breakpoint the header stacks, the print button spans the full width under the text, and the rows run rail to rail. Many phones can't print directly; there the browser's share sheet usually offers "Print" or "Save as PDF".

  • Pro

    Accordion FAQ

    Accordion lists

    A 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

    Compact FAQ

    Accordion lists

    A dense FAQ for ski-lift passes: ten tight accordion rows with small type and one-sentence answers in a narrow framed list, a chevron at the start of each row.

  • Pro

    Numbered FAQ

    Accordion lists

    A numbered FAQ for a wine club: eight accordion rows from rail to rail, with a margin of tabular numerals, 01 to 08, behind a hairline; the open row's numeral turns to full strength.

  • Pro

    Minimal FAQ

    Cards and grids

    A type-forward FAQ for a stationery brand: six questions in large type with their answers on show in a definition list, no cards or row lines, and one contact link.

  • Pro

    Share Popover FAQ

    Reading and sharing

    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.

  • Pro

    Multi-Language FAQ

    Reading and sharing

    An 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.