shadcn.io is not affiliated with official shadcn/ui
Tabbed Vertical FAQ Block for React
A vertical-tabs FAQ for a transit app: a rail of five topics with an icon and a count each, beside the open topic's accordion, behind a split divider.
Installation
Overview
A vertical-tabs FAQ for React with Base UI. Under a compact header, a rail at the start lists five topics, each with an icon, its name and a count of its questions; the open topic's accordion fills the end, behind a split divider that runs from the top rule to the block's end, and a contact prompt sits at the rail's foot. Below lg the rail becomes a row of tabs that scrolls sideways, the arrow keys switch from Up and Down to Start and End to match, and the panels share one minimum height so choosing a topic never moves the page. It's built from Tabs, Accordion, Badge, Guides and Button, with your theme's tokens for every colour. For help centres and product FAQs with four to six topics of three or four questions each.
FAQ
How do I change the topics?
Edit TOPICS at the top of the file: each topic has an id, an icon (any lucide icon), a label and its questions. The count beside each name is the length of that list. The first question of every topic opens when its tab is chosen; change defaultValue on the accordion to open another, or to none.
How does the keyboard work, in the rail and on a phone?
In the rail the tabs are a vertical tab list: Up and Down move between topics, Home and End jump to the first and last, and Tab moves into the open panel. Below lg the same list is horizontal, so the Start and End arrows (mirrored in a right-to-left layout) take over. The block reads the screen width in an effect and tells the tab list which way it runs, so the keys always match what you see.
Is there a flash on a phone when the page loads?
The server renders the rail, because the orientation is read from the screen only in the browser; on a phone the list turns horizontal as soon as the page hydrates, a moment after first paint. The two lists share one set of tabs and panels, so no state is lost and the layout settles in one step.
Are the answers of the other topics in the page's markup?
The panels of the topics you aren't looking at stay in the page, hidden.
Each panel takes keepMounted and each Accordion hiddenUntilFound, so closed answers stay in the markup and the browser's find in page opens them.
Related
- Pro
Categorized FAQ
Topics and filtersA topic-tabbed FAQ for a bookkeeping app: a compact header, a band of line tabs with a count on each, and one accordion per topic.
- Pro
Collapsible Sidebar FAQ
NavigationA sidebar FAQ for a holiday-rental site: a topic rail with two collapsible groups and a live count, beside a filtered list, and a native select on phones.
- Pro
Split View FAQ
NavigationA master-detail FAQ for a sales CRM: a list of eight questions at the start and the chosen answer in a framed panel at the end, with a Next question button.
- Pro
Table of Contents FAQ
NavigationA FAQ for an object-storage service with a sticky table of contents: three topics and their questions in an outline that follows the reader, beside topic bands that each hold an accordion.
- Pro
Agenda by Day FAQ
Charts and documentsA conference FAQ with the agenda beside the questions: tabs for three days over a time column of sessions, and six questions about tickets and getting there behind a split divider.
- Pro
Breadcrumb FAQ
NavigationA drill-down help centre for a mobile carrier: four topic cells in a framed card, a breadcrumb bar, and each topic's questions behind a click.