Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

FAQ

ProNew

A questions section with live search, categories and four layouts: boxed accordion, flat dropdown rows, a plain list and multi-column cards.

Installation

pnpm dlx shadcn@latest add @viewport/faq

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
items*FaqItem[]—
layout"accordion" | "dropdown" | "list" | "columns"

`accordion` is one bordered box, `dropdown` is flat rows, `list` shows every answer, `columns` lays the answers out as cards.

"accordion"
titlestring

Heading above the search field.

"Frequently Asked Questions"
searchboolean

Shows the search field.

true
placeholderstring"Search..."
categoriesFaqCategory[]

Groups the questions under these headings, in this order.

—
icon"chevron" | "plus"

The mark at the end of each row: a chevron that flips or a plus that turns into a minus.

"chevron"
multipleboolean

Lets several answers stay open at once.

false
defaultOpenstring[]

Ids of the questions that start open.

[]
accentstring

Any CSS color. Fills the rows and the search field with it and turns the text white.

—
columns2 | 3

Most columns in the `columns` layout.

2
schemaboolean

Emits FAQPage structured data (JSON-LD) for the questions whose answers are plain text. Off by default: enable it once per page, since search engines want a single FAQPage block.

false
classNamestring—

Accessibility

  • Each question is a heading with a button that reports expanded or collapsed; Enter and Space toggle it.
  • The search field is labelled, Escape clears it, and the number of matches is announced politely.
  • The list and columns layouts are a description list, so questions and answers stay paired.
  • Answers open to their measured height, or instantly under reduced motion.