An FAQ styled as a message thread, with each answer sent as a reply bubble.
Click a question to open its answer, and click it again to close it. Arrow keys move between questions.
Options you can pass to customize this component.
items*FaqItem[]The questions, each one an id, a question, and an answer.
valuestringnullId of the open question. Pass this to control which one is open.
defaultValuestringnullId of the question open on first render.
onValueChange(value: string | null) => voidCalled with the open id, or null, every time a question opens or closes.
accentstringAny CSS color for the answer bubbles.
avatarReactNodeYour logo or image, shown in a circle beside each answer. Pass null to hide it.
classNamestringExtra classes merged onto the root element (data-slot="faq").
npx shadcn@latest add swamimalode07/rare-ui/faq"use client"import { Faq } from "@/components/ui/faq"export function Demo() {return (<Faqitems={[{id: "free",question: "Is it free?",answer: "Yes, for personal and commercial projects.",},{id: "install",question: "How do I install a component?",answer: "Add it with the shadcn CLI.",},]}/>)}
Click the code icon in the top-right corner to view the source code.
Most components here are recreations of great work from around the web. I don't claim to be the original creator - this is my attempt to reverse-engineer, replicate, and often add a few extra features. I've tried to credit everyone; if I missed someone, let me know.
1